Skip to content

Commit

Permalink
Add router base conf
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Oct 11, 2024
1 parent ee691c0 commit 6f32ce9
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions shared/contracts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<JSONAPIError>(),
401: contract.type<JSONAPIError>(),
403: contract.type<JSONAPIError>(),
404: contract.type<JSONAPIError>(),
500: contract.type<JSONAPIError>(),
},
strictStatusCodes: true,
},
);

const baseRouterConfig = contract.router(
{ authContract, adminContract, usersContract },
{},
);

0 comments on commit 6f32ce9

Please sign in to comment.