1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-04 21:30:05 +00:00

chore: add isAdmin field in user response

This commit is contained in:
2022-06-26 01:48:31 +05:00
parent 35439d7d51
commit 4ddfec0403
6 changed files with 47 additions and 43 deletions

View File

@@ -24,6 +24,7 @@ export interface UserResponse {
id: number
username: string
displayName: string
isAdmin: boolean
}
export interface UserDetailsResponse {
@@ -48,12 +49,14 @@ export class UserController {
{
id: 123,
username: 'johnusername',
displayName: 'John'
displayName: 'John',
isAdmin: false
},
{
id: 456,
username: 'starkusername',
displayName: 'Stark'
displayName: 'Stark',
isAdmin: true
}
])
@Get('/')
@@ -200,7 +203,7 @@ export class UserController {
const getAllUsers = async (): Promise<UserResponse[]> =>
await User.find({})
.select({ _id: 0, id: 1, username: 1, displayName: 1 })
.select({ _id: 0, id: 1, username: 1, displayName: 1, isAdmin: 1 })
.exec()
const createUser = async (data: UserPayload): Promise<UserDetailsResponse> => {