Skip to content

Commit d01b663

Browse files
committed
fix mi typecheck
1 parent 1c26896 commit d01b663

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

lambdas/api-handler/src/contracts/mi.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ export const GetMIResponseResourceSchema = z
4545
})
4646
.strict();
4747

48+
// export const GetMIResponseResourceSchema = z
49+
// .object({
50+
// id: z.string(),
51+
// type: z.literal("ManagementInformation"),
52+
// attributes: z
53+
// .object({
54+
// lineItem: z.string(),
55+
// timestamp: z.string(),
56+
// quantity: z.number(),
57+
// specificationId: z.string().optional(),
58+
// groupId: z.string().optional(),
59+
// stockRemaining: z.number().optional(),
60+
// })
61+
// .strict(),
62+
// })
63+
// .strict();
64+
4865
export const GetMIResponseSchema = makeDocumentSchema(
4966
GetMIResponseResourceSchema,
5067
);

lambdas/api-handler/src/mappers/mi-mapper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { MIBase } from "@internal/datastore/src";
22
import {
33
GetMIResponse,
4-
GetMIResponseResourceSchema,
4+
GetMIResponseSchema,
55
IncomingMI,
66
PostMIRequest,
77
PostMIResponse,
@@ -36,8 +36,9 @@ export function mapToPostMIResponse(mi: MIBase): PostMIResponse {
3636
}
3737

3838
export function mapToGetMIResponse(mi: MIBase): GetMIResponse {
39-
return GetMIResponseResourceSchema.parse({
39+
return GetMIResponseSchema.parse({
4040
data: {
41+
id: mi.id,
4142
type: "ManagementInformation",
4243
attributes: {
4344
lineItem: mi.lineItem,
@@ -47,7 +48,6 @@ export function mapToGetMIResponse(mi: MIBase): GetMIResponse {
4748
groupId: mi.groupId,
4849
stockRemaining: mi.stockRemaining,
4950
},
50-
id: mi.id,
5151
},
5252
});
5353
}

0 commit comments

Comments
 (0)