feat(inventory): Allow assigning item expiry when adding inventory items#200
feat(inventory): Allow assigning item expiry when adding inventory items#200Daste745 wants to merge 1 commit into
Conversation
| userId String | ||
| createdAt DateTime @default(now()) @db.Timestamp(6) | ||
| deletedAt DateTime? @db.Timestamp(6) | ||
| expiresAt DateTime? @db.Timestamp(6) |
There was a problem hiding this comment.
I think there should be default expiry time for Item model
There was a problem hiding this comment.
Sounds reasonable, but adds more complexity. Do we allow overriding the default Item -> expiresAt with a null value? How do we comunicate to the user (admin) that an expiry will be added automatically?
There was a problem hiding this comment.
There was a problem hiding this comment.
Hmm alright. Maybe the default expiry could also be comunicated via the item autocomplete when adding inventory items.
| let expiresAt: Date | null = null; | ||
| if (rawExpiresAt) { | ||
| // TODO)) Parse date in our TZ | ||
| // TODO)) Should the item expire at the start or end of the selected day? |
There was a problem hiding this comment.
we probably should obey the same logic as we do when parsing durations
| "Nie", | ||
| async () => { | ||
| const inventoryItem = await prisma.$transaction(async (tx) => { | ||
| // TODO)) Don't let users transfer expired items |
There was a problem hiding this comment.
at this point I think we should consider splitting business logic and interface similarly how we handled Wallets

Closes #188