docs: openapi schema for user/group exist check, session deletion

v1.18.x
Julian Lam 4 years ago
parent 97842c43d3
commit bcccb331db

@ -42,6 +42,8 @@ paths:
$ref: 'write/users/uid/ban.yaml'
/users/{uid}/tokens/{token}:
$ref: 'write/users/uid/tokens/token.yaml'
/users/{uid}/sessions/{uuid}:
$ref: 'write/users/uid/sessions/uuid.yaml'
/categories/:
$ref: 'write/categories.yaml'
/groups/:

@ -1,3 +1,20 @@
head:
tags:
- groups
summary: check if a group exists
parameters:
- in: path
name: slug
schema:
type: string
required: true
description: group slug (that also acts as its identifier) to check
example: my-test-group
responses:
'200':
description: group found
'404':
description: group not found
delete:
tags:
- groups

@ -1,3 +1,20 @@
head:
tags:
- users
summary: check if a user exists
parameters:
- in: path
name: uid
schema:
type: integer
required: true
description: uid of the user to check
example: 3
responses:
'200':
description: user found
'404':
description: user not found
delete:
tags:
- users

@ -0,0 +1,31 @@
delete:
tags:
- users
summary: revoke a user session
parameters:
- in: path
name: uid
schema:
type: integer
required: true
description: uid of the user's session
example: 3
- in: path
name: uuid
schema:
type: string
required: true
description: uuid of the user's session
example: 7c1a66b3-90e1-41f4-9f74-2b2edaebf917
responses:
'200':
description: user session revoked
content:
application/json:
schema:
type: object
properties:
status:
$ref: ../../../../components/schemas/Status.yaml#/Status
response:
type: object

@ -10,8 +10,8 @@ const setupApiRoute = routeHelpers.setupApiRoute;
module.exports = function () {
const middlewares = [middleware.authenticate];
setupApiRoute(router, 'head', '/:slug', [middleware.assert.group], controllers.write.groups.exists);
setupApiRoute(router, 'post', '/', [...middlewares, middleware.checkRequired.bind(null, ['name'])], controllers.write.groups.create);
setupApiRoute(router, 'head', '/:slug', [middleware.assert.group], controllers.write.groups.exists);
setupApiRoute(router, 'delete', '/:slug', [...middlewares, middleware.assert.group], controllers.write.groups.delete);
setupApiRoute(router, 'put', '/:slug/membership/:uid', [...middlewares, middleware.assert.group], controllers.write.groups.join);
setupApiRoute(router, 'delete', '/:slug/membership/:uid', [...middlewares, middleware.assert.group], controllers.write.groups.leave);

@ -49,6 +49,18 @@ describe('API', async () => {
example: utils.generateUUID(),
},
],
'/users/{uid}/sessions/{uuid}': [
{
in: 'path',
name: 'uid',
example: 1,
},
{
in: 'path',
name: 'uuid',
example: '', // to be defined below...
},
],
},
};
@ -120,7 +132,7 @@ describe('API', async () => {
await socketUser.exportPosts({ uid: adminUid }, { uid: adminUid });
await socketUser.exportUploads({ uid: adminUid }, { uid: adminUid });
// wait for export child process to complete
await wait(5000);
// await wait(5000);
// Attach a search hook so /api/search is enabled
plugins.registerHook('core', {

Loading…
Cancel
Save