feature/authentication service #9

Merged
GW_MC merged 19 commits from feature/authentication into master 2025-12-19 12:24:49 +08:00
3 changed files with 7 additions and 5 deletions
Showing only changes of commit 8f2193bed2 - Show all commits

View File

@@ -108,6 +108,7 @@ impl PasswordStrategy {
.to_string();
let new_identity = user_identity::ActiveModel {
id: sea_orm::ActiveValue::Set(Uuid::new_v4()),
user_id: sea_orm::ActiveValue::Set(user_id),
provider: sea_orm::ActiveValue::Set(PASSWORD_PROVIDER.to_string()),
password_hash: sea_orm::ActiveValue::Set(Some(password_hash)),

View File

@@ -163,7 +163,7 @@ impl UserService for UserServiceImpl {
tx: Option<&mut DatabaseTransaction>,
) -> Result<User, ServiceError> {
let user_active_model = UserActiveModel {
id: ActiveValue::NotSet,
id: ActiveValue::Set(Uuid::new_v4()),
name: ActiveValue::Set(user.username),
is_admin: ActiveValue::Set(user.is_admin),
is_active: ActiveValue::Set(true),

View File

@@ -77,10 +77,11 @@ impl SettingsStore for SettingsService {
Ok(None) => {
handle_not_found(key.to_string(), value).await?;
}
Ok(Some(mut record)) => {
record.value = value;
record
.into_active_model()
Ok(Some(record)) => {
let mut record_active_model = record.into_active_model();
record_active_model.value = ActiveValue::Set(value);
record_active_model.updated_at = ActiveValue::Set(chrono::Utc::now());
record_active_model
.update(&*self.connection)
.await
.map_err(ServiceError::from)?;