From b7fc25b3dafb2edbf954bdfbe5d313da5b1c3f0b Mon Sep 17 00:00:00 2001 From: Sphereso Date: Wed, 10 Jul 2024 20:14:53 +0200 Subject: [PATCH] backend: fix several entities --- crates/backend/src/routes.rs | 4 ++-- crates/entity/src/license.rs | 6 +++--- crates/migration/src/m20240709_095325_create_license.rs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/backend/src/routes.rs b/crates/backend/src/routes.rs index 86816b0..92bb913 100644 --- a/crates/backend/src/routes.rs +++ b/crates/backend/src/routes.rs @@ -11,11 +11,11 @@ pub fn config(cfg: &mut web::ServiceConfig) { ) .service(web::resource("/users/{user_id}")) .service( - web::resource("/license") + web::resource("/licenses") .get(LicenseController::list_groups) .post(LicenseController::create_license), ) - .route("/group", web::post().to(LicenseController::create_group)) + .route("/groups", web::post().to(LicenseController::create_group)) .service(web::scope("/auth").route("/login", web::post().to(AuthController::login))), ); } diff --git a/crates/entity/src/license.rs b/crates/entity/src/license.rs index d6a0161..da9a77c 100644 --- a/crates/entity/src/license.rs +++ b/crates/entity/src/license.rs @@ -10,9 +10,9 @@ pub struct Model { #[serde(skip_deserializing)] pub id: Uuid, pub name: String, - pub start: Option, - pub end: Option, - pub amount: Option, + pub start: Option, + pub end: Option, + pub amount: Option, pub key: String, pub group_id: Uuid, } diff --git a/crates/migration/src/m20240709_095325_create_license.rs b/crates/migration/src/m20240709_095325_create_license.rs index 7aac510..df5f153 100644 --- a/crates/migration/src/m20240709_095325_create_license.rs +++ b/crates/migration/src/m20240709_095325_create_license.rs @@ -19,9 +19,9 @@ impl MigrationTrait for Migration { .extra("DEFAULT gen_random_uuid()"), ) .col(ColumnDef::new(License::Name).string().not_null()) - .col(ColumnDef::new(License::Start).date_time()) - .col(ColumnDef::new(License::End).date_time()) - .col(ColumnDef::new(License::Amount).date_time()) + .col(ColumnDef::new(License::Start).timestamp_with_time_zone()) + .col(ColumnDef::new(License::End).timestamp_with_time_zone()) + .col(ColumnDef::new(License::Amount).integer()) .col(ColumnDef::new(License::Key).string().not_null()) .col(ColumnDef::new(License::GroupId).uuid().not_null()) .foreign_key(