-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a2ba9a
commit 9a99209
Showing
9 changed files
with
53 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
apps/api/src/common/exceptions/UnprocessableEntityException.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {HandlerError} from './HandlerError'; | ||
|
||
export abstract class UnprocessableEntityException< | ||
Args extends Record<string, string | number> | void = void, | ||
> extends HandlerError<Args> { | ||
statusCode = HandlerError.httpStatusCode.HTTP_STATUS_UNPROCESSABLE_ENTITY; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
abstract createMessage(args: Args): string; | ||
} |
16 changes: 16 additions & 0 deletions
16
apps/api/src/modules/preset/exceptions/ExceedPresetLimitException.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {UnprocessableEntityException} from '../../../common/exceptions/UnprocessableEntityException'; | ||
|
||
export class ExceedPresetLimitException extends UnprocessableEntityException<{ | ||
limit: number; | ||
}> { | ||
limit: number; | ||
|
||
constructor(options: {limit: number}) { | ||
super(); | ||
this.limit = options.limit; | ||
} | ||
|
||
createMessage(): string { | ||
return `Preset limit per account exceeded`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import {FastifyInstance} from 'fastify'; | ||
import {PresetMapper} from '../mapper'; | ||
import {PresetRepository} from '../repository'; | ||
|
||
export type PresetHandlerDependencies = { | ||
repository: PresetRepository; | ||
mapper: PresetMapper; | ||
config: FastifyInstance['config']; | ||
logger: FastifyInstance['log']; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters