So. Much. Work.
parent: tbd commit: b05f964
1 | |
2 | |
3 | |
4 | use Any; |
5 | use Arc; |
6 | |
7 | use Context; |
8 | |
9 | use Instance; |
10 | use |
11 | CommitBodyType, DefaultBranch, Description, Repository, Visibility, |
12 | ; |
13 | use ; |
14 | use MetadataProvider; |
15 | use ; |
16 | use ; |
17 | use Value; |
18 | use PgPool; |
19 | use Debug; |
20 | use ; |
21 | |
22 | use crate; |
23 | use crate; |
24 | |
25 | use |
26 | instance_authentication_request, instance_create_repository_request, |
27 | instance_registration_request, repository_commit_before, repository_commit_by_id, |
28 | repository_diff, repository_diff_patch, repository_file_from_id, repository_file_from_path, |
29 | repository_get_branches, repository_get_statistics, repository_info, |
30 | repository_last_commit_of_file, user_get_repositories, |
31 | ; |
32 | |
33 | /// A backend implementation which attempts to resolve data from the instance's database. |
34 | |
35 | |
36 | |
37 | pub(self) our_instance: Instance, |
38 | pub(self) pool: PgPool, |
39 | pub(self) user_backend: , |
40 | pub(self) repository_backend: , |
41 | pub stack: , |
42 | |
43 | |
44 | |
45 | |
46 | instance: Instance, |
47 | user_backend: , |
48 | repository_backend: , |
49 | pool: PgPool, |
50 | stack: , |
51 | |
52 | Self |
53 | our_instance: instance, |
54 | user_backend, |
55 | repository_backend, |
56 | pool, |
57 | stack, |
58 | |
59 | |
60 | |
61 | |
62 | let mut builder = new; |
63 | |
64 | builder.object_metadata_provider; |
65 | |
66 | builder |
67 | . |
68 | . |
69 | .; |
70 | |
71 | // Register value settings, which are settings that directly correspond to |
72 | // value types. |
73 | builder |
74 | . |
75 | . |
76 | . |
77 | . |
78 | . |
79 | .; |
80 | |
81 | // builder.value(repository_latest_commit); |
82 | |
83 | builder |
84 | .operation |
85 | .operation |
86 | .operation |
87 | .operation |
88 | .operation |
89 | .operation |
90 | .operation |
91 | .operation |
92 | .operation |
93 | .operation |
94 | .operation |
95 | .operation |
96 | .operation |
97 | .operation; |
98 | |
99 | builder |
100 | |
101 | |
102 | |
103 | |
104 | |
105 | f.debug_struct .finish |
106 | |
107 | |
108 | |
109 | |
110 | |
111 | |
112 | object.|| object. || object. |
113 | |
114 | |
115 | async |
116 | &self, |
117 | object: AnyObject, |
118 | _object_meta: &ObjectMeta, |
119 | setting: AnySetting, |
120 | setting_meta: &SettingMeta, |
121 | |
122 | if let Some = object. |
123 | ! | query
124 | repository.to_string, setting_meta.name, to_string? |
125 | .execute .await?; |
126 | |
127 | Ok |
128 | else if let Some = object. |
129 | ! | query
130 | user.username, setting_meta.name, to_string? |
131 | .execute .await?; |
132 | |
133 | Ok |
134 | else |
135 | unreachable! |
136 | |
137 | |
138 | |
139 | async |
140 | &self, |
141 | object: AnyObject, |
142 | _object_meta: &ObjectMeta, |
143 | setting_meta: &SettingMeta, |
144 | |
145 | if let Some = object. |
146 | let row = query_as! |
147 | RepositorySettingRow, |
148 | "SELECT * FROM repository_settings WHERE repository = $1 AND name = $2", |
149 | repository.to_string, |
150 | setting_meta.name |
151 | |
152 | .fetch_one |
153 | .await?; |
154 | |
155 | let setting = |
156 | context?; | from_str .
157 | |
158 | Ok |
159 | else if let Some = object. |
160 | info!; |
161 | let row = query_as! |
162 | UserSettingRow, |
163 | "SELECT * FROM user_settings WHERE username = $1 AND name = $2", |
164 | user.username, |
165 | setting_meta.name |
166 | |
167 | .fetch_one |
168 | .await?; |
169 | |
170 | let setting = |
171 | context?; | from_str .
172 | |
173 | Ok |
174 | else |
175 | unreachable! |
176 | |
177 | |
178 | |
179 |