mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 14:16:25 +02:00
fix: user creation POST route returns user data, updated openapi spec
This commit is contained in:
101
openapi.yaml
101
openapi.yaml
@@ -160,6 +160,21 @@ components:
|
|||||||
userslug:
|
userslug:
|
||||||
type: string
|
type: string
|
||||||
example: dragon-fruit
|
example: dragon-fruit
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
example: dragonfruit@example.org
|
||||||
|
email:confirmed:
|
||||||
|
type: number
|
||||||
|
example: 1
|
||||||
|
joindate:
|
||||||
|
type: number
|
||||||
|
example: 1585337827953
|
||||||
|
lastonline:
|
||||||
|
type: number
|
||||||
|
example: 1585337827953
|
||||||
|
picture:
|
||||||
|
type: string
|
||||||
|
example: https://images.unsplash.com/photo-1560070094-e1f2ddec4337?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=256&h=256&q=80
|
||||||
fullname:
|
fullname:
|
||||||
type: string
|
type: string
|
||||||
example: Mr. Dragon Fruit Jr.
|
example: Mr. Dragon Fruit Jr.
|
||||||
@@ -184,64 +199,72 @@ components:
|
|||||||
example: |
|
example: |
|
||||||
This is an example signature
|
This is an example signature
|
||||||
It can span multiple lines.
|
It can span multiple lines.
|
||||||
groupTitle:
|
|
||||||
type: string
|
|
||||||
example: "[\"administrators\",\"Staff\"]"
|
|
||||||
uploadedpicture:
|
uploadedpicture:
|
||||||
type: string
|
type: string
|
||||||
example: /assets/profile/1-profileimg.png
|
example: /assets/profile/1-profileimg.png
|
||||||
description: In almost all cases, defer to "picture" instead. Use this if you need to specifically reference the picture uploaded to the forum.
|
description: In almost all cases, defer to "picture" instead. Use this if you need to specifically reference the picture uploaded to the forum.
|
||||||
cover:url:
|
|
||||||
type: string
|
|
||||||
example: /assets/profile/1-cover.png
|
|
||||||
cover:position:
|
|
||||||
type: string
|
|
||||||
example: 50.0301% 19.2464%
|
|
||||||
picture:
|
|
||||||
type: string
|
|
||||||
example: https://images.unsplash.com/photo-1560070094-e1f2ddec4337?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=256&h=256&q=80
|
|
||||||
status:
|
|
||||||
type: string
|
|
||||||
example: online
|
|
||||||
postcount:
|
|
||||||
type: number
|
|
||||||
example: 1000
|
|
||||||
topiccount:
|
|
||||||
type: number
|
|
||||||
example: 50
|
|
||||||
followercount:
|
|
||||||
type: number
|
|
||||||
example: 2
|
|
||||||
followingcount:
|
|
||||||
type: number
|
|
||||||
example: 5
|
|
||||||
profileviews:
|
profileviews:
|
||||||
type: number
|
type: number
|
||||||
example: 1000
|
example: 1000
|
||||||
reputation:
|
reputation:
|
||||||
type: number
|
type: number
|
||||||
example: 100
|
example: 100
|
||||||
email:
|
postcount:
|
||||||
type: string
|
|
||||||
example: dragonfruit@example.org
|
|
||||||
email:confirmed:
|
|
||||||
type: number
|
type: number
|
||||||
example: 1
|
example: 1000
|
||||||
lastonline:
|
topiccount:
|
||||||
type: number
|
type: number
|
||||||
example: 1585337827953
|
example: 50
|
||||||
lastposttime:
|
lastposttime:
|
||||||
type: number
|
type: number
|
||||||
example: 1585337827953
|
example: 1585337827953
|
||||||
flags:
|
|
||||||
type: number
|
|
||||||
example: 0
|
|
||||||
banned:
|
banned:
|
||||||
type: number
|
type: number
|
||||||
example: 0
|
example: 0
|
||||||
banned:expire:
|
banned:expire:
|
||||||
type: number
|
type: number
|
||||||
example: 1585337827953
|
example: 1585337827953
|
||||||
joindate:
|
status:
|
||||||
|
type: string
|
||||||
|
example: online
|
||||||
|
flags:
|
||||||
type: number
|
type: number
|
||||||
example: 1585337827953
|
example: 0
|
||||||
|
followercount:
|
||||||
|
type: number
|
||||||
|
example: 2
|
||||||
|
followingcount:
|
||||||
|
type: number
|
||||||
|
example: 5
|
||||||
|
cover:url:
|
||||||
|
type: string
|
||||||
|
example: /assets/profile/1-cover.png
|
||||||
|
cover:position:
|
||||||
|
type: string
|
||||||
|
example: 50.0301% 19.2464%
|
||||||
|
groupTitle:
|
||||||
|
type: string
|
||||||
|
example: "[\"administrators\",\"Staff\"]"
|
||||||
|
groupTitleArray:
|
||||||
|
type: array
|
||||||
|
example:
|
||||||
|
- administrators
|
||||||
|
- Staff
|
||||||
|
icon:text:
|
||||||
|
type: string
|
||||||
|
example: D
|
||||||
|
icon:bgColor:
|
||||||
|
type: string
|
||||||
|
example: "#9c27b0"
|
||||||
|
joindateISO:
|
||||||
|
type: string
|
||||||
|
example: 2020-03-27T20:30:36.590Z
|
||||||
|
lastonlineISO:
|
||||||
|
type: string
|
||||||
|
example: 2020-03-27T20:30:36.590Z
|
||||||
|
banned_until:
|
||||||
|
type: number
|
||||||
|
example: 0
|
||||||
|
banned_until_readable:
|
||||||
|
type: string
|
||||||
|
example: Not Banned
|
||||||
@@ -243,7 +243,7 @@ middleware.checkRequired = function (fields, req, res, next) {
|
|||||||
const missing = fields.filter(field => !req.body.hasOwnProperty(field));
|
const missing = fields.filter(field => !req.body.hasOwnProperty(field));
|
||||||
|
|
||||||
if (!missing.length) {
|
if (!missing.length) {
|
||||||
next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
controllers.helpers.formatApiResponse(400, res, new Error('Required parameters were missing from this API call: ' + missing.join(', ')));
|
controllers.helpers.formatApiResponse(400, res, new Error('Required parameters were missing from this API call: ' + missing.join(', ')));
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ module.exports = function () {
|
|||||||
|
|
||||||
app.post('/', middleware.checkRequired.bind(null, ['username']), middleware.authenticate, middleware.isAdmin, async (req, res) => {
|
app.post('/', middleware.checkRequired.bind(null, ['username']), middleware.authenticate, middleware.isAdmin, async (req, res) => {
|
||||||
const uid = await users.create(req.body);
|
const uid = await users.create(req.body);
|
||||||
helpers.formatApiResponse(200, res, {
|
helpers.formatApiResponse(200, res, await users.getUserData(uid));
|
||||||
uid: uid,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// app.route('/:uid')
|
// app.route('/:uid')
|
||||||
|
|||||||
Reference in New Issue
Block a user