Skip to main content

args_api/resource/
bug.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use uuid::Uuid;
4
5use crate::resource::common::AuthorResource;
6
7#[derive(ApiResource, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8pub struct BugResource {
9    pub id: Uuid,
10    pub number: i32,
11    pub repo_id: Uuid,
12
13    pub author_id: Uuid,
14    pub author_role: String,
15    pub commit_sha: Option<String>,
16
17    pub title: String,
18    pub description: String,
19    pub status: String,
20
21    pub created_at: DateTime<Utc>,
22    pub updated_at: DateTime<Utc>,
23
24    // projections
25    pub author: AuthorResource,
26    pub comments: Vec<BugCommentResource>,
27}
28
29#[derive(ApiResource, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
30pub struct BugCommentResource {
31    pub id: Uuid,
32    pub bug_id: Uuid,
33
34    pub author_id: Uuid,
35    pub author_role: String,
36
37    pub body: String,
38    pub status_change: Option<String>,
39
40    pub created_at: DateTime<Utc>,
41    pub updated_at: DateTime<Utc>,
42
43    // projections
44    pub author: AuthorResource,
45}