From 7a63415d1c9cff7ad027395fb60b218d3272749f Mon Sep 17 00:00:00 2001 From: Bryttanie <28575816+xbhouse@users.noreply.github.com> Date: Fri, 22 Nov 2024 07:50:05 -0500 Subject: [PATCH] Fixes 5034: update latest snapshot after uploading content (#902) Fixes 5034: trigger update-latest-snapshot after uploading content --- pkg/handler/repositories.go | 1 + pkg/handler/repositories_test.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/pkg/handler/repositories.go b/pkg/handler/repositories.go index 4abb87b94..63c8fe886 100644 --- a/pkg/handler/repositories.go +++ b/pkg/handler/repositories.go @@ -881,6 +881,7 @@ func (rh *RepositoryHandler) enqueueAddUploadsEvent(c echo.Context, response api if err := rh.DaoRegistry.RepositoryConfig.UpdateLastSnapshotTask(c.Request().Context(), taskID.String(), response.OrgID, response.RepositoryUUID); err != nil { logger.Error().Err(err).Msgf("error UpdatingLastSnapshotTask task for AddUploads") } + rh.enqueueUpdateLatestSnapshotEvent(c, response.OrgID, taskID, response) } return taskID.String() diff --git a/pkg/handler/repositories_test.go b/pkg/handler/repositories_test.go index 38246d8f2..d1a022bf6 100644 --- a/pkg/handler/repositories_test.go +++ b/pkg/handler/repositories_test.go @@ -176,6 +176,15 @@ func mockTaskClientEnqueueAddUploads(repoSuite *ReposSuite, repo api.RepositoryR repo.OrgID, repo.RepositoryUUID, ).Return(nil) + repo.LastSnapshotTaskUUID = "00000000-0000-0000-0000-000000000000" + repoSuite.tcMock.On("Enqueue", queue.Task{ + Typename: config.UpdateLatestSnapshotTask, + Payload: tasks.UpdateLatestSnapshotPayload{RepositoryConfigUUID: repo.UUID}, + Dependencies: []uuid.UUID{dao.UuidifyString(repo.LastSnapshotTaskUUID)}, + ObjectUUID: &repo.RepositoryUUID, + ObjectType: utils.Ptr(config.ObjectTypeRepository), + OrgId: repo.OrgID, + }).Return(nil, nil) } func mockSnapshotDeleteEvent(tcMock *client.MockTaskClient, repoConfigUUID string) {