Skip to content

[MuLearn Backend] Add banner image support to Interest Group CRUD APIs #3064

Description

@awindsr

InterestGroup currently has no field for a banner/cover image — only a short icon CharField(max_length=10) (used for an emoji/icon glyph, not an image). The IG dashboard (api/dashboard/ig/) needs a proper banner_image field, plus create/update/read/delete support for it, so each Interest Group can display a banner on its public listing and detail pages.

The events module already solved this exact problem for cover_image / banner_image on events (api/dashboard/events/event_image_utils.py) — file upload, remote-URL fetch with SSRF protection, size/type validation, stale-file cleanup, and absolute-URL resolution for responses. This ticket reuses that pattern for Interest Groups instead of inventing a new one.

  • Add a banner_image column to the interest_group table and InterestGroup model
  • Support banner image upload (multipart file) on IG create (POST /api/v1/ig/) and update (PUT /api/v1/ig/<pk>/)
  • Support banner image upload on the public IG creation request flow (POST /api/v1/ig/request/)
  • Return a resolved, absolute banner image URL on all IG read endpoints (list, get, csv)
  • Clean up the old stored file when a banner image is replaced or the IG is deleted
  • Validate uploaded images (type/size/corruption) and support remote image URLs, consistent with the events module

Expected Outcome

IG admins/leads can attach a banner image when creating or editing an Interest Group, either by uploading a file or supplying an image URL. InterestGroupAPI (GET), InterestGroupListApi, InterestGroupGetAPI, and InterestGroupCSV all return a banner_image field containing a fully-resolved URL (or null if unset). Deleting an IG, or replacing its banner, removes the now-unused file from storage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions