Went back to using id's for deletion (for cleaner query params)
ref #13 #17
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Body, Delete, Get, JsonController, OnUndefined, Param, Post, Put } from 'routing-controllers';
|
||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
||||
import { getConnectionManager, Repository } from 'typeorm';
|
||||
import { EntityFromBody, EntityFromParam } from 'typeorm-routing-controllers-extensions';
|
||||
import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
|
||||
import { UserGroupIdsNotMatchingError, UserGroupNotFoundError } from '../errors/UserGroupErrors';
|
||||
import { CreateUserGroup } from '../models/actions/CreateUserGroup';
|
||||
import { UserGroup } from '../models/entities/UserGroup';
|
||||
@@ -75,7 +75,8 @@ export class UserGroupController {
|
||||
@ResponseSchema(ResponseEmpty, { statusCode: 204 })
|
||||
@OnUndefined(204)
|
||||
@OpenAPI({ description: 'Delete a specified usergroup (if it exists).' })
|
||||
async remove(@EntityFromParam('id') group: UserGroup) {
|
||||
async remove(@Param("id") id: number) {
|
||||
let group = await this.userGroupsRepository.findOne({ id: id });
|
||||
if (!group) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user