Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: remove API for deleting activity (#1792)
Yilong Libb389c7010e0
diff --git a/api/activity.go b/api/activity.goindex 306023cf69..14228b2a2f 100644--- a/api/activity.go+++ b/api/activity.go@@ -276,12 +276,3 @@ type ActivityPatch struct {// Domain specific fieldsComment *string `jsonapi:"attr,comment"`}--// ActivityDelete is the API message for deleting an activity.-type ActivityDelete struct {- ID int-- // Standard fields- // Value is assigned from the jwt subject field passed by the client.- DeleterID int-}diff --git a/server/acl_casbin_policy_dba.csv b/server/acl_casbin_policy_dba.csvindex 8163c24fe1..9acc70e238 100644--- a/server/acl_casbin_policy_dba.csv+++ b/server/acl_casbin_policy_dba.csv@@ -64,7 +64,6 @@ p, DBA, /issue/{id}/subscriber/{subscriberID}, DELETEp, DBA, /activity, POSTp, DBA, /activity, GETp, DBA, /activity/{id}, PATCH_SELF-p, DBA, /activity/{id}, DELETE_SELFp, DBA, /inbox/user/{userID}, GET_SELFp, DBA, /inbox/user/{userID}/summary, GET_SELFp, DBA, /inbox/{id}, PATCH_SELFdiff --git a/server/acl_casbin_policy_developer.csv b/server/acl_casbin_policy_developer.csvindex ce4e215431..34c9f928de 100644--- a/server/acl_casbin_policy_developer.csv+++ b/server/acl_casbin_policy_developer.csv@@ -58,7 +58,6 @@ p, DEVELOPER, /issue/{id}/subscriber/{subscriberID}, DELETEp, DEVELOPER, /activity, POSTp, DEVELOPER, /activity, GETp, DEVELOPER, /activity/{id}, PATCH_SELF-p, DEVELOPER, /activity/{id}, DELETE_SELFp, DEVELOPER, /inbox/user/{userID}, GET_SELFp, DEVELOPER, /inbox/user/{userID}/summary, GET_SELFp, DEVELOPER, /inbox/{id}, PATCH_SELFdiff --git a/server/acl_casbin_policy_owner.csv b/server/acl_casbin_policy_owner.csvindex a8c456a287..bdedf0a666 100644--- a/server/acl_casbin_policy_owner.csv+++ b/server/acl_casbin_policy_owner.csv@@ -68,7 +68,6 @@ p, OWNER, /issue/{id}/subscriber/{subscriberID}, DELETEp, OWNER, /activity, POSTp, OWNER, /activity, GETp, OWNER, /activity/{id}, PATCH_SELF-p, OWNER, /activity/{id}, DELETE_SELFp, OWNER, /inbox/user/{userID}, GET_SELFp, OWNER, /inbox/user/{userID}/summary, GET_SELFp, OWNER, /inbox/{id}, PATCH_SELFdiff --git a/server/activity.go b/server/activity.goindex c0a4305c76..bcaa45daf1 100644--- a/server/activity.go+++ b/server/activity.go@@ -136,24 +136,4 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {}return nil})-- g.DELETE("/activity/:activityID", func(c echo.Context) error {- ctx := c.Request().Context()- id, err := strconv.Atoi(c.Param("activityID"))- if err != nil {- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("activityID"))).SetInternal(err)- }-- activityDelete := &api.ActivityDelete{- ID: id,- DeleterID: c.Get(getPrincipalIDContextKey()).(int),- }- if err := s.store.DeleteActivity(ctx, activityDelete); err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete activity ID: %v", id)).SetInternal(err)- }-- c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- c.Response().WriteHeader(http.StatusOK)- return nil- })}diff --git a/store/activity.go b/store/activity.goindex 6e28965935..1986b0df91 100644--- a/store/activity.go+++ b/store/activity.go@@ -196,25 +196,6 @@ func (s *Store) patchActivityRaw(ctx context.Context, patch *api.ActivityPatch)return activity, nil}-// DeleteActivity deletes an existing activity by ID.-func (s *Store) DeleteActivity(ctx context.Context, delete *api.ActivityDelete) error {- tx, err := s.db.BeginTx(ctx, nil)- if err != nil {- return FormatError(err)- }- defer tx.PTx.Rollback()-- if err := deleteActivityImpl(ctx, tx.PTx, delete); err != nil {- return FormatError(err)- }-- if err := tx.PTx.Commit(); err != nil {- return FormatError(err)- }-- return nil-}-func (s *Store) composeActivity(ctx context.Context, raw *activityRaw) (*api.Activity, error) {activity := raw.toActivity()@@ -414,12 +395,3 @@ func patchActivityImpl(ctx context.Context, tx *sql.Tx, patch *api.ActivityPatchreturn nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf("activity ID not found: %d", patch.ID)}}--// deleteActivityImpl permanently deletes a activity by ID.-func deleteActivityImpl(ctx context.Context, tx *sql.Tx, delete *api.ActivityDelete) error {- // Remove row from activity.- if _, err := tx.ExecContext(ctx, `DELETE FROM activity WHERE id = $1`, delete.ID); err != nil {- return FormatError(err)- }- return nil-}