From 6614f5a6adf3780553d6ebba55361ad913a6c438 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Sat, 28 Dec 2024 10:40:20 +0100 Subject: Database connection --- server/src/api_model.rs | 64 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 20 deletions(-) (limited to 'server/src/api_model.rs') diff --git a/server/src/api_model.rs b/server/src/api_model.rs index 4b6eced..c5b1ce3 100644 --- a/server/src/api_model.rs +++ b/server/src/api_model.rs @@ -2,45 +2,69 @@ use serde::{Serialize}; #[derive(Serialize, Copy, Clone)] pub enum ReviewState { - DRAFT, - OPEN, - DROPPED, - CLOSED, + Draft, + Open, + Dropped, + Closed, } #[derive(Serialize)] -pub struct User<'r> { - pub username: &'r str, - pub name: &'r str, +pub struct User { + pub id: u64, + pub username: String, + pub name: String, pub active: bool, } #[derive(Serialize)] -pub struct Review<'r> { +pub struct Review { pub id: u64, - pub title: &'r str, - pub description: &'r str, - pub owner: &'r User<'r>, - pub reviewers: Vec<&'r User<'r>>, - pub watchers: Vec<&'r User<'r>>, + pub title: String, + pub description: String, + pub owner: User, + pub reviewers: Vec, + pub watchers: Vec, pub state: ReviewState, - pub progress: f64, + pub progress: f32, } #[derive(Serialize)] -pub struct ReviewEntry<'r> { +pub struct ReviewEntry { pub id: u64, - pub title: &'r str, - pub owner: &'r User<'r>, + pub title: String, + pub owner: User, pub state: ReviewState, - pub progress: f64, + pub progress: f32, +} + +#[derive(Serialize)] +pub struct Reviews { + pub offset: u32, + pub limit: u32, + pub total_count: u32, + pub more: bool, + pub reviews: Vec, +} + +#[derive(Serialize)] +pub struct Project { + pub id: u64, + pub title: String, + pub description: String, + pub members: Vec, +} + +#[derive(Serialize)] +pub struct ProjectEntry { + pub id: u64, + pub title: String, } #[derive(Serialize)] -pub struct Reviews<'r> { +pub struct Projects { pub offset: u32, pub limit: u32, pub total_count: u32, pub more: bool, - pub reviews: Vec>, + pub projects: Vec, } -- cgit v1.2.3-70-g09d2