PerformerController

struct PerformerController : APIRouteCollection

The collection of /api/v3/performer/* route endpoints and handler functions related to the official performers and shadow event organizers..

Getting Performer Data

  • GET /api/v3/performer/official

    Gets the list of official performers. Should match what’s on jococruise.com and on Sched.com when deployed; for the rest of the year, data should be loaded that matches the schedule data. That is, we move to next year’s performers when next year’s schedule comes out, even though performer info is iusually released long before the schedule.

    URL Query Parameters:

    • ?start=INT - Offset from start of results set
    • ?limit=INT - the maximum number of games to retrieve: 1-200, default is 50.

    Declaration

    Swift

    func getOfficialPerformers(_ req: Request) async throws -> PerformerResponseData
  • GET /api/v3/performer/shadow

    Gets the list of shadow event organizers. We haven’t been told that we need to keep the official performer list separate from the shadow performers list, but if someone puts them in the same list it in their UI, we probably will get told to separate them.

    Currently shadow cruise organizers can fill in their Performer form themselves during pre-registration (before cruise embarks, after shadow events are put on the schedule). The form doesn’t include years attended or social media links; those fields will be empty.

    URL Query Parameters:

    • ?start=INT - Offset from start of results set
    • ?limit=INT - the maximum number of games to retrieve: 1-200, default is 50.

    Declaration

    Swift

    func getShadowPerformers(_ req: Request) async throws -> PerformerResponseData
  • getSelfPerformer(_:) Asynchronous

    GET /api/v3/performer/self

    Returns the Performer data for the current user. Only Shadow Event organizers have their Performer data associated with their Twitarr user.

    Declaration

    Swift

    func getSelfPerformer(_ req: Request) async throws -> PerformerData
  • getPerformer(_:) Asynchronous

    GET /api/v3/performer/:performer_id

    Returns the Performer data for the given performer ID. Performer ID is separate from userID,

    Declaration

    Swift

    func getPerformer(_ req: Request) async throws -> PerformerData

Modifying Performer Data

  • POST /api/v3/performer/forEvent/:event_id

    Creates or updates a Performer profile for the current user, associating them with the given event if they’re not already associated with it. This method is only for shadow events, but can be called by any verified user. Each user may only have one Performer associated with it, so if this user already has a Perfomer profile the new data updates it.

    When associating a shadow event organizer a new event, callers should take care to call /api/v3/events/performer/user/:user_id to check if this user has a profile already and if so, return their existing Performer fields–unless the user wants to edit them.

    Does not currently use the eventUIDs'array in PerformerUploadData. This method could be modified to use this field, allowing multiple events to be set for a performer at once.

    Declaration

    Swift

    func addSelfPerformerForEvent(_ req: Request) async throws -> HTTPStatus

    Parameters

    eventID

    in URL path

    PerformerUploadData

    JSON POST content.

    Return Value

    HTTP status.

  • POST /api/v3/performer/self/delete DELETE /api/v3/events/self/performer

    Deletes a shadow event organizer’s Performer record and any of their EventPerformer records (linking their Performer to their Events). We haven’t created a way to delete individual EventPerformer pivots. If a user signs up as an organizer of an event they’re not organizing (wrong event, or a non-organizer didn’t know what they were doing, or a troll), just have them delete the Performer (which also deletes all the pivots) and recreate it if necessary, attaching it to the right event(s).

    Declaration

    Swift

    func deleteSelfPerformer(_ req: Request) async throws -> HTTPStatus

TwitarrTeam methods

  • upsertPerformer(_:) Asynchronous

    POST /api/v3/admin/performer/upsert

    Creates or updates a Performer profile. This method may create official Performer models, and may edit Official or Shadow performers. This method does not associate the performer with any events.

    The idea behind this method is that we’ll be using a bulk import method to associate events with performers, but may not end up using bulk import for performers.

    Declaration

    Swift

    func upsertPerformer(_ req: Request) async throws -> HTTPStatus

    Parameters

    PerformerUploadData

    JSON POST content.

    Return Value

    HTTP status.

  • GET /api/v3/performer/link/upload

    Uploads a Excel spreadsheet containing a list of events and which performers (by name) that will be performing at each event.

    Declaration

    Swift

    func uploadPerformerLinkSpreadsheet(_ req: Request) async throws -> HTTPStatus
  • GET /api/v3/performer/link/verify

    Parses the Excel file uploaded in uploadPerformerLinkSpreadsheet(), matches events listed in the spreadsheet to database Events, matches performer names in the spread sheet to Performers in the db.

    This method doesn’t modify the db, it just does all the matching and reports any errors.

    Declaration

    Swift

    func performerLinkVerificationHandler(_ req: Request) async throws -> EventPerformerValidationData
  • GET /api/v3/performer/link/apply

    Parses the Excel file uploaded in uploadPerformerLinkSpreadsheet(), matches events listed in the spreadsheet to database Events, matches performer names in the spread sheet to Performers in the db, creates EventPerformer pivots linking Events and their Performers.

    This method deletes all existing EventPerformer pivots for official performers before saving the new ones; the assumption is that the Excel spreadsheet is the new definitive (and complete) source for which performers are at which events.

    Declaration

    Swift

    func performerLinkApplyHandler(_ req: Request) async throws -> HTTPStatus

    Return Value

    HTTP status.

Utilities