mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-09-20 07:16:05 +08:00
fix(docs): /users API docs ZMS-110 (#575)
* /users GET endpoint added * added /users POST to api generation * added /users/resolve/:username GET endpoint for api generation * fixes + request user info GET endpoint added * Added Update User information api path to api docs generation * added Log out User endpoint to api generation * Added Recalculate User quota endpoint to API generation * added Recalculate Quota for all users endpoint to api generation * added Export data endpoint to API generation * added Import user data endpoint to API generation * Reset password for a User endpoint added to API generation * Reset password for a User endpoint add param to res * add missing response types * added Delete a User, Return recovery info for a deleted User, Cancel user deletion task - endpoints to API generation * fix typo in users.js
This commit is contained in:
parent
29cffe0d5f
commit
a15878c7d7
1037
lib/api/users.js
1037
lib/api/users.js
File diff suppressed because it is too large
Load diff
|
@ -1,9 +1,32 @@
|
|||
'use strict';
|
||||
|
||||
const Joi = require('joi');
|
||||
const { booleanSchema } = require('../../schemas');
|
||||
|
||||
const successRes = booleanSchema.required().description('Indicates successful response');
|
||||
const totalRes = Joi.number().required().description('How many results were found');
|
||||
const pageRes = Joi.number().required().description('Current page number. Derived from page query argument');
|
||||
const previousCursorRes = Joi.alternatives()
|
||||
.try(Joi.string(), booleanSchema)
|
||||
.required()
|
||||
.description('Either a cursor string or false if there are not any previous results');
|
||||
const nextCursorRes = Joi.alternatives()
|
||||
.try(Joi.string(), booleanSchema)
|
||||
.required()
|
||||
.description('Either a cursor string or false if there are not any next results');
|
||||
|
||||
const quotaRes = Joi.object({
|
||||
allowed: Joi.number().required().description('Allowed quota of the user in bytes'),
|
||||
used: Joi.number().required().description('Space used in bytes')
|
||||
})
|
||||
.$_setFlag('objectName', 'Quota')
|
||||
.description('Quota usage limits');
|
||||
|
||||
module.exports = {
|
||||
successRes
|
||||
successRes,
|
||||
totalRes,
|
||||
pageRes,
|
||||
previousCursorRes,
|
||||
nextCursorRes,
|
||||
quotaRes
|
||||
};
|
||||
|
|
29
lib/schemas/response/users-schemas.js
Normal file
29
lib/schemas/response/users-schemas.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
const Joi = require('joi');
|
||||
const { booleanSchema } = require('../../schemas');
|
||||
const { quotaRes } = require('./general-schemas');
|
||||
|
||||
const GetUsersResult = Joi.object({
|
||||
id: Joi.string().required().description('Users unique ID (24byte hex)'),
|
||||
username: Joi.string().required().description('Username of the User'),
|
||||
name: Joi.string().required().description('Name of the User'),
|
||||
address: Joi.string().required().description('Main email address of the User'),
|
||||
tags: Joi.array().items(Joi.string()).required().description('List of tags associated with the User'),
|
||||
targets: Joi.array().items(Joi.string()).required().description('List of forwarding targets'),
|
||||
enabled2fa: Joi.array().items(Joi.string()).required().description('List of enabled 2FA methods'),
|
||||
autoreply: booleanSchema.required().description('Is autoreply enabled or not (start time may still be in the future or end time in the past)'),
|
||||
encryptMessages: booleanSchema.required().description('If true then received messages are encrypted'),
|
||||
encryptForwarded: booleanSchema.required().description('If true then forwarded messages are encrypted'),
|
||||
quota: quotaRes,
|
||||
metaData: Joi.object().description('Custom metadata value. Included if metaData query argument was true'),
|
||||
internalData: Joi.object().description(
|
||||
'Custom metadata value for internal use. Included if internalData query argument was true and request was not made using user-role token'
|
||||
),
|
||||
hasPasswordSet: booleanSchema.required().description('If true then the User has a password set and can authenticate'),
|
||||
activated: booleanSchema.required().description('Is the account activated'),
|
||||
disabled: booleanSchema.required().description('If true then user can not authenticate or receive any new mail'),
|
||||
suspended: booleanSchema.required().description('If true then user can not authenticate')
|
||||
}).$_setFlag('objectName', 'GetUsersResult');
|
||||
|
||||
module.exports = { GetUsersResult };
|
Loading…
Reference in a new issue