add core models
This commit is contained in:
parent
8c51b68523
commit
b01b33f7d1
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2452,6 +2452,7 @@ checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom",
|
"getrandom",
|
||||||
"rand",
|
"rand",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -9,4 +9,4 @@ edition = "2021"
|
|||||||
anyhow = "1.0.60"
|
anyhow = "1.0.60"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0.68"
|
serde_json = "1.0.68"
|
||||||
uuid = { version = "1.1.2", features = ["v4", "fast-rng"] }
|
uuid = { version = "1.1.2", features = ["v4", "fast-rng", "serde"] }
|
||||||
|
21
como_domain/src/item/mod.rs
Normal file
21
como_domain/src/item/mod.rs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
pub mod requests;
|
||||||
|
pub mod responses;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
|
pub enum ItemState {
|
||||||
|
Created,
|
||||||
|
Done,
|
||||||
|
Archived,
|
||||||
|
Deleted,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub struct ItemDto {
|
||||||
|
pub id: Uuid,
|
||||||
|
pub title: String,
|
||||||
|
pub description: Option<String>,
|
||||||
|
pub state: ItemState,
|
||||||
|
}
|
6
como_domain/src/item/requests.rs
Normal file
6
como_domain/src/item/requests.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub struct CreateItemDto {
|
||||||
|
pub name: String,
|
||||||
|
}
|
3
como_domain/src/item/responses.rs
Normal file
3
como_domain/src/item/responses.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
use super::ItemDto;
|
||||||
|
|
||||||
|
pub type CreatedItemDto = ItemDto;
|
@ -1 +1,3 @@
|
|||||||
|
pub mod item;
|
||||||
|
pub mod projects;
|
||||||
pub mod users;
|
pub mod users;
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
pub mod requests;
|
||||||
|
pub mod responses;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub struct ProjectDto {
|
||||||
|
pub id: Uuid,
|
||||||
|
pub name: String,
|
||||||
|
}
|
6
como_domain/src/projects/requests.rs
Normal file
6
como_domain/src/projects/requests.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
|
pub struct CreateProjectDto {
|
||||||
|
pub name: String,
|
||||||
|
}
|
3
como_domain/src/projects/responses.rs
Normal file
3
como_domain/src/projects/responses.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
use super::ProjectDto;
|
||||||
|
|
||||||
|
pub type CreatedProjectDto = ProjectDto;
|
@ -1,11 +1,11 @@
|
|||||||
pub mod requests;
|
pub mod requests;
|
||||||
|
pub mod responses;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct UserDto {
|
pub struct UserDto {
|
||||||
#[serde(skip_serializing, skip_deserializing)]
|
|
||||||
pub id: Uuid,
|
pub id: Uuid,
|
||||||
pub username: String,
|
pub username: String,
|
||||||
pub email: String,
|
pub email: String,
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
use super::UserDto;
|
||||||
|
|
||||||
|
pub type UserCreatedDto = UserDto;
|
Loading…
Reference in New Issue
Block a user