args-api 0.1.0

Shared API contract types and endpoint definitions for args.
Documentation
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use uuid::Uuid;

use crate::resource::common::AuthorResource;

#[derive(ApiResource, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct BugResource {
    pub id: Uuid,
    pub number: i32,
    pub repo_id: Uuid,

    pub author_id: Uuid,
    pub author_role: String,
    pub commit_sha: Option<String>,

    pub title: String,
    pub description: String,
    pub status: String,

    pub created_at: DateTime<Utc>,
    pub updated_at: DateTime<Utc>,

    // projections
    pub author: AuthorResource,
    pub comments: Vec<BugCommentResource>,
}

#[derive(ApiResource, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct BugCommentResource {
    pub id: Uuid,
    pub bug_id: Uuid,

    pub author_id: Uuid,
    pub author_role: String,

    pub body: String,
    pub status_change: Option<String>,

    pub created_at: DateTime<Utc>,
    pub updated_at: DateTime<Utc>,

    // projections
    pub author: AuthorResource,
}