Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@Query('limit') limit: number,
@Query('fields') fields?: string,
@Query('sort') sort?: string,
@Query('q') q?: string): Promise {
return this.service.getPaginated(page, limit, fields, sort, q);
}
@Response(400, 'Bad request')
@Security('admin')
@Post()
public async create(@Body() body: IUserModel): Promise {
return this.service.create(body);
}
@Response(400, 'Bad request')
@Security('admin')
@Put('{id}')
public async update(id: string, @Body() body: IUserModel): Promise {
return this.service.update(id, body);
}
@Security('admin')
@Delete('{id}')
public async delete(id: string): Promise {
return this.service.delete(id);
}
}
@Response(400, 'Bad request')
@Security('admin')
@Post()
public async create(@Body() body: IUserModel): Promise {
return this.service.create(body);
}
@Response(400, 'Bad request')
@Security('admin')
@Put('{id}')
public async update(id: string, @Body() body: IUserModel): Promise {
return this.service.update(id, body);
}
@Security('admin')
@Delete('{id}')
public async delete(id: string): Promise {
return this.service.delete(id);
}
}
public async getById(id: string): Promise {
return this.service.getById(id);
}
@Get()
public async getPaginated(
@Query('page') page: number,
@Query('limit') limit: number,
@Query('fields') fields?: string,
@Query('sort') sort?: string,
@Query('q') q?: string): Promise {
return this.service.getPaginated(page, limit, fields, sort, q);
}
@Response(400, 'Bad request')
@Security('admin')
@Post()
public async create(@Body() body: IUserModel): Promise {
return this.service.create(body);
}
@Response(400, 'Bad request')
@Security('admin')
@Put('{id}')
public async update(id: string, @Body() body: IUserModel): Promise {
return this.service.update(id, body);
}
@Security('admin')
@Delete('{id}')
public async delete(id: string): Promise {
return this.service.delete(id);