feat: PIdN not null

This commit is contained in:
Sebastian Pravda 2022-10-30 13:06:45 +01:00
parent 79ab4d0ed4
commit d0825b80d5
No known key found for this signature in database
GPG key ID: F3BC84F08EFA3F57
5 changed files with 13 additions and 5 deletions

View file

@ -26,7 +26,7 @@ impl Mutation {
candidate::ActiveModel {
application: Set(application_id),
personal_identification_number: Set(Some(encrypted_personal_id_number)),
personal_identification_number: Set(encrypted_personal_id_number),
code: Set(hashed_password),
public_key: Set(pubkey),
private_key: Set(encrypted_priv_key),
@ -98,7 +98,7 @@ mod tests {
let db = get_memory_sqlite_connection().await;
let form = serde_json::from_value(json!({
"application": 5555555,
"application_id": 5555555,
})).unwrap();
let plain_text_password = "test".to_string();

View file

@ -19,7 +19,7 @@ pub struct Model {
pub email: Option<String>,
pub sex: Option<String>,
pub study: Option<String>,
pub personal_identification_number: Option<String>,
pub personal_identification_number: String,
#[sea_orm(column_type = "Text", nullable)]
pub personal_identification_number_hash: Option<String>,
pub public_key: String,

View file

@ -9,10 +9,12 @@ name = "migration"
path = "src/lib.rs"
[dependencies]
tokio = { version = "^1.21", features = ["macros"] }
serde = { version = "^1.0", features = ["derive"] }
chrono = "^0.4"
portfolio-entity = { path = "../entity" }
[dependencies.sea-orm-migration]
version = "^0.10"
features = [ "runtime-tokio-native-tls", "sqlx-postgres", "sqlx-sqlite"]
features = [ "runtime-tokio-native-tls", "sqlx-postgres", "sqlx-sqlite"]

View file

@ -30,7 +30,7 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(Candidate::Email).string())
.col(ColumnDef::new(Candidate::Sex).string())
.col(ColumnDef::new(Candidate::Study).string())
.col(ColumnDef::new(Candidate::PersonalIdentificationNumber).string())
.col(ColumnDef::new(Candidate::PersonalIdentificationNumber).string().not_null())
.col(ColumnDef::new(Candidate::PersonalIdentificationNumberHash).text())
.col(ColumnDef::new(Candidate::PublicKey).string().not_null())
.col(ColumnDef::new(Candidate::PrivateKey).string().not_null())

6
migration/src/main.rs Normal file
View file

@ -0,0 +1,6 @@
use sea_orm_migration::prelude::*;
#[tokio::main]
async fn main() {
cli::run_cli(migration::Migrator).await;
}