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

ambee/giterated

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

Basic Issue data structures

Emilia - ⁨1⁩ year ago

parent: tbd commit: ⁨509aa4e

⁨giterated-models/src/issue/values.rs⁩ - ⁨1598⁩ bytes
Raw
1 use serde::{Deserialize, Serialize};
2
3 use crate::{settings::Setting, user::User, value::GiteratedObjectValue};
4
5 use super::{Issue, IssueStatus, IssueTag};
6
7 #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)]
8 #[repr(transparent)]
9 #[serde(transparent)]
10 pub struct Tags(pub Vec<IssueTag>);
11
12 impl GiteratedObjectValue for Tags {
13 type Object = Issue;
14
15 fn value_name() -> &'static str {
16 "tags"
17 }
18 }
19
20 impl Setting for Tags {
21 fn name() -> &'static str {
22 "tags"
23 }
24 }
25
26 #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)]
27 #[repr(transparent)]
28 #[serde(transparent)]
29 pub struct Status(pub IssueStatus);
30
31 impl GiteratedObjectValue for Status {
32 type Object = Issue;
33
34 fn value_name() -> &'static str {
35 "status"
36 }
37 }
38
39 impl Setting for Status {
40 fn name() -> &'static str {
41 "status"
42 }
43 }
44
45 #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)]
46 #[repr(transparent)]
47 #[serde(transparent)]
48 pub struct Title(pub String);
49
50 impl GiteratedObjectValue for Title {
51 type Object = Issue;
52
53 fn value_name() -> &'static str {
54 "title"
55 }
56 }
57
58 impl Setting for Title {
59 fn name() -> &'static str {
60 "title"
61 }
62 }
63
64 #[derive(Debug, Hash, Clone, PartialEq, Eq, Serialize, Deserialize)]
65 #[repr(transparent)]
66 #[serde(transparent)]
67 pub struct Assignees(pub Vec<User>);
68
69 impl GiteratedObjectValue for Assignees {
70 type Object = Issue;
71
72 fn value_name() -> &'static str {
73 "assignees"
74 }
75 }
76
77 impl Setting for Assignees {
78 fn name() -> &'static str {
79 "assignees"
80 }
81 }
82