mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-05 02:50:47 +00:00
fix: unable to insert kvůli primary key
- using insert instead of save
This commit is contained in:
parent
d44082d3d8
commit
00e050986e
1 changed files with 3 additions and 3 deletions
|
|
@ -9,10 +9,10 @@ impl Mutation {
|
||||||
db: &DbConn,
|
db: &DbConn,
|
||||||
form_data: candidate::Model,
|
form_data: candidate::Model,
|
||||||
plain_text_password: &String,
|
plain_text_password: &String,
|
||||||
) -> Result<candidate::ActiveModel, DbErr> {
|
) -> Result<candidate::Model, DbErr> {
|
||||||
let hashed_password = hash_password(plain_text_password);
|
let hashed_password = hash_password(plain_text_password);
|
||||||
candidate::ActiveModel {
|
candidate::ActiveModel {
|
||||||
application: Set(145 as i32), // TODO NEFUNGUJE
|
application: Set(form_data.application), // TODO NEFUNGUJE
|
||||||
code: Set(hashed_password),
|
code: Set(hashed_password),
|
||||||
public_key: Set("lorem ipsum pub key".to_string()),
|
public_key: Set("lorem ipsum pub key".to_string()),
|
||||||
private_key: Set("lorem ipsum priv key".to_string()),
|
private_key: Set("lorem ipsum priv key".to_string()),
|
||||||
|
|
@ -20,7 +20,7 @@ impl Mutation {
|
||||||
updated_at: Set(chrono::offset::Local::now().naive_local()),
|
updated_at: Set(chrono::offset::Local::now().naive_local()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
.save(db)
|
.insert(db)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue