Track and save on groceries

fix(api): fix meta for PageOptions

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>

+10 -5
+1 -1
packages/api/src/schema/brands.ts
··· 19 19 examples: [{ name: "Nopro" }], 20 20 }); 21 21 22 - export const BrandsQuery = pageOptions(Brand.shape.id); 22 + export const BrandsQuery = pageOptions(Brand, Brand.shape.id); 23 23 export const Brands = paginated(Brand);
+5 -2
packages/api/src/schema/pagination.ts
··· 5 5 export const Total = z.coerce.number().int().min(0); 6 6 export const Limit = z.coerce.number().int().min(0); 7 7 8 - export const pageOptions = <T extends z.ZodTypeAny>(cursor: T) => 8 + export const pageOptions = <T extends z.ZodType, C extends z.ZodType>( 9 + schema: T, 10 + cursor: C, 11 + ) => 9 12 z 10 13 .object({ 11 14 limit: Limit.default(DEFAULT_LIMIT), 12 15 cursor: cursor.optional(), 13 16 }) 14 17 .meta({ 15 - title: `${schemaTitle(cursor)}PageOptions`, 18 + title: `${schemaTitle(schema)}PageOptions`, 16 19 }); 17 20 18 21 export const paginated = <T extends z.ZodTypeAny>(item: T) =>
+1 -1
packages/api/src/schema/products.ts
··· 32 32 examples: [{ brandId: 1, name: "Not Milk 1l" }], 33 33 }); 34 34 35 - export const ProductsQuery = pageOptions(Product.shape.id); 35 + export const ProductsQuery = pageOptions(Product, Product.shape.id); 36 36 export const Products = paginated(Product);
+3 -1
packages/api/src/schema/stores.ts
··· 20 20 examples: [{ name: "Lee Deal" }], 21 21 }); 22 22 23 - export const StoresQuery = pageOptions(Store.shape.id); 23 + CreateStore.pick({}); 24 + 25 + export const StoresQuery = pageOptions(Store, Store.shape.id); 24 26 export const Stores = paginated(Store);