Skip to content

Commit

Permalink
Update token query schema definition
Browse files Browse the repository at this point in the history
  • Loading branch information
elct9620 committed Nov 23, 2023
1 parent 61e66ee commit 4c38e6a
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 10 deletions.
16 changes: 14 additions & 2 deletions api/schema/token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
import { Query, Str } from '@cloudflare/itty-router-openapi'

export const RequiredTokenQuery = Query(Str, { required: true })
export const OptionalTokenQuery = Query(Str, { required: false })
export const OptionalAttendeeTokenQuery = Query(Str, {
description: 'the attendee token',
required: false,
})

export const OptionalDelivererTokenQuery = Query(Str, {
description: 'the deliverer token',
required: false,
})

export const OptionalPublicTokenQuery = Query(Str, {
description: 'the attendee public token',
required: false,
})
2 changes: 1 addition & 1 deletion worker/controller/announcement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class ListAnnouncement extends OpenAPIRoute {
summary: 'List announcements',
tags: ['Announcement'],
parameters: {
token: schema.OptionalTokenQuery,
token: schema.OptionalAttendeeTokenQuery,
},
}

Expand Down
2 changes: 1 addition & 1 deletion worker/controller/landing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class Landing extends OpenAPIRoute {
summary: 'Get attendee display name',
tags: ['Attendee'],
parameters: {
token: schema.OptionalTokenQuery,
token: schema.OptionalAttendeeTokenQuery,
},
}

Expand Down
2 changes: 1 addition & 1 deletion worker/controller/puzzleDeliverer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class GetPuzzleDeliverer extends OpenAPIRoute {
summary: 'Check deliver name',
tags: ['Puzzle'],
parameters: {
token: schema.OptionalTokenQuery,
token: schema.OptionalDelivererTokenQuery,
},
}

Expand Down
4 changes: 2 additions & 2 deletions worker/controller/puzzleDelivery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ export class DeliverPuzzleToUser extends OpenAPIRoute {
summary: 'Deliver puzzle to attendee',
tags: ['Puzzle'],
requestBody: {
receiver: new Str({ description: 'Attendee public token', required: false }),
receiver: new Str({ description: 'the attendee public token', required: false }),
},
parameters: {
token: schema.OptionalTokenQuery,
token: schema.OptionalDelivererTokenQuery,
},
}

Expand Down
2 changes: 1 addition & 1 deletion worker/controller/puzzleStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class GetAttendeePuzzleStatus extends OpenAPIRoute {
summary: 'Get attendee puzzle status',
tags: ['Puzzle'],
parameters: {
token: schema.OptionalTokenQuery,
token: schema.OptionalPublicTokenQuery,
},
}

Expand Down
2 changes: 1 addition & 1 deletion worker/controller/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class GetStatus extends OpenAPIRoute {
tags: ['Attendee'],
parameters: {
StaffQuery: Query(Bool, { description: 'is query by staff', required: false }),
token: schema.OptionalTokenQuery,
token: schema.OptionalAttendeeTokenQuery,
},
}

Expand Down
2 changes: 1 addition & 1 deletion worker/controller/use.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class ApplyScenario extends OpenAPIRoute {
summary: 'Use scenario',
tags: ['Event'],
parameters: {
token: schema.OptionalTokenQuery,
token: schema.OptionalAttendeeTokenQuery,
scenarioId: schema.ScenarioIdPath,
},
}
Expand Down

0 comments on commit 4c38e6a

Please sign in to comment.