Updated descriptions and responses
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
ref #100
This commit is contained in:
parent
4f6e81677c
commit
fc7b8f4c16
|
@ -4,7 +4,6 @@ import { getConnectionManager, Repository } from 'typeorm';
|
|||
import { UserDeletionNotConfirmedError, UserIdsNotMatchingError, UsernameContainsIllegalCharacterError, UserNotFoundError } from '../errors/UserErrors';
|
||||
import { UpdateUser } from '../models/actions/update/UpdateUser';
|
||||
import { User } from '../models/entities/User';
|
||||
import { ResponseEmpty } from '../models/responses/ResponseEmpty';
|
||||
import { ResponseUser } from '../models/responses/ResponseUser';
|
||||
import { ResponseUserPermissions } from '../models/responses/ResponseUserPermissions';
|
||||
import { PermissionController } from './PermissionController';
|
||||
|
@ -68,13 +67,12 @@ export class MeController {
|
|||
|
||||
@Delete('/')
|
||||
@ResponseSchema(ResponseUser)
|
||||
@ResponseSchema(ResponseEmpty, { statusCode: 204 })
|
||||
@ResponseSchema(UserNotFoundError, { statusCode: 404 })
|
||||
@ResponseSchema(UserDeletionNotConfirmedError, { statusCode: 406 })
|
||||
@OnUndefined(204)
|
||||
@OpenAPI({ description: 'Delete the user whose id you provided. <br> If there are any permissions directly granted to the user they will get deleted as well. <br> If no user with this id exists it will just return 204(no content).' })
|
||||
@OpenAPI({ description: 'Delete yourself. <br> You have to confirm your decision by providing the ?force=true query param. <br> If there are any permissions directly granted to you they will get deleted as well.' })
|
||||
async remove(@CurrentUser() currentUser: User, @QueryParam("force") force: boolean) {
|
||||
if (!force) { throw new UserDeletionNotConfirmedError; }
|
||||
if (!currentUser) { return null; }
|
||||
if (!currentUser) { return UserNotFoundError; }
|
||||
const responseUser = await this.userRepository.findOne({ id: currentUser.id }, { relations: ['permissions', 'groups', 'groups.permissions'] });;
|
||||
|
||||
const permissionControler = new PermissionController();
|
||||
|
|
Loading…
Reference in New Issue