diff --git a/entity/Cargo.toml b/entity/Cargo.toml index b45247b..c35f802 100644 --- a/entity/Cargo.toml +++ b/entity/Cargo.toml @@ -12,6 +12,7 @@ path = "src/lib.rs" rocket = { version = "0.5.0-rc.2", features = [ "json", ] } +chrono = "0.4.22" [dependencies.sea-orm] version = "^0.10.0" diff --git a/entity/src/candidate.rs b/entity/src/candidate.rs new file mode 100644 index 0000000..9c14c6e --- /dev/null +++ b/entity/src/candidate.rs @@ -0,0 +1,37 @@ +//! SeaORM Entity. Generated by sea-orm-codegen 0.10.0 + +use chrono::{DateTime, NaiveDate, Local}; +use rocket::serde::{Deserialize, Serialize}; +use sea_orm::entity::prelude::*; + +#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] +#[serde(crate = "rocket::serde")] +#[sea_orm(table_name = "candidate")] +pub struct Model { + #[sea_orm(primary_key, auto_increment = false)] + pub application: i32, + pub code: String, + pub name: Option, + pub surname: Option, + pub birth_surname: Option, + pub birthplace: Option, + pub birthdate: Option, + pub address: Option, + pub telephone: Option, + pub citizenship: Option, + pub email: Option, + pub sex: Option, + pub study: Option, + pub personal_identification_number: Option, + #[sea_orm(column_type = "Text")] + pub personal_identification_number_hash: Option, + pub public_key: String, + pub private_key: String, + pub created_at: DateTime, + pub updated_at: DateTime, +} + +#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] +pub enum Relation {} + +impl ActiveModelBehavior for ActiveModel {} diff --git a/entity/src/lib.rs b/entity/src/lib.rs index 06480a1..fe0475a 100644 --- a/entity/src/lib.rs +++ b/entity/src/lib.rs @@ -1,4 +1,7 @@ #[macro_use] extern crate rocket; -pub mod post; +pub mod prelude; + +pub mod admin; +pub mod candidate; diff --git a/entity/src/mod.rs b/entity/src/mod.rs deleted file mode 100644 index a9862cf..0000000 --- a/entity/src/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3 - -pub mod prelude; - -pub mod admin; diff --git a/entity/src/post.rs b/entity/src/post.rs deleted file mode 100644 index ecf3f98..0000000 --- a/entity/src/post.rs +++ /dev/null @@ -1,18 +0,0 @@ -use rocket::serde::{Deserialize, Serialize}; -use sea_orm::entity::prelude::*; - -#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Deserialize, Serialize, FromForm)] -#[serde(crate = "rocket::serde")] -#[sea_orm(table_name = "posts")] -pub struct Model { - #[sea_orm(primary_key)] - pub id: i32, - pub title: String, - #[sea_orm(column_type = "Text")] - pub text: String, -} - -#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] -pub enum Relation {} - -impl ActiveModelBehavior for ActiveModel {} diff --git a/entity/src/prelude.rs b/entity/src/prelude.rs index 2f2b627..a755023 100644 --- a/entity/src/prelude.rs +++ b/entity/src/prelude.rs @@ -1,3 +1,2 @@ -//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3 - pub use super::admin::Entity as Admin; +pub use super::candidate::Entity as Candidate;