Skip to content

Commit

Permalink
feat: user delete add unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Jan 7, 2024
1 parent 5714a97 commit ba8edcc
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/app/service/user/user.service.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (s *Service) Update(id string, in *dto.UpdateUserRequest) (*dto.UpdateUserR
switch st.Code() {
case codes.AlreadyExists:
return nil, &dto.ResponseErr{
StatusCode: http.StatusNotFound,
StatusCode: http.StatusConflict,
Message: constant.DuplicateEmailMessage,
Data: nil,
}
Expand Down Expand Up @@ -131,11 +131,19 @@ func (s *Service) Delete(id string) (*dto.DeleteUserResponse, *dto.ResponseErr)
Str("service", "user").
Str("module", "delete").
Msg(st.Message())

return nil, &dto.ResponseErr{
StatusCode: http.StatusInternalServerError,
Message: constant.InternalErrorMessage,
Data: nil,
switch st.Code() {
case codes.Unavailable:
return nil, &dto.ResponseErr{
StatusCode: http.StatusServiceUnavailable,
Message: constant.UnavailableServiceMessage,
Data: nil,
}
default:
return nil, &dto.ResponseErr{
StatusCode: http.StatusInternalServerError,
Message: constant.InternalErrorMessage,
Data: nil,
}
}
}

Expand Down

0 comments on commit ba8edcc

Please sign in to comment.