-
Notifications
You must be signed in to change notification settings - Fork 0
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 #48 from AtB-AS/master
chore: Deploy latest changes with enrollment endpoint
- Loading branch information
Showing
13 changed files
with
116 additions
and
44 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
schema: 'https://api.entur.io/journey-planner/v2/graphql' | ||
documents: 'src/**/*.{graphql,js,ts,jsx,tsx' |
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,26 @@ | ||
import Hapi from '@hapi/hapi'; | ||
import { EnrollmentQuery } from '../../service/types'; | ||
import { postEnrollmentGroupRequest } from './schema'; | ||
import * as Boom from '@hapi/boom'; | ||
import { TICKET_INVITE_KEY } from '../../config/env'; | ||
|
||
export default (server: Hapi.Server) => () => { | ||
server.route({ | ||
method: 'POST', | ||
path: '/bff/v1/enrollment/group', | ||
options: { | ||
description: 'Enroll in beta groups with invite key', | ||
tags: ['api', 'enrollment'], | ||
validate: postEnrollmentGroupRequest | ||
}, | ||
handler: async (request, h) => { | ||
const query = (request.query as unknown) as EnrollmentQuery; | ||
|
||
if (TICKET_INVITE_KEY && TICKET_INVITE_KEY === query.inviteKey) { | ||
return { status: 'ok', groups: ['ticketing_group'] }; | ||
} | ||
|
||
return Boom.notFound('Ukjent kode'); | ||
} | ||
}); | ||
}; |
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,7 @@ | ||
import Joi from '@hapi/joi'; | ||
|
||
export const postEnrollmentGroupRequest = { | ||
query: Joi.object({ | ||
inviteKey: Joi.string().required() | ||
}) | ||
}; |
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,2 @@ | ||
export const TICKET_INVITE_KEY: string | undefined = | ||
process.env.TICKET_INVITE_KEY; |
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
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