-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from OxfordRSE/enrolment-key
Add enrolment via a secret key
- Loading branch information
Showing
13 changed files
with
190 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { basePath } from "lib/basePath" | ||
import { Data } from 'pages/api/userOnEvent/[eventId]' | ||
import { UserOnEvent } from '@prisma/client' | ||
import { Event } from 'lib/types' | ||
import { data } from "cypress/types/jquery" | ||
|
||
export const putUserOnEvent = async (eventId: number, userOnEvent: UserOnEvent): Promise<Event> => { | ||
const apiPath = `${basePath}/api/userOnEvent/${eventId}` | ||
const requestOptions = { | ||
method: 'PUT', | ||
headers: { 'Content-Type': 'application/json' }, | ||
body: JSON.stringify({ userOnEvent }) | ||
}; | ||
return fetch(apiPath, requestOptions).then(response => response.json()).then(data => { | ||
if ('error' in data) throw data.error | ||
if ('userOnEvent' in data) return data.userOnEvent | ||
}) | ||
} | ||
|
||
export default putUserOnEvent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
prisma/migrations/20231030095951_add_enrolment_keys_to_event/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- AlterTable | ||
ALTER TABLE "Event" ADD COLUMN "enrolKey" TEXT NOT NULL, | ||
ADD COLUMN "instructorKey" TEXT NOT NULL; |
Oops, something went wrong.