1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-09 07:20:05 +00:00

chore: swagger docs generated

This commit is contained in:
Saad Jutt
2021-11-04 18:47:40 +05:00
parent 728f277f5c
commit 882f36d30e
21 changed files with 1811 additions and 282 deletions

View File

@@ -1,42 +1,76 @@
import mongoose from 'mongoose'
import { Schema, model } from 'mongoose'
const userSchema = new mongoose.Schema({
displayName: {
type: String,
required: true
},
username: {
type: String,
required: true
},
password: {
type: String,
required: true
},
isAdmin: {
type: Boolean,
default: false
},
isActive: {
type: Boolean,
default: true
},
tokens: [
{
clientId: {
type: String,
required: true
},
accessToken: {
type: String,
required: true
},
refreshToken: {
type: String,
required: true
export interface UserPayload {
/**
* Display name for user
* @example "John Snow"
*/
displayName: string
/**
* Username for user
* @example "johnSnow01"
*/
username: string
/**
* Password for user
*/
password: string
/**
* Account should be admin or not, defaults to false
* @example "false"
*/
isAdmin?: boolean
/**
* Account should be active or not, defaults to true
* @example "true"
*/
isActive?: boolean
}
interface UserSchema extends UserPayload {
isAdmin: boolean
isActive: boolean
tokens: [{ [key: string]: string }]
}
export default model(
'User',
new Schema<UserSchema>({
displayName: {
type: String,
required: true
},
username: {
type: String,
required: true
},
password: {
type: String,
required: true
},
isAdmin: {
type: Boolean,
default: false
},
isActive: {
type: Boolean,
default: true
},
tokens: [
{
clientId: {
type: String,
required: true
},
accessToken: {
type: String,
required: true
},
refreshToken: {
type: String,
required: true
}
}
}
]
})
export default mongoose.model('User', userSchema)
]
})
)