couchdb-orm 0.1.6

couchdb-orm Copyright (C) 2020-2023 OpenToolAdd This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; type `show-license' for details. A CLI ORM to manage some Databases operations like migration, schema creation, etc.... For the moment it only handle CouchDB.
Documentation
use std::collections::HashMap;

#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub enum Status {
    Draft,
    Ready,
    Completed,
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub enum TeamRole {
    Owner,
    Contributor,
}

pub type Team = HashMap<String, TeamRole>;

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct Task {
    #[serde(rename = "_id")]
    pub id: Option<String>,
    #[serde(rename = "_rev")]
    pub rev: Option<String>,
    pub title: String,
    pub description: String,
    pub status: Status,
    pub team: Team,
}

impl Task {
    pub fn new(title: String, description: Option<String>, team: Team) -> Self {
        Task {
            id: None,
            rev: None,
            title,
            description: description.unwrap_or_default(),
            status: Status::Draft,
            team,
        }
    }
}