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