From 1993245a9083ee2681179cc00ce60d39dfddccf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Veikko=20Lintuj=C3=A4rvi?= Date: Tue, 17 Jun 2025 18:19:13 +0300 Subject: [PATCH] Rust VS Code tooling auto fixes --- src/models.rs | 32 +++++++++++++++----------------- src/schema.rs | 12 ++++++------ 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/models.rs b/src/models.rs index fff75a2..db1db6f 100644 --- a/src/models.rs +++ b/src/models.rs @@ -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, pub pickup_date: Option, - 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, pub pickup_date: Option, - 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 + pub boxes: Vec, } #[derive(Debug, Serialize)] pub struct LootaBoxResponse { pub id: String, pub delivery_date: Option, - pub pickup_date: Option + pub pickup_date: Option, } #[derive(Debug, Deserialize)] pub struct LootaRequest { pub id: String, - pub pickup_date: String + pub pickup_date: Option, } diff --git a/src/schema.rs b/src/schema.rs index 57cfc80..2db11b0 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -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, - pickup_date -> Nullable, - created_time -> Timestamp, + delivery_date -> Nullable, + pickup_date -> Nullable, + 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, } }