(value: CatDTO, metadata: ArgumentMetadata)
| 11 | private errorString = 'Incoming cat is not formated correctly. '; |
| 12 | |
| 13 | transform(value: CatDTO, metadata: ArgumentMetadata) { |
| 14 | if (!value.age && typeof value.age !== 'number') { |
| 15 | throw new BadRequestException(this.errorString + 'Age must be a number.'); |
| 16 | } |
| 17 | if (!value.name && typeof value.name !== 'string') { |
| 18 | throw new BadRequestException( |
| 19 | this.errorString + 'Name must be a string.', |
| 20 | ); |
| 21 | } |
| 22 | if (!value.breed && typeof value.breed !== 'string') { |
| 23 | throw new BadRequestException( |
| 24 | this.errorString + 'Breed must be a string.', |
| 25 | ); |
| 26 | } |
| 27 | return value; |
| 28 | } |
| 29 | } |
no outgoing calls
no test coverage detected