Create Project struct
This commit is contained in:
parent
e8eab81957
commit
57f21e2634
3 changed files with 29 additions and 1 deletions
|
|
@ -1,3 +1,5 @@
|
|||
mod project;
|
||||
|
||||
fn main() {
|
||||
println!("Starting server on localhost:8080");
|
||||
|
||||
|
|
|
|||
26
src/project.rs
Normal file
26
src/project.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
pub struct Project {
|
||||
pub id: i64,
|
||||
pub title: String,
|
||||
pub created_time: i64,
|
||||
pub last_modified_time: i64,
|
||||
pub percentage_completed: i32,
|
||||
pub archived: bool,
|
||||
}
|
||||
|
||||
impl Project {
|
||||
pub fn new(title: String) -> Self {
|
||||
let now = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_secs() as i64;
|
||||
|
||||
Self {
|
||||
id: 0,
|
||||
title,
|
||||
created_time: now,
|
||||
last_modified_time: now,
|
||||
percentage_completed: 0,
|
||||
archived: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue