luillo1 / RaceResults

A platform for managing and sharing running race results within running groups
4 stars 0 forks source link

Backend endpoints #11

Closed MutatedGamer closed 2 years ago

MutatedGamer commented 2 years ago

Here are backend endpoints I think we will need

endpoint Type Authentication Required Authorization Inputs Outputs
/organizations GET No N/A organizationId organization name, other public metadata
/organizations/createApiKey POST or UPDATE Yes user admin for organization organizationId new API key
/organizations Yes GET None None All organization IDs user is admin for
/raceResults POST No Valid API key organization API key, member ID (OR info to create a new runner), race result info
/raceResults GET Yes user admin for organization requested organizationId, startDate, endDate all race results SUBMITTED or DISCOVERED (not necessarily ran) between [startDate, endDate]
/runners POST Yes user admin for organization requested organizationId, CSV/TSV of runner info number of runners added, number of runners "deactivated". This endpoint should parse the CSV/TSV file uploaded from form data and add/deactivate runners based on its contents.
/runners GET No Valid API key organizationApiKey, memberId information about the runner requested
luillo1 commented 2 years ago

This looks good. I'm going to skip the createApiKey endpoint for now thought. Azure has an API manager resource that can manage that for us. I'll have the rest in a PR in a few minutes.

luillo1 commented 2 years ago

@MutatedGamer What are your thoughts on this revision? I'm leaving out information about API keys and authorization for now.

Endpoint Method
/organizations GET, POST
/organizations/{orgId} GET
/organizations/{orgId}/members GET, POST
/organizations/{orgId}/members/{memberId} GET, DELETE
/organizations/{orgId}/members/{memberId}/raceresults GET, POST
/races GET
/races/{raceId} GET, POST
MutatedGamer commented 2 years ago

We also need /organizations/{orgId}/raceResults that we can query with dates.

Also, we need some kind of endpoint for verifying results. Perhaps: POST /organizations/{orgId}/members/{memberId}/raceresults/{resultId} which returns a {verificationGuid}

Then we'd have a /organizations/{orgId}/{verificationGuid} that can be GET or POSTed. For GET, it'd return the info for that entey. For POST, it'd verify (or not) the result

Don't forget we need a way to PATCH members probably

luillo1 commented 2 years ago
  1. Agreed. I'll add /organizations/{orgId}/raceResults
  2. I see what you mean. Yeah, we need something like that. Let me give this some thought and we can talk about it some more.
  3. Yeah, I'm leaving that task for a next iteration when I get this base functionality working.