Implemented permission updateing

ref #6
This commit is contained in:
2020-12-18 16:05:25 +01:00
parent ff3a5b4545
commit 882065470a
6 changed files with 113 additions and 22 deletions

View File

@@ -22,4 +22,15 @@ export class PermissionIdsNotMatchingError extends NotAcceptableError {
@IsString()
message = "The id's don't match!! \n And if you wanted to change a permission's id: This isn't allowed"
}
/**
* Error to throw when a permission get's provided without a principal.
*/
export class PermissionNeedsPrincipalError extends NotAcceptableError {
@IsString()
name = "PermissionNeedsPrincipalError"
@IsString()
message = "You provided no principal for this permission."
}

View File

@@ -0,0 +1,24 @@
import { IsString } from 'class-validator';
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
/**
* Error to throw when a user couldn't be found.
*/
export class PrincipalNotFoundError extends NotFoundError {
@IsString()
name = "PrincipalNotFoundError"
@IsString()
message = "Principal not found!"
}
/**
* Error to throw, when a provided runnerOrganisation doesn't belong to the accepted types.
*/
export class PrincipalWrongTypeError extends NotAcceptableError {
@IsString()
name = "PrincipalWrongTypeError"
@IsString()
message = "The princial must have an existing principal's id. \n You provided a object of another type."
}

View File

@@ -1,13 +0,0 @@
import { IsString } from 'class-validator';
import { NotFoundError } from 'routing-controllers';
/**
* Error to throw when a user couldn't be found.
*/
export class PrincipalNotFoundError extends NotFoundError {
@IsString()
name = "PrincipalNotFoundError"
@IsString()
message = "Principal not found!"
}