Add users table
parent: tbd commit: 9f36e3f
1 | use Error; |
2 | |
3 | use PgPool; |
4 | |
5 | use crate |
6 | UserBioRequest, UserBioResponse, UserDisplayImageRequest, UserDisplayImageResponse, |
7 | UserDisplayNameRequest, UserDisplayNameResponse, |
8 | ; |
9 | |
10 | use ; |
11 | |
12 | |
13 | pub pg_pool: PgPool, |
14 | |
15 | |
16 | |
17 | |
18 | Self |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | async |
25 | &mut self, |
26 | request: UserDisplayNameRequest, |
27 | |
28 | let db_row = query_as! |
29 | UserRow, |
30 | r#"SELECT * FROM users WHERE username = $1"#, |
31 | request.user.username |
32 | |
33 | .await?; |
34 | |
35 | Ok |
36 | display_name: db_row.display_name, |
37 | |
38 | |
39 | |
40 | async |
41 | &mut self, |
42 | request: UserDisplayImageRequest, |
43 | |
44 | let db_row = query_as! |
45 | UserRow, |
46 | r#"SELECT * FROM users WHERE username = $1"#, |
47 | request.user.username |
48 | |
49 | .await?; |
50 | |
51 | Ok |
52 | image_url: db_row.image_url, |
53 | |
54 | |
55 | |
56 | async |
57 | &mut self, |
58 | request: UserBioRequest, |
59 | |
60 | let db_row = query_as! |
61 | UserRow, |
62 | r#"SELECT * FROM users WHERE username = $1"#, |
63 | request.user.username |
64 | |
65 | .await?; |
66 | |
67 | Ok |
68 | |
69 | |
70 | |
71 | |
72 | |
73 | async |
74 | todo! |
75 | |
76 | |
77 | async |
78 | todo! |
79 | |
80 | |
81 | |
82 | |
83 | |
84 | pub username: String, |
85 | pub display_name: , |
86 | pub bio: , |
87 | pub email: , |
88 | pub password: String, |
89 | |
90 |