mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-15 04:21:22 +00:00
db: candidate entity
This commit is contained in:
parent
a5982a3231
commit
884bc3dea7
6 changed files with 43 additions and 26 deletions
|
|
@ -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
entity/src/candidate.rs
Normal file
37
entity/src/candidate.rs
Normal file
|
|
@ -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 {}
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
#[macro_use]
|
||||
extern crate rocket;
|
||||
|
||||
pub mod post;
|
||||
pub mod prelude;
|
||||
|
||||
pub mod admin;
|
||||
pub mod candidate;
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3
|
||||
|
||||
pub mod prelude;
|
||||
|
||||
pub mod admin;
|
||||
|
|
@ -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 {}
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue