code4romania / teacher-workout-backend

Teacher Workout backend (API for mobile apps & for the web client)
Mozilla Public License 2.0
7 stars 34 forks source link

[57] get and clean images #84

Closed nicolaes closed 10 months ago

nicolaes commented 10 months ago

What does it fix?

Closes #57 : additional suggestions This includes PR #83.

How has it been tested?

Get uploaded image

GET https://localhost:5001/file/eb8749f3-05a5-4d07-9310-056a2c7ef37d (id taken from singleUpload mutation response, see testing on #83)

Create theme with an uploaded image

mutation {
  themeCreate(input: { title: "New Theme 4", fileBlobId: "eb8749f3-05a5-4d07-9310-056a2c7ef37d" }) {
    theme {
      id
      title
      thumbnail {
          url,
          fileBlobId
      }
    }
  }
}

New query to get recentImageUploads

{
    recentImageUploads(limit: 2) {
        id,
        createdAt
    }
}

Hangfire cleanup

  1. Created new upload with singleUpload mutation
  2. Manipulated cron frequency in Startup.cs to Minutely and parameters of DeleteOldEntries in FileBlobRepository, to account for more database entries (can also be done by moving CreatedOn column to a few days ago)
  3. Started app and verified orphan entries are removed and dependent entries are not (console logged how many entries were deleted)