diff --git a/shared/contracts/index.ts b/shared/contracts/index.ts index f90acfbf..4321f1be 100644 --- a/shared/contracts/index.ts +++ b/shared/contracts/index.ts @@ -2,11 +2,29 @@ import { initContract } from "@ts-rest/core"; import { adminContract } from "@shared/contracts/admin.contract"; import { authContract } from "@shared/contracts/auth.contract"; import { usersContract } from "@shared/contracts/users.contract"; +import { JSONAPIError } from "@shared/dtos/json-api.error"; const contract = initContract(); -export const router = contract.router({ - auth: authContract, - admin: adminContract, - user: usersContract, -}); +export const router = contract.router( + { + auth: authContract, + admin: adminContract, + user: usersContract, + }, + { + commonResponses: { + 400: contract.type(), + 401: contract.type(), + 403: contract.type(), + 404: contract.type(), + 500: contract.type(), + }, + strictStatusCodes: true, + }, +); + +const baseRouterConfig = contract.router( + { authContract, adminContract, usersContract }, + {}, +);