File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { oc } from "@orpc/contract" ;
22import { z } from "zod" ;
33import { CheckoutSchema } from "../schemas/checkout" ;
4+ import { CustomerSchema } from "../schemas/customer" ;
45import { CurrencySchema } from "../schemas/currency" ;
56import {
67 PaginationInputSchema ,
@@ -168,19 +169,7 @@ export const listCheckoutsContract = oc
168169 . output ( ListCheckoutsOutputSchema ) ;
169170
170171// MCP-specific embedded customer schema
171- const CheckoutCustomerSchema = z
172- . object ( {
173- id : z . string ( ) ,
174- name : z . string ( ) . nullable ( ) ,
175- email : z . string ( ) . nullable ( ) ,
176- emailVerified : z . boolean ( ) ,
177- externalId : z . string ( ) . nullable ( ) ,
178- userMetadata : z . record ( z . unknown ( ) ) . nullable ( ) ,
179- organizationId : z . string ( ) ,
180- createdAt : z . date ( ) ,
181- modifiedAt : z . date ( ) . nullable ( ) ,
182- } )
183- . nullable ( ) ;
172+ const CheckoutCustomerSchema = CustomerSchema . nullable ( ) ;
184173
185174// MCP-specific summary schema for list (simpler than full CheckoutSchema)
186175const CheckoutListItemSchema = z . object ( {
Original file line number Diff line number Diff line change @@ -7,15 +7,12 @@ import {
77 PaginationOutputSchema ,
88} from "../schemas/pagination" ;
99
10- // Order with related data for list view
10+ // Order with related data for list and get views
1111const OrderWithRelationsSchema = OrderSchema . extend ( {
1212 customer : CustomerSchema . nullable ( ) ,
1313 orderItems : z . array ( OrderItemSchema ) ,
1414} ) ;
1515
16- // Order with full details for get view
17- const OrderDetailSchema = OrderWithRelationsSchema ;
18-
1916const ListOrdersInputSchema = PaginationInputSchema . extend ( {
2017 customerId : z . string ( ) . optional ( ) ,
2118 status : z . string ( ) . optional ( ) , // Prisma uses String type for status
@@ -31,7 +28,7 @@ export const listOrdersContract = oc
3128
3229export const getOrderContract = oc
3330 . input ( z . object ( { id : z . string ( ) } ) )
34- . output ( OrderDetailSchema ) ;
31+ . output ( OrderWithRelationsSchema ) ;
3532
3633export const order = {
3734 list : listOrdersContract ,
You can’t perform that action at this time.
0 commit comments