mirror of https://github.com/requarks/wiki
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
1.5 KiB
83 lines
1.5 KiB
export async function registerSchemas(app) {
|
|
/**
|
|
* USER CORE - Essential fields only
|
|
*/
|
|
app.addSchema({
|
|
$id: 'UserCore',
|
|
type: 'object',
|
|
properties: {
|
|
id: {
|
|
type: 'string',
|
|
format: 'uuid'
|
|
},
|
|
name: {
|
|
type: 'string',
|
|
minLength: 1,
|
|
maxLength: 255
|
|
},
|
|
email: {
|
|
type: 'string',
|
|
format: 'email'
|
|
},
|
|
hasAvatar: {
|
|
type: 'boolean'
|
|
},
|
|
isSystem: {
|
|
type: 'boolean'
|
|
},
|
|
isActive: {
|
|
type: 'boolean'
|
|
},
|
|
isVerified: {
|
|
type: 'boolean'
|
|
},
|
|
createdAt: {
|
|
type: 'string',
|
|
format: 'date-time',
|
|
description: 'RFC 3339 Date Time'
|
|
},
|
|
updatedAt: {
|
|
type: 'string',
|
|
format: 'date-time',
|
|
description: 'RFC 3339 Date Time'
|
|
},
|
|
lastLoginAt: {
|
|
type: 'string',
|
|
format: 'date-time',
|
|
description: 'RFC 3339 Date Time'
|
|
}
|
|
}
|
|
})
|
|
|
|
/**
|
|
* USER - All fields
|
|
*/
|
|
app.addSchema({
|
|
$id: 'User',
|
|
allOf: [
|
|
{
|
|
$ref: 'UserCore#'
|
|
},
|
|
{
|
|
type: 'object',
|
|
properties: {
|
|
meta: {
|
|
type: 'object',
|
|
additionalProperties: true
|
|
},
|
|
prefs: {
|
|
type: 'object',
|
|
additionalProperties: true
|
|
},
|
|
auth: {
|
|
type: 'string'
|
|
},
|
|
passkeys: {
|
|
type: 'string'
|
|
}
|
|
}
|
|
}
|
|
]
|
|
})
|
|
}
|