feat: user manage api

This commit is contained in:
Noah Hsu
2022-06-26 19:36:27 +08:00
parent 6b9bca893b
commit cab498e376
5 changed files with 101 additions and 10 deletions

View File

@ -86,6 +86,9 @@ func DeleteUserById(id uint) error {
if err != nil {
return err
}
if old.IsAdmin() || old.IsGuest() {
return errors.WithStack(errs.DeleteAdminOrGuest)
}
userCache.Del(old.Username)
return errors.WithStack(db.Delete(&model.User{}, id).Error)
}