diff --git a/system/rest/application.go b/system/rest/application.go index f303deeb2..95db4867c 100644 --- a/system/rest/application.go +++ b/system/rest/application.go @@ -3,6 +3,8 @@ package rest import ( "context" + "github.com/titpetric/factory/resputil" + "github.com/cortezaproject/corteza-server/system/internal/service" "github.com/cortezaproject/corteza-server/system/rest/request" "github.com/cortezaproject/corteza-server/system/types" @@ -67,5 +69,5 @@ func (ctrl *Application) Read(ctx context.Context, r *request.ApplicationRead) ( } func (ctrl *Application) Delete(ctx context.Context, r *request.ApplicationDelete) (interface{}, error) { - return nil, ctrl.svc.application.With(ctx).DeleteByID(r.ApplicationID) + return resputil.OK(), ctrl.svc.application.With(ctx).DeleteByID(r.ApplicationID) } diff --git a/system/rest/organisation.go b/system/rest/organisation.go index c0a26a55e..3c8718c54 100644 --- a/system/rest/organisation.go +++ b/system/rest/organisation.go @@ -4,6 +4,7 @@ import ( "context" "github.com/pkg/errors" + "github.com/titpetric/factory/resputil" "github.com/cortezaproject/corteza-server/system/internal/service" "github.com/cortezaproject/corteza-server/system/rest/request" @@ -52,9 +53,9 @@ func (ctrl *Organisation) Update(ctx context.Context, r *request.OrganisationUpd } func (ctrl *Organisation) Delete(ctx context.Context, r *request.OrganisationDelete) (interface{}, error) { - return nil, ctrl.svc.org.With(ctx).Delete(r.ID) + return resputil.OK(), ctrl.svc.org.With(ctx).Delete(r.ID) } func (ctrl *Organisation) Archive(ctx context.Context, r *request.OrganisationArchive) (interface{}, error) { - return nil, ctrl.svc.org.With(ctx).Archive(r.ID) + return resputil.OK(), ctrl.svc.org.With(ctx).Archive(r.ID) } diff --git a/system/rest/role.go b/system/rest/role.go index 04db2c4fc..2c6d64474 100644 --- a/system/rest/role.go +++ b/system/rest/role.go @@ -4,6 +4,7 @@ import ( "context" "github.com/pkg/errors" + "github.com/titpetric/factory/resputil" "github.com/cortezaproject/corteza-server/internal/payload" "github.com/cortezaproject/corteza-server/system/internal/service" @@ -88,19 +89,19 @@ func (ctrl *Role) Update(ctx context.Context, r *request.RoleUpdate) (interface{ } func (ctrl *Role) Delete(ctx context.Context, r *request.RoleDelete) (interface{}, error) { - return nil, ctrl.svc.role.With(ctx).Delete(r.RoleID) + return resputil.OK(), ctrl.svc.role.With(ctx).Delete(r.RoleID) } func (ctrl *Role) Archive(ctx context.Context, r *request.RoleArchive) (interface{}, error) { - return nil, ctrl.svc.role.With(ctx).Archive(r.RoleID) + return resputil.OK(), ctrl.svc.role.With(ctx).Archive(r.RoleID) } func (ctrl *Role) Merge(ctx context.Context, r *request.RoleMerge) (interface{}, error) { - return nil, ctrl.svc.role.With(ctx).Merge(r.RoleID, r.Destination) + return resputil.OK(), ctrl.svc.role.With(ctx).Merge(r.RoleID, r.Destination) } func (ctrl *Role) Move(ctx context.Context, r *request.RoleMove) (interface{}, error) { - return nil, ctrl.svc.role.With(ctx).Move(r.RoleID, r.OrganisationID) + return resputil.OK(), ctrl.svc.role.With(ctx).Move(r.RoleID, r.OrganisationID) } func (ctrl *Role) MemberList(ctx context.Context, r *request.RoleMemberList) (interface{}, error) { @@ -116,9 +117,9 @@ func (ctrl *Role) MemberList(ctx context.Context, r *request.RoleMemberList) (in } func (ctrl *Role) MemberAdd(ctx context.Context, r *request.RoleMemberAdd) (interface{}, error) { - return nil, ctrl.svc.role.With(ctx).MemberAdd(r.RoleID, r.UserID) + return resputil.OK(), ctrl.svc.role.With(ctx).MemberAdd(r.RoleID, r.UserID) } func (ctrl *Role) MemberRemove(ctx context.Context, r *request.RoleMemberRemove) (interface{}, error) { - return nil, ctrl.svc.role.With(ctx).MemberRemove(r.RoleID, r.UserID) + return resputil.OK(), ctrl.svc.role.With(ctx).MemberRemove(r.RoleID, r.UserID) } diff --git a/system/rest/settings.go b/system/rest/settings.go index ca8037bf6..d32996aee 100644 --- a/system/rest/settings.go +++ b/system/rest/settings.go @@ -4,6 +4,7 @@ import ( "context" "github.com/pkg/errors" + "github.com/titpetric/factory/resputil" "github.com/cortezaproject/corteza-server/internal/settings" "github.com/cortezaproject/corteza-server/system/internal/service" @@ -56,5 +57,5 @@ func (ctrl *Settings) Get(ctx context.Context, r *request.SettingsGet) (interfac } func (ctrl *Settings) Set(ctx context.Context, r *request.SettingsSet) (interface{}, error) { - return nil, errors.New("Not implemented: Settings.set") + return resputil.OK(), errors.New("Not implemented: Settings.set") } diff --git a/system/rest/user.go b/system/rest/user.go index c0f516b1e..c7227d601 100644 --- a/system/rest/user.go +++ b/system/rest/user.go @@ -4,6 +4,7 @@ import ( "context" "github.com/pkg/errors" + "github.com/titpetric/factory/resputil" "github.com/cortezaproject/corteza-server/system/internal/service" "github.com/cortezaproject/corteza-server/system/rest/request" @@ -61,13 +62,13 @@ func (ctrl *User) Read(ctx context.Context, r *request.UserRead) (interface{}, e } func (ctrl *User) Delete(ctx context.Context, r *request.UserDelete) (interface{}, error) { - return nil, ctrl.user.With(ctx).Delete(r.UserID) + return resputil.OK(), ctrl.user.With(ctx).Delete(r.UserID) } func (ctrl *User) Suspend(ctx context.Context, r *request.UserSuspend) (interface{}, error) { - return nil, ctrl.user.With(ctx).Suspend(r.UserID) + return resputil.OK(), ctrl.user.With(ctx).Suspend(r.UserID) } func (ctrl *User) Unsuspend(ctx context.Context, r *request.UserUnsuspend) (interface{}, error) { - return nil, ctrl.user.With(ctx).Unsuspend(r.UserID) + return resputil.OK(), ctrl.user.With(ctx).Unsuspend(r.UserID) }