Create Project struct

This commit is contained in:
Nettika 2026-01-25 14:31:30 -08:00
parent e8eab81957
commit 57f21e2634
Signed by: nettika
SSH key fingerprint: SHA256:f+PJrfIq49zrQ6dQrHj18b+PJKmAldeAMiGdj8IzXCA
3 changed files with 29 additions and 1 deletions

View file

@ -1,3 +1,5 @@
mod project;
fn main() {
println!("Starting server on localhost:8080");

26
src/project.rs Normal file
View 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,
}
}
}