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

View File

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