Key Model Overview
CaterCow Models
CaterCow's models are designed to manage a multi-sided marketplace connecting customers, restaurant partners (brands), and administrators.
The core concepts revolve around:
- Users & Groups (
users,teams,enterprises): Manages individual users, the teams they belong to for group ordering, and larger enterprise accounts with specific billing rules. - Restaurants (
restaurant_groups,brands,kitchens): A hierarchical model for food providers. Arestaurant_groupcan own multiplebrands, and eachbrandcan operate out of one or more physicalkitchens. - Menus (
restaurant_menus,menu_items,modifier_groups): A detailed and flexible menu system. These items can have extensive customizations throughmodifier_groups. - Packages (
packages,package_items,package_item_options,collections): Brands offerpackages(curated meals) which are built from a subset of a brand'smenu_itemswhich make ordering for large groups seamless and efficient. - Orders (
orders,order_items,addresses,reviews): The complete lifecycle of an order, from placement and polling for individual choices within a group to fulfillment, delivery, and post-order reviews. - Group Orders (
order_polls,poll_selections,poll_options): An important feature that allows organizers to collect feedback from their teams and have food delivered individually labeled with everyone's name attached. - Financials (
payments,invoices,payouts,coupons): Manages all financial transactions, including customer payments via card or invoice, payouts to restaurant partners, and promotional coupon redemptions.
Key Model Overview
Order Model (orders table)
The Order model is the central hub of the application, connecting almost every other major entity. It represents a single transaction for a catering or delivery service placed by a customer.
Key Interactions:
- User/Team: An
Orderis initiated by auser(user_id) and can be associated with ateam(team_id) for group billing and tracking. It can also be linked to a largerenterprisefor corporate accounts. - Brand/Kitchen: Each
Orderis fulfilled by a specificbrand(brand_id) and a physicalkitchen(kitchen_id). This defines who is responsible for preparing and providing the food. - Package: An
Orderis frequently (but not always) for a specificpackage(package_id), which dictates the core meal being provided. - Order Details: It contains essential fulfillment details such as the delivery date and time (
start_date,start_time), delivery address (address_id), headcount, and special instructions. - Financials: The
Orderis the basis for financial records. It links topayments(how the customer paid),invoices(if billed),tips, and any appliedcoupons. - Group Coordination (
order_polls): For group meals, anOrdercan have an associatedorder_poll. This allows individual team members to make their specific meal selections (e.g., choosing their sandwich flavor), which are then consolidated into the final order. - Feedback: After fulfillment, an
Ordercan have associatedreviewsandorder_issues, providing feedback to the brand and CaterCow.
Team Model (teams table)
The Team model is designed to facilitate B2B group ordering, representing a collection of users (e.g., a department within a company).
Key Interactions:
- Users (
membershipstable): ATeamis composed of multipleusersthrough themembershipstable, which defines each user's role within the team (e.g., administrator, member). A team has a designatedowner_id. - Ordering: Teams place
orderscollectively. Theteam_idon an order links it back to the team, allowing for shared billing and order history. - Payment: A
Teamcan have sharedcredit_cardsand is often configured to beinvoiceable, streamlining corporate payment processes. - Enterprises: A
Teamcan be part of a largerenterprise, inheriting rules like purchase order requirements (purchase_orders), cost center tracking, and specific fee structures. - Order Coordination: The team structure is fundamental to the
order_pollssystem, enabling a single order to be customized by many individual members of the team. - Customization: Teams can have their own settings, such as default addresses, logos, and specific invoicing contacts (
team_contacts).
Brand Model (brands table)
The Brand model represents the primary restaurant or caterer entity on CaterCow. It's the customer-facing identity that users browse and order from.
Key Interactions:
- Hierarchy: A
Brandbelongs to arestaurant_group, which might manage several distinct restaurant concepts. ABranditself can operate out of multiple physicalkitchens. - Menu Offerings: This is the root for a caterer's menu. A
Brandofferspackages(e.g., "The Sandwich Lunch Box") and maintains comprehensiverestaurant_menuscomposed of individualmenu_itemsandmodifier_groups. - Orders: When a customer places an order, it is fulfilled by a
brand. CaterCow tracks a brand's performance throughcaterer_metrics,caterer_scores, and customerreviews. - Operations: The
Brandtable stores key operational details like cancellation policies, lead time for orders (lead_time_hours), and whether it participates in specialized programs like batched delivery. - Onboarding & Vetting: The schema includes extensive fields and related tables (
restaurant_applications,screening_responses) to manage the onboarding, vetting, and approval process for new restaurant partners.