JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Base protocol refactor complete

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨079d544

⁨giterated-models/src/model/settings.rs⁩ - ⁨1279⁩ bytes
Raw
1 use serde::{de::DeserializeOwned, Deserialize, Serialize};
2 use serde_json::Value;
3
4 pub trait Setting: Serialize + DeserializeOwned {
5 fn name() -> &'static str;
6 }
7
8 #[derive(Debug, Clone, Serialize, Deserialize)]
9 pub struct AnySetting(pub Value);
10
11 impl Setting for AnySetting {
12 fn name() -> &'static str {
13 "any"
14 }
15 }
16
17 #[derive(Debug, Serialize, Deserialize)]
18 pub struct UserBio(pub String);
19
20 impl Setting for UserBio {
21 fn name() -> &'static str {
22 "Bio"
23 }
24 }
25
26 #[derive(Debug, Serialize, Deserialize, Clone)]
27 pub struct UserDisplayName(pub String);
28
29 impl Setting for UserDisplayName {
30 fn name() -> &'static str {
31 "Display Name"
32 }
33 }
34
35 #[derive(Debug, Serialize, Deserialize)]
36 pub struct UserDisplayImage(pub String);
37
38 impl Setting for UserDisplayImage {
39 fn name() -> &'static str {
40 "Profile Image"
41 }
42 }
43
44 #[derive(Debug, Serialize, Deserialize)]
45 pub struct RepositoryDescription(pub String);
46
47 impl Setting for RepositoryDescription {
48 fn name() -> &'static str {
49 "Repository Description"
50 }
51 }
52
53 #[derive(Debug, Serialize, Deserialize)]
54 pub struct RepositoryVisibilitySetting(pub String);
55
56 impl Setting for RepositoryVisibilitySetting {
57 fn name() -> &'static str {
58 "Repository Visibility"
59 }
60 }
61