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/values/repository.rs⁩ - ⁨1148⁩ bytes
Raw
1 use serde::{Deserialize, Serialize};
2
3 use crate::{
4 model::{
5 repository::{Repository, RepositoryVisibility},
6 settings::Setting,
7 },
8 operation::GiteratedObjectValue,
9 };
10
11 // pub struct RepositorySetting<V: GiteratedObjectValue>(pub V);
12
13 // impl<O: GiteratedObject, V: GiteratedObjectValue<Object = O> + Send> GiteratedOperation<O>
14 // for RepositorySetting<V>
15 // {
16 // fn operation_name(&self) -> &'static str {
17 // "setting_get"
18 // }
19 // type Success = V;
20 // type Failure = GetValueError;
21 // }
22
23 #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)]
24 pub struct Description(pub String);
25
26 impl GiteratedObjectValue for Description {
27 type Object = Repository;
28
29 fn value_name() -> &'static str {
30 "description"
31 }
32 }
33
34 impl Setting for Description {
35 fn name() -> &'static str {
36 "description"
37 }
38 }
39
40 #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)]
41 pub struct Visibility(pub RepositoryVisibility);
42
43 impl GiteratedObjectValue for Visibility {
44 type Object = Repository;
45
46 fn value_name() -> &'static str {
47 "visibility"
48 }
49 }
50