Chore: Remove DeleteOrg and UpdateOrgAddress from sqlstore (#55795)

* Chore: Remove DeleteOrg and UpdateOrgAddress from sqlstore

* Remove commented out methods
This commit is contained in:
idafurjes 2022-09-27 12:30:10 +02:00 committed by GitHub
parent d1375d31cd
commit d8cd30d22a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -247,9 +247,9 @@ func (hs *HTTPServer) UpdateOrgAddress(c *models.ReqContext) response.Response {
}
func (hs *HTTPServer) updateOrgAddressHelper(ctx context.Context, form dtos.UpdateOrgAddressForm, orgID int64) response.Response {
cmd := models.UpdateOrgAddressCommand{
OrgId: orgID,
Address: models.Address{
cmd := org.UpdateOrgAddressCommand{
OrgID: orgID,
Address: org.Address{
Address1: form.Address1,
Address2: form.Address2,
City: form.City,
@ -259,7 +259,7 @@ func (hs *HTTPServer) updateOrgAddressHelper(ctx context.Context, form dtos.Upda
},
}
if err := hs.SQLStore.UpdateOrgAddress(ctx, &cmd); err != nil {
if err := hs.orgService.UpdateAddress(ctx, &cmd); err != nil {
return response.Error(http.StatusInternalServerError, "Failed to update org address", err)
}
@ -290,7 +290,7 @@ func (hs *HTTPServer) DeleteOrgByID(c *models.ReqContext) response.Response {
return response.Error(http.StatusBadRequest, "Can not delete org for current user", nil)
}
if err := hs.SQLStore.DeleteOrg(c.Req.Context(), &models.DeleteOrgCommand{Id: orgID}); err != nil {
if err := hs.orgService.Delete(c.Req.Context(), &org.DeleteOrgCommand{ID: orgID}); err != nil {
if errors.Is(err, models.ErrOrgNotFound) {
return response.Error(http.StatusNotFound, "Failed to delete organization. ID not found", nil)
}

View File

@ -19,8 +19,6 @@ type Store interface {
GetOrgByName(name string) (*models.Org, error)
CreateOrg(ctx context.Context, cmd *models.CreateOrgCommand) error
CreateOrgWithMember(name string, userID int64) (models.Org, error)
UpdateOrgAddress(ctx context.Context, cmd *models.UpdateOrgAddressCommand) error
DeleteOrg(ctx context.Context, cmd *models.DeleteOrgCommand) error
GetOrgById(context.Context, *models.GetOrgByIdQuery) error
GetOrgByNameHandler(ctx context.Context, query *models.GetOrgByNameQuery) error
CreateUser(ctx context.Context, cmd user.CreateUserCommand) (*user.User, error)