qm_entity/
model.rs

1use async_graphql::{InputObject, SimpleObject};
2use chrono::{DateTime, Utc};
3use qm_mongodb::bson::Uuid;
4use serde::{Deserialize, Serialize};
5
6#[derive(Default, Debug, Clone, SimpleObject, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct Modification {
9    #[graphql(skip)]
10    pub user_id: Option<Uuid>,
11    pub at: DateTime<Utc>,
12}
13
14impl Modification {
15    pub fn new(user_id: Uuid) -> Self {
16        Self {
17            user_id: Some(user_id),
18            at: Utc::now(),
19        }
20    }
21}
22
23#[derive(
24    Default, Debug, Clone, InputObject, Serialize, Deserialize, Eq, PartialEq, Hash, PartialOrd, Ord,
25)]
26pub struct ListFilter {
27    pub page: Option<usize>,
28    pub limit: Option<usize>,
29}
30
31pub struct ListResult<T> {
32    pub items: Vec<T>,
33    pub limit: Option<i64>,
34    pub total: Option<i64>,
35    pub page: Option<i64>,
36}