adds data model

This commit is contained in:
itsscb 2024-08-04 21:39:19 +02:00
parent e862b43281
commit 79c739ad77
2 changed files with 29 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# Jira Clone # scrumtask-cli
## IMPORTANT NOTE ## IMPORTANT NOTE

View File

@ -1,28 +1,48 @@
use std::collections::HashMap;
pub enum Status { pub enum Status {
// TODO: add fields (make sure the fields are public) Open,
InProgress,
Resolved,
Closed,
} }
pub struct Epic { pub struct Epic {
// TODO: add fields (make sure the fields are public) pub name: String,
pub description: String,
pub status: Status,
pub stories: Vec<u32>,
} }
impl Epic { impl Epic {
pub fn new(name: String, description: String) -> Self { pub fn new(name: String, description: String) -> Self {
todo!() // by default the status should be set to open and the stories should be an empty vector Self {
name,
description,
status: Status::Open,
stories: vec![]
}
} }
} }
pub struct Story { pub struct Story {
// TODO: add fields (make sure the fields are public) pub name: String,
pub description: String,
pub status: Status,
} }
impl Story { impl Story {
pub fn new(name: String, description: String) -> Self { pub fn new(name: String, description: String) -> Self {
todo!() // by default the status should be set to open Self {
name,
description,
status: Status::Open,
}
} }
} }
pub struct DBState { pub struct DBState {
// This struct represents the entire db state which includes the last_item_id, epics, and stories pub last_item_id: u32,
// TODO: add fields (make sure the fields are public) pub epics: HashMap<u32, Epic>,
} pub stories: HashMap<u32, Story>,
}