Skip to content

Commit

Permalink
fix: CreateCustomProject validation does not apply the validations as…
Browse files Browse the repository at this point in the history
… they are done via class-validation in the controller.
  • Loading branch information
alepefe authored and andresgnlez committed Dec 12, 2024
1 parent 456eb83 commit a77482c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export class CustomProjectsController {
);
}

@TsRestHandler(customProjectContract.createCustomProject)
@TsRestHandler(customProjectContract.createCustomProject, {
validateRequestBody: false,
})
async create(
@Body(new ValidationPipe({ enableDebugMessages: true, transform: true }))
dto: CreateCustomProjectDto,
Expand Down
12 changes: 9 additions & 3 deletions shared/contracts/custom-projects.contract.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { initContract } from "@ts-rest/core";
import { ApiPaginationResponse, ApiResponse } from "@shared/dtos/global/api-response.dto";
import {
ApiPaginationResponse,
ApiResponse,
} from "@shared/dtos/global/api-response.dto";
import { Country } from "@shared/entities/country.entity";
import { ModelAssumptions } from "@shared/entities/model-assumptions.entity";
import { CustomProject } from "@shared/entities/custom-project.entity";
import { GetDefaultCostInputsSchema } from "@shared/schemas/custom-projects/get-cost-inputs.schema";
import { GetAssumptionsSchema } from "@shared/schemas/assumptions/get-assumptions.schema";

import { CreateCustomProjectSchema, InputCostsSchema } from "@shared/schemas/custom-projects/create-custom-project.schema";
import {
CreateCustomProjectSchema,
InputCostsSchema,
} from "@shared/schemas/custom-projects/create-custom-project.schema";
import { z } from "zod";
import { generateEntityQuerySchema } from "@shared/schemas/query-param.schema";
import { ActivityTypesDefaults } from "@shared/dtos/custom-projects/activity-types-defaults";
Expand Down Expand Up @@ -87,4 +93,4 @@ export const customProjectContract = contract.router({
},
});

// TODO: Due to dificulties crafting a deeply nested conditional schema, I will go forward with nestjs custom validation pipe for now
// TODO: Due to dificulties crafting a deeply nested conditional schema, I will go forward with nestjs custom validation pipe for now

0 comments on commit a77482c

Please sign in to comment.