Skip to content

Commit

Permalink
assigneeをitemが持つ
Browse files Browse the repository at this point in the history
  • Loading branch information
toririm committed Sep 20, 2024
1 parent 2badeac commit d22be3f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const itemSchema = z.object({
required_error: "種類が未選択です",
invalid_type_error: "不正な種類です",
}),
assignee: z.string().nullable(),
});

export type Item = z.infer<typeof itemSchema>;
Expand All @@ -33,10 +34,11 @@ export class ItemEntity implements Item {
public readonly name: string,
public readonly price: number,
public readonly type: ItemType,
public assignee: string | null = null,
) {}

static createNew({ name, price, type }: Item): ItemEntity {
return new ItemEntity(undefined, name, price, type);
return new ItemEntity(undefined, name, price, type, null);
}

static fromItem(item: WithId<Item>): WithId<ItemEntity> {
Expand Down

0 comments on commit d22be3f

Please sign in to comment.