Skip to main content

max / makenotwork

2.5 KB · 66 lines History Blame Raw
1 {
2 "db_name": "PostgreSQL",
3 "query": "SELECT u.mnw_account_id AS user_id,\n u.username,\n u.display_name,\n u.avatar_url,\n m.role AS \"role: CommunityRole\",\n m.joined_at AS \"joined_at: chrono::DateTime<chrono::Utc>\",\n (SELECT COUNT(*) FROM posts p\n JOIN threads t ON t.id = p.thread_id\n JOIN categories c ON c.id = t.category_id\n WHERE p.author_id = u.mnw_account_id\n AND c.community_id = co.id\n AND p.removed_at IS NULL\n AND p.deleted_at IS NULL\n AND t.deleted_at IS NULL) AS \"post_count!\",\n (SELECT COUNT(*) FROM post_endorsements pe\n JOIN posts p ON p.id = pe.post_id\n JOIN threads t ON t.id = p.thread_id\n JOIN categories c ON c.id = t.category_id\n WHERE p.author_id = u.mnw_account_id\n AND c.community_id = co.id\n AND p.removed_at IS NULL\n AND p.deleted_at IS NULL\n AND t.deleted_at IS NULL) AS \"endorsement_count!\"\n FROM users u\n JOIN memberships m ON m.user_id = u.mnw_account_id\n JOIN communities co ON co.id = m.community_id\n WHERE co.slug = $1 AND u.username = $2",
4 "describe": {
5 "columns": [
6 {
7 "ordinal": 0,
8 "name": "user_id",
9 "type_info": "Uuid"
10 },
11 {
12 "ordinal": 1,
13 "name": "username",
14 "type_info": "Text"
15 },
16 {
17 "ordinal": 2,
18 "name": "display_name",
19 "type_info": "Text"
20 },
21 {
22 "ordinal": 3,
23 "name": "avatar_url",
24 "type_info": "Text"
25 },
26 {
27 "ordinal": 4,
28 "name": "role: CommunityRole",
29 "type_info": "Text"
30 },
31 {
32 "ordinal": 5,
33 "name": "joined_at: chrono::DateTime<chrono::Utc>",
34 "type_info": "Timestamptz"
35 },
36 {
37 "ordinal": 6,
38 "name": "post_count!",
39 "type_info": "Int8"
40 },
41 {
42 "ordinal": 7,
43 "name": "endorsement_count!",
44 "type_info": "Int8"
45 }
46 ],
47 "parameters": {
48 "Left": [
49 "Text",
50 "Text"
51 ]
52 },
53 "nullable": [
54 false,
55 false,
56 true,
57 true,
58 false,
59 false,
60 null,
61 null
62 ]
63 },
64 "hash": "cb23b4f88ed4d2395a72f1372a938724332cae7326201b3932f19c769ff65b49"
65 }
66