HackGT/SponsorshipPortal

Implement basic participant controller functionality

Opened this issue · 0 comments

  • Creating a new table for participant "flags"
    • via database migration
  • Add new function(s) in model/participant/participant.go for:
    • setting flag(s)
      • Add unit test
    • getting flagged participants
      • Add unit test
    • getting all participants
      • Add unit test
  • Adding a participant controller with routes for all of the above^ (remember to properly catch and return errors)

Relevant routes from #58 (to be finalized):

Route Method Description Request Response
/participant GET Get all participants - {participants: []<participant>}
/participant/flag PUT Flag participants for the current user {participant_ids: []<id>} {status: "ok"}
/participant/flag DELETE Unflag participants for the current user {participant_ids: []<id>} {status: "ok"}
/participant/flagged GET Get all flagged participants for the current user - {participants: []<participant>}
/participant/{id}/flag POST Flag participant for the current user None {status: "ok"}
/participant/{id}/flag DELETE Unflag participant for the current user None {status: "ok"}

Paths/interface will be finalized in #58

If #57 (user authentication middleware) is not yet complete, this can be initially implemented with a static user and wait until that feature is merged.