BusinessRules - BevvyTech/BrewskiDocs GitHub Wiki
- Users belong to one or more teams with roles
owner,admin, ormember(user_team_rolestable). - Removing members sets
deactivated = true; owners cannot be removed. - Owners and admins manage team settings and user profile details.
-
ordersstore financial totals in minor units. Remaining balance is derived astotal_minor - SUM(payments.amount_minor). - Each batch tracks a
brewerIdpointing to an active team member; the creator is assigned automatically but owners/admins can reassign it later. - Client contacts (
people) belong to a specific client and inherit that client's team permissions; adding/updating/deleting contacts emits marketing activity entries withtableName/itemIdfor future deep-links. - Creating a beer triggers a
productionactivity entry so ops can audit recipe changes. - Orders are flagged overdue when
status = confirmed,due_date < now(), and remaining balance > 0. - Default containers are seeded per team (e.g., 30 L Keg, 440 ml Can).
- Delivery signatures mark orders as
delivered(endpoint not yet implemented).
For full schema definitions see API/src/db/schema.ts.