https://docs.nestjs.com/techniques/validation
Es scheint so funktioniert so, dass ich entsprechende Fehlermeldungen erhalte, wenn ich Felder weglasse. Nur meckert es auch, wenn ich sie nicht weglasse. Unten ist mein Code für den Endpunkt:
Code: Select all
@Post('heatMap')
async getOrCreateHeatMap(@Body() heatMap: HeatMapGetOrCreate) {
const getHeatMap = await this.graphService.getHeatMapByFields(heatMap);
if (getHeatMap) {
return getHeatMap;
} else {
// return this.graphService.createHeatMap(name, complexity, repositoryId);
}
}
Code: Select all
export class HeatMapGetOrCreate {
@IsNotEmpty()
name!: string;
@IsNotEmpty()
complexity!: number;
@IsNotEmpty()
repositoryId!: string;
}