@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
114 lines • 4.79 kB
JavaScript
import { z } from 'zod';
import { BaseGetParamsSchema, BaseResponseSchema } from '../../../core/schemas';
import { PickTicketSchema } from './orders';
// Quote line schema - based on Quotes.json
export const QuoteLineSchema = z.object({
invMastUid: z.number(),
cancelFlag: z.enum(['Y', 'N']).nullable(),
complete: z.enum(['Y', 'N']).nullable(),
deleteFlag: z.enum(['Y', 'N']).nullable(),
disposition: z.string().nullable(),
itemDesc: z.string().nullable(),
displayDesc: z.string().nullable(),
itemId: z.string().nullable(),
lineNo: z.number().nullable(),
orderNo: z.string().nullable(),
originalQtyOrdered: z.number().nullable(),
qtyAllocated: z.number().nullable(),
qtyCanceled: z.number().nullable(),
qtyInvoiced: z.number().nullable(),
qtyOnPickTickets: z.number().nullable(),
qtyOrdered: z.number().nullable(),
unitOfMeasure: z.string().nullable(),
unitQuantity: z.number().nullable(),
unitSize: z.string().nullable(),
unitPrice: z.number().nullable(),
extendedPrice: z.number().nullable(),
trinityItemId: z.string().nullable(),
trinityItemDesc: z.string().nullable(),
agentItemId: z.string().nullable(),
agentItemDesc: z.string().nullable(),
});
// Quote document schema - based on Quotes.json
export const QuoteDocumentSchema = z.object({
orderNo: z.string(),
customerId: z.number(),
customerName: z.string(),
jobName: z.string().nullable(),
orderDate: z.string().nullable(), // Y-m-d format
requestedDate: z.string().nullable(), // Y-m-d format
completed: z.enum(['Y', 'N']).nullable(),
poNo: z.string().nullable(),
ship2Name: z.string().nullable(),
ship2Add1: z.string().nullable(),
ship2Add2: z.string().nullable(),
ship2Add3: z.string().nullable(),
ship2City: z.string().nullable(),
ship2State: z.string().nullable(),
ship2Zip: z.string().nullable(),
ship2Country: z.string().nullable(),
ship2EmailAddress: z.string().nullable(),
shipToPhone: z.string().nullable(),
deliveryInstructions: z.string().nullable(),
class1Id: z.string().nullable(),
class2Id: z.string().nullable(),
class3Id: z.string().nullable(),
class4Id: z.string().nullable(),
class5Id: z.string().nullable(),
contactId: z.string().nullable(),
webReferenceNo: z.string().nullable(),
orderStatus: z.enum(['PENDING', 'SHIPPED', 'ON HOLD', 'IN PROCESS', 'SUBMITTED']),
taker: z.string().nullable(),
contactFirstName: z.string().nullable(),
contactLastName: z.string().nullable(),
carrierId: z.number().nullable(),
carrierName: z.string(),
lines: z.array(QuoteLineSchema),
pickTickets: z.array(PickTicketSchema),
});
// Quote list item schema - based on Quotes.json
export const QuoteListItemSchema = z.object({
orderNo: z.string().max(8),
customerId: z.number(),
customerName: z.string().max(255).nullable(),
jobName: z.string().max(40).nullable(),
orderDate: z.string().nullable(), // Y-m-d format
requestedDate: z.string().nullable(), // Y-m-d format
completed: z.string().max(1).nullable(),
poNo: z.string().max(50).nullable(),
orderStatus: z.string(),
taker: z.string().max(30).nullable(),
webReferenceNo: z.string().max(255).nullable(),
ship2Name: z.string().max(50).nullable(),
ship2Add1: z.string().max(50).nullable(),
ship2Add2: z.string().max(50).nullable(),
ship2Add3: z.string().max(50).nullable(),
ship2City: z.string().max(50).nullable(),
ship2State: z.string().max(50).nullable(),
ship2Zip: z.string().max(10).nullable(),
ship2Country: z.string().max(50).nullable(),
ship2EmailAddress: z.string().max(255).nullable(),
shipToPhone: z.string().max(20).nullable(),
deliveryInstructions: z.string().max(255).nullable(),
class1Id: z.string().max(8).nullable(),
class2Id: z.string().max(8).nullable(),
class3Id: z.string().max(8).nullable(),
class4Id: z.string().max(8).nullable(),
class5Id: z.string().max(8).nullable(),
contactId: z.string().max(16).nullable(),
contactFirstName: z.string().nullable(),
contactLastName: z.string().nullable(),
carrierId: z.number().nullable(),
carrierName: z.string().nullable(),
lines: z.array(QuoteLineSchema),
pickTickets: z.array(PickTicketSchema),
});
export const QuoteListParamsSchema = BaseGetParamsSchema.extend({
limit: z.coerce.number().optional(),
offset: z.coerce.number().optional(),
orderBy: z.string().optional(),
});
// Response schemas using BaseResponseSchema (8-field format)
export const QuoteListResponseSchema = BaseResponseSchema(z.array(QuoteListItemSchema));
export const QuoteResponseSchema = BaseResponseSchema(QuoteDocumentSchema);
//# sourceMappingURL=quotes.js.map