From 1165248bace8f6f4d7a841128a6c79c2147df8fd Mon Sep 17 00:00:00 2001 From: Taekyu Date: Mon, 3 Apr 2023 14:34:46 +0900 Subject: [PATCH] rollback. to 404 error --- internal/repository/cloud-setting.go | 2 +- internal/repository/user.go | 4 ++-- internal/usecase/organization.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/repository/cloud-setting.go b/internal/repository/cloud-setting.go index e5a5f4d3..cae4dd34 100644 --- a/internal/repository/cloud-setting.go +++ b/internal/repository/cloud-setting.go @@ -67,7 +67,7 @@ func (r *CloudSettingRepository) Fetch(organizationId string) (out []domain.Clou return nil, res.Error } if res.RowsAffected == 0 { - return nil, httpErrors.NewNoContentError(fmt.Errorf("No data found")) + return nil, httpErrors.NewNotFoundError(fmt.Errorf("No data found")) } for _, cloudSetting := range cloudSettings { diff --git a/internal/repository/user.go b/internal/repository/user.go index 5e32b53d..eb036a03 100644 --- a/internal/repository/user.go +++ b/internal/repository/user.go @@ -142,7 +142,7 @@ func (r *UserRepository) List(filters ...FilterFunc) (*[]domain.User, error) { return nil, res.Error } if res.RowsAffected == 0 { - return nil, httpErrors.NewNoContentError(httpErrors.NoContent) + return nil, httpErrors.NewNotFoundError(httpErrors.NotFound) } var out []domain.User @@ -316,7 +316,7 @@ func (r *UserRepository) FetchRoles() (*[]domain.Role, error) { } if res.RowsAffected == 0 { - return nil, httpErrors.NewNoContentError(httpErrors.NoContent) + return nil, httpErrors.NewNotFoundError(httpErrors.NotFound) } var out []domain.Role diff --git a/internal/usecase/organization.go b/internal/usecase/organization.go index 650ff519..29fc8fa8 100644 --- a/internal/usecase/organization.go +++ b/internal/usecase/organization.go @@ -122,7 +122,7 @@ func (u *OrganizationUsecase) Delete(organizationId string, accessToken string) func (u *OrganizationUsecase) Update(organizationId string, in domain.UpdateOrganizationRequest) (err error) { _, err = u.Get(organizationId) if err != nil { - return httpErrors.NewNoContentError(err) + return httpErrors.NewNotFoundError(err) } _, err = u.repo.Update(organizationId, in) @@ -139,7 +139,7 @@ func (u *OrganizationUsecase) UpdatePrimaryClusterId(organizationId string, clus organization, err := u.Get(organizationId) if err != nil { - return httpErrors.NewNoContentError(err) + return httpErrors.NewNotFoundError(err) } // [TODO] need refactoring about reflect