BusinessRules - BevvyTech/BrewskiDocs GitHub Wiki

Business Rules & Domain Concepts

  • Users belong to one or more teams with roles owner, admin, or member (user_team_roles table).
  • Removing members sets deactivated = true; owners cannot be removed.
  • Owners and admins manage team settings and user profile details.
  • orders store financial totals in minor units. Remaining balance is derived as total_minor - SUM(payments.amount_minor).
  • Each batch tracks a brewerId pointing 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 with tableName/itemId for future deep-links.
  • Creating a beer triggers a production activity 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.

⚠️ **GitHub.com Fallback** ⚠️