Skip to content

Commit

Permalink
db: candidate entity
Browse files Browse the repository at this point in the history
  • Loading branch information
EETagent committed Oct 24, 2022
1 parent a5982a3 commit 884bc3d
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 26 deletions.
1 change: 1 addition & 0 deletions entity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
37 changes: 37 additions & 0 deletions entity/src/candidate.rs
Original file line number Diff line number Diff line change
@@ -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<String>,
pub surname: Option<String>,
pub birth_surname: Option<String>,
pub birthplace: Option<String>,
pub birthdate: Option<NaiveDate>,
pub address: Option<String>,
pub telephone: Option<String>,
pub citizenship: Option<String>,
pub email: Option<String>,
pub sex: Option<String>,
pub study: Option<String>,
pub personal_identification_number: Option<String>,
#[sea_orm(column_type = "Text")]
pub personal_identification_number_hash: Option<String>,
pub public_key: String,
pub private_key: String,
pub created_at: DateTime<Local>,
pub updated_at: DateTime<Local>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}
5 changes: 4 additions & 1 deletion entity/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#[macro_use]
extern crate rocket;

pub mod post;
pub mod prelude;

pub mod admin;
pub mod candidate;
5 changes: 0 additions & 5 deletions entity/src/mod.rs

This file was deleted.

18 changes: 0 additions & 18 deletions entity/src/post.rs

This file was deleted.

3 changes: 1 addition & 2 deletions entity/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 884bc3d

Please sign in to comment.