Fixed wrong body acceptance type
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
ref #146
This commit is contained in:
parent
bce8811925
commit
aaec09d2ab
|
@ -1,7 +1,6 @@
|
|||
import { Authorized, Body, Delete, Get, JsonController, OnUndefined, Param, Post, Put, QueryParam } from 'routing-controllers';
|
||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
||||
import { getConnectionManager, Repository } from 'typeorm';
|
||||
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
||||
import { UserGroupIdsNotMatchingError, UserGroupNotFoundError } from '../errors/UserGroupErrors';
|
||||
import { CreateUserGroup } from '../models/actions/create/CreateUserGroup';
|
||||
import { UpdateUserGroup } from '../models/actions/update/UpdateUserGroup';
|
||||
|
@ -82,7 +81,7 @@ export class UserGroupController {
|
|||
@ResponseSchema(UserGroupNotFoundError, { statusCode: 404 })
|
||||
@ResponseSchema(UserGroupIdsNotMatchingError, { statusCode: 406 })
|
||||
@OpenAPI({ description: "Update the group whose id you provided. <br> To change the permissions granted to the group please use /api/permissions instead. <br> Please remember that ids can't be changed." })
|
||||
async put(@Param('id') id: number, @EntityFromBody() updateGroup: UpdateUserGroup) {
|
||||
async put(@Param('id') id: number, @Body({ validate: true }) updateGroup: UpdateUserGroup) {
|
||||
let oldGroup = await this.userGroupsRepository.findOne({ id: id });
|
||||
|
||||
if (!oldGroup) {
|
||||
|
@ -94,7 +93,7 @@ export class UserGroupController {
|
|||
}
|
||||
await this.userGroupsRepository.save(await updateGroup.update(oldGroup));
|
||||
|
||||
return (await this.userGroupsRepository.findOne({ id: id }, { relations: ['permissions', 'groups'] })).toResponse();
|
||||
return (await this.userGroupsRepository.findOne({ id: id }, { relations: ['permissions'] })).toResponse();
|
||||
}
|
||||
|
||||
@Delete('/:id')
|
||||
|
|
Loading…
Reference in New Issue