-
Notifications
You must be signed in to change notification settings - Fork 1
feat: migrate teamsettings to v2 endpoint #699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
08f46b2
feat: migrate teamsettings to v2
CasLubbers f5992a0
feat: fix tests
CasLubbers 82f4d7b
fix: saving team settings file correctly
CasLubbers 6ef9936
feat: update api authz test to not load values
CasLubbers 0f0ada5
feat: add openapi schema
CasLubbers b2c012d
fix: get teams endpoint
CasLubbers d8fa51a
fix: get team endpoint
CasLubbers 686b19e
fix: review comments
CasLubbers 988f795
fix: add ds_store to gitignore
CasLubbers 8f08549
Merge branch 'main' into APL-709
CasLubbers e0231fc
Merge branch 'main' into APL-709
CasLubbers c2dd566
Merge branch 'main' into APL-709
CasLubbers c5bed6a
fix: change postman collection run
CasLubbers 93b101c
Merge remote-tracking branch 'origin/main' into APL-709
CasLubbers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,34 @@ | ||
| import Debug from 'debug' | ||
| import { Operation, OperationHandlerArray } from 'express-openapi' | ||
| import { AplTeamSettingsRequest, OpenApiRequestExt } from 'src/otomi-models' | ||
|
|
||
| const debug = Debug('otomi:api:v2:teams') | ||
|
|
||
| export default function (): OperationHandlerArray { | ||
| const get: Operation = [ | ||
| ({ otomi }: OpenApiRequestExt, res): void => { | ||
| debug('getTeams') | ||
| // we filter admin team here as it is not for console | ||
| const teams = (otomi.getAplTeams() || []) | ||
| .filter((t) => t.metadata.name !== 'admin') | ||
|
merll marked this conversation as resolved.
Outdated
|
||
| .map(({ spec, ...rest }) => ({ | ||
| ...rest, | ||
| spec: { ...spec, password: undefined }, | ||
| })) | ||
|
|
||
| res.json(teams) | ||
| }, | ||
| ] | ||
| const post: Operation = [ | ||
| async ({ otomi, body }: OpenApiRequestExt, res): Promise<void> => { | ||
| debug('createTeam') | ||
| const data = await otomi.createAplTeam(body as AplTeamSettingsRequest) | ||
| res.json(data) | ||
| }, | ||
| ] | ||
| const api = { | ||
| get, | ||
| post, | ||
| } | ||
| return api | ||
| } | ||
This file contains hidden or 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,43 @@ | ||
| import Debug from 'debug' | ||
| import { Operation, OperationHandlerArray } from 'express-openapi' | ||
| import { AplTeamSettingsRequest, OpenApiRequestExt } from 'src/otomi-models' | ||
|
|
||
| const debug = Debug('otomi:api:v2:teams') | ||
|
|
||
| export default function (): OperationHandlerArray { | ||
| const del: Operation = [ | ||
| async ({ otomi, params: { teamId } }: OpenApiRequestExt, res): Promise<void> => { | ||
| debug(`deleteTeam(${teamId})`) | ||
| await otomi.deleteTeam(teamId) | ||
| res.json({}) | ||
| }, | ||
| ] | ||
| const get: Operation = [ | ||
| ({ otomi, params: { teamId } }: OpenApiRequestExt, res): void => { | ||
| debug(`getTeam(${teamId})`) | ||
| const data = otomi.getAplTeam(teamId) | ||
| res.json(data) | ||
| }, | ||
| ] | ||
| const put: Operation = [ | ||
| async ({ otomi, params: { teamId }, body }: OpenApiRequestExt, res): Promise<void> => { | ||
| debug(`editTeam(${teamId})`) | ||
| const data = await otomi.editAplTeam(teamId, body as AplTeamSettingsRequest) | ||
| res.json(data) | ||
| }, | ||
| ] | ||
| const patch: Operation = [ | ||
| async ({ otomi, params: { teamId }, body }: OpenApiRequestExt, res): Promise<void> => { | ||
| debug(`editTeam(${teamId}, patch)`) | ||
| const data = await otomi.editAplTeam(teamId, body as AplTeamSettingsRequest, true) | ||
| res.json(data) | ||
| }, | ||
| ] | ||
| const api = { | ||
| delete: del, | ||
| get, | ||
| put, | ||
| patch, | ||
| } | ||
| return api | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.