Rust VS Code tooling auto fixes

This commit is contained in:
2025-06-17 18:19:13 +03:00
parent 99ffc21cf0
commit 1993245a90
2 changed files with 21 additions and 23 deletions

View File

@@ -1,15 +1,15 @@
use uuid::Uuid;
use crate::schema::{loota_admin, loota_box, loota_customer, loota_order};
use chrono::NaiveDateTime;
use diesel::prelude::*;
use chrono::{NaiveDateTime};
use serde::{Serialize, Deserialize};
use crate::schema::{loota_customer, loota_admin, loota_order, loota_box};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Queryable, Identifiable, Selectable, Debug, PartialEq)]
#[diesel(table_name = loota_customer)]
pub struct Customer {
pub id: Uuid,
pub identifier: String,
pub created_time: NaiveDateTime
pub created_time: NaiveDateTime,
}
#[derive(Queryable, Identifiable, Selectable, Debug, PartialEq)]
@@ -17,10 +17,9 @@ pub struct Customer {
pub struct Admin {
pub id: Uuid,
pub identifier: String,
pub created_time: NaiveDateTime
pub created_time: NaiveDateTime,
}
#[derive(Queryable, Selectable, Identifiable, Associations, Debug, PartialEq)]
#[diesel(belongs_to(Customer, foreign_key = customer_id))]
#[diesel(table_name = loota_order)]
@@ -28,7 +27,7 @@ pub struct Order {
pub id: Uuid,
pub location: String,
pub customer_id: Uuid,
pub created_time: NaiveDateTime
pub created_time: NaiveDateTime,
}
#[derive(Queryable, Selectable, Identifiable, Associations, Debug, PartialEq)]
@@ -39,7 +38,7 @@ pub struct Box {
pub id: Uuid,
pub delivery_date: Option<NaiveDateTime>,
pub pickup_date: Option<NaiveDateTime>,
pub order_id: Uuid
pub order_id: Uuid,
}
#[derive(Debug, Serialize)]
@@ -47,7 +46,7 @@ pub struct LootaBoxAdminResponse {
pub id: String,
pub delivery_date: Option<NaiveDateTime>,
pub pickup_date: Option<NaiveDateTime>,
pub order: LootaBoxOrderAdminResponse
pub order: LootaBoxOrderAdminResponse,
}
#[derive(Debug, Serialize)]
@@ -55,41 +54,40 @@ pub struct LootaBoxOrderAdminResponse {
pub id: String,
pub customer_id: String,
pub location: String,
pub created_time: NaiveDateTime
pub created_time: NaiveDateTime,
}
#[derive(Debug, Serialize)]
pub struct LootaOrderAdminResponse {
pub id: String,
pub location: String,
pub created_time: NaiveDateTime,
pub user: LootaUserAdminResponse
pub user: LootaUserAdminResponse,
}
#[derive(Debug, Serialize)]
pub struct LootaUserAdminResponse {
pub id: String,
pub identifier: String,
pub created_time: NaiveDateTime
pub created_time: NaiveDateTime,
}
#[derive(Debug, Serialize)]
pub struct LootaResponse {
pub identifier: String,
pub location: String,
pub boxes: Vec<LootaBoxResponse>
pub boxes: Vec<LootaBoxResponse>,
}
#[derive(Debug, Serialize)]
pub struct LootaBoxResponse {
pub id: String,
pub delivery_date: Option<NaiveDateTime>,
pub pickup_date: Option<NaiveDateTime>
pub pickup_date: Option<NaiveDateTime>,
}
#[derive(Debug, Deserialize)]
pub struct LootaRequest {
pub id: String,
pub pickup_date: String
pub pickup_date: Option<String>,
}

View File

@@ -4,7 +4,7 @@ diesel::table! {
loota_admin (id) {
id -> Uuid,
identifier -> Varchar,
created_time -> Timestamp,
created_time -> Timestamptz,
}
}
@@ -12,9 +12,9 @@ diesel::table! {
loota_box (id) {
id -> Uuid,
order_id -> Uuid,
delivery_date -> Nullable<Timestamp>,
pickup_date -> Nullable<Timestamp>,
created_time -> Timestamp,
delivery_date -> Nullable<Timestamptz>,
pickup_date -> Nullable<Timestamptz>,
created_time -> Timestamptz,
}
}
@@ -22,7 +22,7 @@ diesel::table! {
loota_customer (id) {
id -> Uuid,
identifier -> Varchar,
created_time -> Timestamp,
created_time -> Timestamptz,
}
}
@@ -31,7 +31,7 @@ diesel::table! {
id -> Uuid,
customer_id -> Uuid,
location -> Varchar,
created_time -> Timestamp,
created_time -> Timestamptz,
}
}