Skip to content

feat(inventory): Allow assigning item expiry when adding inventory items#200

Draft
Daste745 wants to merge 1 commit into
mainfrom
feat/item-expiry
Draft

feat(inventory): Allow assigning item expiry when adding inventory items#200
Daste745 wants to merge 1 commit into
mainfrom
feat/item-expiry

Conversation

@Daste745
Copy link
Copy Markdown
Collaborator

Closes #188

@Daste745 Daste745 self-assigned this Sep 22, 2025
userId String
createdAt DateTime @default(now()) @db.Timestamp(6)
deletedAt DateTime? @db.Timestamp(6)
expiresAt DateTime? @db.Timestamp(6)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be default expiry time for Item model

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we allow overriding the default Item -> expiresAt with a null value?

I don't see any issues with this approach, it's up to moderator to specify that.

How do we comunicate to the user (admin) that an expiry will be added automatically?

image

Dodano item do ekwipunku user z datą wygaśniecią timestamp

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?
Copy link
Copy Markdown
Collaborator

@HKGx HKGx Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at this point I think we should consider splitting business logic and interface similarly how we handled Wallets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dodanie daty ważności do itemów w eq

2 participants