Skip to content

Commit

Permalink
JSON.stringifyで""がnullに変換されるのでスキーマ修正 (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
toririm authored Sep 23, 2024
1 parent 9e00a00 commit 4cd82d9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/models/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const orderSchema = z.object({
items: z.array(itemSchema.required()),
total: z.number(),
orderReady: z.boolean(),
description: z.string(),
description: z.string().nullable(),
});

export type Order = z.infer<typeof orderSchema>;
Expand All @@ -25,7 +25,7 @@ export class OrderEntity implements Order {
private _items: WithId<ItemEntity>[],
private _total: number,
private _orderReady: boolean,
private _description: string,
private _description: string | null,
) {}

static createNew({ orderId }: { orderId: number }): OrderEntity {
Expand All @@ -37,7 +37,7 @@ export class OrderEntity implements Order {
[],
0,
false,
"",
null,
);
}

Expand Down Expand Up @@ -96,7 +96,7 @@ export class OrderEntity implements Order {
get description() {
return this._description;
}
set description(description: string) {
set description(description: string | null) {
this._description = description;
}

Expand Down

0 comments on commit 4cd82d9

Please sign in to comment.