import z from "zod/v4"; import { CreateStore, Store, Stores, StoresQuery } from "../schema/stores.js"; import { base } from "./base.js"; export const listStore = base .route({ method: "GET", path: "/stores", }) .input( z.object({ query: StoresQuery, }), ) .output( z.object({ status: z.literal(200).describe("stores found"), body: Stores, }), ); export const getStore = base .route({ method: "GET", path: "/stores/:id", }) .input( z.object({ params: Store.pick({ id: true, }), }), ) .output( z.object({ status: z.literal(200).describe("store found"), body: Store, }), ) .errors({ NOT_FOUND: {}, }); export const createStore = base .route({ method: "POST", path: "/stores", }) .input( z.object({ body: CreateStore, }), ) .output( z.object({ status: z.literal(201).describe("store created"), body: Store, }), ); export const deleteStore = base .route({ method: "DELETE", path: "/stores/:id", }) .input( z.object({ params: Store.pick({ id: true, }), }), ) .output( z.object({ status: z.literal(204).describe("store deleted"), }), ); export const storeContract = { list: listStore, get: getStore, create: createStore, delete: deleteStore, };