Skip to content

Add file upload delete endpoint

Jan Provaznik requested to merge jp-delete-uploads into master

What does this MR do and why?

Allows deleting file upload in a project or group.

Related to #366406 (closed)

Sample query:

mutation {
  uploadDelete(input: {projectPath: "flightjs/flight", secret: "84ef8229da63c0204efe642528cac8e1", filename: "sample.txt"}) {
    upload {
      id
      size
      path
    }
    errors
  }
}

DB query

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/11091/commands/39684

Note that path doesn't match "real" path on prod.

SELECT "uploads".*
FROM "uploads"
WHERE "uploads"."model_type" = 'Project'
  AND "uploads"."model_id" = 278964
  AND "uploads"."uploader" = 'FileUploader'
  AND "uploads"."path" IN ('f82d4cf7eccaa782b83682a48c787244/sample.txt',
                           '@hashed/e7/f6/e7f6c011776e8db7cd330b54174fd76f7d0216b612387a5ffcfb81e6f0919683/f82d4cf7eccaa782b83682a48c787244/sample.txt')
LIMIT 1

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by charlie ablett

Merge request reports