Skip to content

Commit

Permalink
chore: minor clean ups
Browse files Browse the repository at this point in the history
  • Loading branch information
k1ch committed Jan 26, 2024
1 parent 9db8eb7 commit a034b45
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
9 changes: 9 additions & 0 deletions server/src/api_endpoints/personas/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ const createPersonaRoles = async (req, res, next) => {
}
}

/**
* HTTP request handler
* Delete a persona role by persona key and role key and send 204 on success
*
* @param {Object} req - The request object
* @param {Object} res - The response object
* @param {Function} next - The next middleware function
* @returns {Promise<void>} - A promise that resolves to void
*/
const deletePersonaRole = async (req, res, next) => {
try {
const { persona_key: personaKey, role_key: roleKey } = req.params
Expand Down
8 changes: 8 additions & 0 deletions server/test/endpoint_admin_personas_roles.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ describe('Admin Personas Roles', () => {
})

describe('DELETE:/personas/{persona_key}/roles/{role_key}', () => {
/**
* Helper function to make an HTTPS request to delete a persona role.
*
* @param {string} roleKey - The role key
* @param {string} personaKey - The persona key
* @param {Object} header - The request headers
* @returns {Promise<Response>} - A promise that resolves to the HTTP response
*/
const deletePersonasRoles = async (roleKey, personaKey = testPersonaKey, header = requestHeaders) => {
return await fetch(`${url}/personas/${personaKey}/roles/${roleKey}`, {
method: 'DELETE',
Expand Down
8 changes: 4 additions & 4 deletions server/the-usher-openapi-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -547,10 +547,10 @@ paths:
responses:
204:
description: Empty response on success
401:
$ref: '#/components/responses/Unauthorized'
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'
500:
Expand Down Expand Up @@ -634,10 +634,10 @@ paths:
responses:
204:
description: Empty response on success
401:
$ref: '#/components/responses/Unauthorized'
400:
$ref: '#/components/responses/BadRequest'
401:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'
500:
Expand Down

0 comments on commit a034b45

Please sign in to comment.