mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-21 13:55:43 +00:00
feat(BE): sso delete and fix response too many request
This commit is contained in:
@@ -171,6 +171,9 @@ func (h *Controller) Refresh(c *fiber.Ctx) error {
|
||||
|
||||
if resp.StatusCode >= 400 {
|
||||
utils.Log.Warnf("token refresh response status %d", resp.StatusCode)
|
||||
if resp.StatusCode == fiber.StatusTooManyRequests {
|
||||
return fiber.NewError(fiber.StatusTooManyRequests, "Too many attempts, please slow down")
|
||||
}
|
||||
return fiber.NewError(fiber.StatusUnauthorized, "unauthenticated")
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ func (r *UserRepositoryImpl) GetByIdUser(
|
||||
modifier func(*gorm.DB) *gorm.DB,
|
||||
) (*entity.User, error) {
|
||||
return r.BaseRepositoryImpl.First(ctx, func(db *gorm.DB) *gorm.DB {
|
||||
return db.Where("id_user = ?", idUser)
|
||||
return db.Where("id_user::bigint = ?::bigint", idUser)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func (r *UserRepositoryImpl) UpsertByIdUser(ctx context.Context, user *entity.Us
|
||||
}
|
||||
|
||||
func (r *UserRepositoryImpl) SoftDeleteByIdUser(ctx context.Context, idUser int64) error {
|
||||
query := r.DB().WithContext(ctx).Where("id_user = ?", idUser)
|
||||
query := r.DB().WithContext(ctx).Where("id_user::bigint = ?::bigint", idUser)
|
||||
result := query.Delete(&entity.User{})
|
||||
if result.Error != nil {
|
||||
return result.Error
|
||||
|
||||
Reference in New Issue
Block a user