|
|
|
## DTO
|
|
|
|
|
|
|
|
All DTOs use [`class-validator`](https://github.com/typestack/class-validator) for validation. A [`ValidationPipe`](./shared#validationpipets) decorator is needed in the controllers to trigger the validation.
|
|
|
|
|
|
|
|
`ValidateNested()` and `Type(() => DTO)` is needed for ValidationPipe to validate nested DTOs.
|
|
|
|
|
|
|
|
? in the key's name means, that the key-value pair is optional.
|
| ... | ... | @@ -249,3 +251,18 @@ export class GeoDTO { |
|
|
|
time: number;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### NotificationDTO
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
export class NotificationdDTO {
|
|
|
|
// alert is for serious messages, note is for smaller updates on a situation
|
|
|
|
@IsIn(["alert", "note"])
|
|
|
|
type: string;
|
|
|
|
@IsString()
|
|
|
|
@Length(0, 63)
|
|
|
|
message: string;
|
|
|
|
@IsUUID("4")
|
|
|
|
game: string;
|
|
|
|
}
|
|
|
|
``` |