feat: admin role
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use chrono::NaiveDateTime;
|
||||
use domain::models::ExportFormat;
|
||||
use domain::models::{ExportFormat, UserRole};
|
||||
use uuid::Uuid;
|
||||
|
||||
pub struct LogReviewCommand {
|
||||
@@ -30,6 +30,7 @@ pub struct RegisterCommand {
|
||||
pub email: String,
|
||||
pub username: String,
|
||||
pub password: String,
|
||||
pub role: UserRole,
|
||||
}
|
||||
|
||||
pub struct DeleteReviewCommand {
|
||||
|
||||
@@ -41,6 +41,6 @@ pub async fn execute(ctx: &AppContext, cmd: RegisterCommand) -> Result<(), Domai
|
||||
|
||||
let hash = ctx.password_hasher.hash(&cmd.password).await?;
|
||||
ctx.user_repository
|
||||
.save(&User::new(email, username, hash))
|
||||
.save(&User::new(email, username, hash, cmd.role))
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user