Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/auto-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Auto-create PR on push to dev

on:
push:
branches:
- dev

jobs:
create-pr:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- uses: actions/checkout@v4

- name: Create Pull Request if not exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
EXISTING=$(gh pr list --base main --head dev --json number --jq '.[0].number')
if [ -z "$EXISTING" ]; then
gh pr create \
--base main \
--head dev \
--title "Sprint 5: Price, Expiry, and Supplier Tracking" \
--body "## Changes\n- Added price field with total inventory value on dashboard\n- Added expiration date tracking with expiring-soon alerts\n- Added supplier tracking\n- Added 'Add Expiring Soon Items' button in Receive Delivery\n- Updated seed data with real-world supplier names"
else
echo "PR #$EXISTING already exists, skipping."
fi
49 changes: 49 additions & 0 deletions doc/sprint 5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Sprint 5 Ceremony Minutes

Date: 2026-04-29

## Members Present

- Dustin De Luna
- Jared Miller
- Nnaemeka Onochie

---

## Demo

This sprint, we completed:

- Added price field to inventory items with total inventory value displayed on the dashboard
- Added expiration date tracking with visual alerts for items expiring within 7 days
- Added Supplier tracking field to all inventory items
- Updated seed data with real-world supplier names (Prairie Farms, Kroger, Great Value, Kirkland, Tech, Target Essentials)
- Wrote `doc/sprint5.md`

---

## Screenshots

Here are screenshots of what we did:
![alt text](<../images/Screenshot 2026-04-29 at 11.03.18 PM.png>)

---

## Retro

### What Went Well

- Price and expiration date features add real business value to the app
- Supplier tracking helps contextualize inventory data
- Dashboard summary bar now shows total inventory value and expiring-soon count at a glance

### What Could Be Improved

- UI polish and consistency could be improved
- The Delivery transaction type is currently logged as UPDATE in transaction history

### Actionable Commitments

- As a team, we will fix the DELIVERY transaction type logging and continue improving the UI

---
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 69 additions & 7 deletions src/main/java/com/inventory/model/Item.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package com.inventory.model;

import java.time.LocalDate;

public class Item {

private final String id;
private final String name;
private final String category;
private int quantity;
private final String location;
private double price;
private String expiresAt; // "YYYY-MM-DD" or null/empty = no expiry
private String supplier;

private int lowStockThreshold = 5;

public Item(String id, String name, String category, int quantity, String location) {

public Item(String id, String name, String category, int quantity, String location,
double price, String expiresAt, String supplier) {
if (quantity < 0) {
throw new IllegalArgumentException("Quantity must not be negative.");
}
Expand All @@ -19,13 +25,46 @@ public Item(String id, String name, String category, int quantity, String locati
this.category = category;
this.quantity = quantity;
this.location = location;
this.price = price;
this.expiresAt = expiresAt;
this.supplier = supplier;
}

public Item(String id, String name, String category, int quantity, String location) {
this(id, name, category, quantity, location, 0.0, null, null);
}

public String getId() {
return id;
}

public String getName() {
return name;
}

public String getCategory() {
return category;
}

public int getQuantity() {
return quantity;
}

public String getLocation() {
return location;
}

public double getPrice() {
return price;
}

public String getExpiresAt() {
return expiresAt;
}

public String getId() { return id; }
public String getName() { return name; }
public String getCategory() { return category; }
public int getQuantity() { return quantity; }
public String getLocation() { return location; }
public String getSupplier() {
return supplier;
}

public int getLowStockThreshold() {
return lowStockThreshold;
Expand All @@ -45,10 +84,33 @@ public void setQuantity(int quantity) {
this.quantity = quantity;
}

public void setPrice(double price) {
this.price = price;
}

public void setExpiresAt(String expiresAt) {
this.expiresAt = expiresAt;
}

public void setSupplier(String supplier) {
this.supplier = supplier;
}

public boolean isLowStock() {
return quantity <= lowStockThreshold;
}

public boolean isExpiringSoon() {
if (expiresAt == null || expiresAt.isEmpty())
return false;
try {
LocalDate expiry = LocalDate.parse(expiresAt);
return !expiry.isAfter(LocalDate.now().plusDays(7));
} catch (Exception e) {
return false;
}
}

@Override
public String toString() {
return "Item{id='" + id + "', name='" + name + "', category='" + category
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/com/inventory/model/ItemFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@
public class ItemFactory {

/**
* Creates a new Item with an auto-generated unique ID.
* Creates a new Item with an auto-generated unique ID
*/
public static Item createItem(String name, String category, int quantity, String location) {
String id = UUID.randomUUID().toString().substring(0, 8).toUpperCase();
return new Item(id, name, category, quantity, location);
}

/**
* Creates a new Item with price, expiry date, and supplier.
*/
public static Item createItem(String name, String category, int quantity, String location,
double price, String expiresAt, String supplier) {
String id = UUID.randomUUID().toString().substring(0, 8).toUpperCase();
return new Item(id, name, category, quantity, location, price, expiresAt, supplier);
}
}
Loading
Loading