backend: fix several entities

This commit is contained in:
Sphereso 2024-07-10 20:14:53 +02:00
parent 98a3029444
commit b7fc25b3da
3 changed files with 8 additions and 8 deletions

View file

@ -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))),
);
}

View file

@ -10,9 +10,9 @@ pub struct Model {
#[serde(skip_deserializing)]
pub id: Uuid,
pub name: String,
pub start: Option<DateTime>,
pub end: Option<DateTime>,
pub amount: Option<DateTime>,
pub start: Option<DateTimeWithTimeZone>,
pub end: Option<DateTimeWithTimeZone>,
pub amount: Option<i32>,
pub key: String,
pub group_id: Uuid,
}

View file

@ -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(