Domain Overview
Let's analyze the domain objects that will form the foundation of our restaurant review platform.
We'll identify the key entities and their relationships by examining our project requirements.
Core Domain Objects
Through analysis of the project brief, we can identify several key domain objects:
User
The User object represents registered users of the platform. We're keeping this minimal since authentication will be handled by Keycloak:
- Basic identification (ID, name, email)
- Can create restaurants (as an owner)
- Can write reviews for restaurants
Restaurant
The Restaurant entity is central to our platform:
- Core details (name, cuisine type, contact information)
- Average rating (calculated from reviews)
- Contains complex nested objects:
- Address (including geolocation)
- Operating hours
- Photos
- Reviews
Review
Reviews capture user experiences:
- Written content
- Numerical rating (1-5 stars)
- Metadata (author, posting date, last edit date)
- Can include multiple photos
- Editable within 48 hours of posting
Supporting Objects
Several supporting objects help organize our domain:
Address
- Structured representation of location
- Contains street number, street name, unit, city, state, postal code
- Includes geolocation data (latitude/longitude) for mapping
Operating Hours
- Structured as daily time ranges
- Separate open/close times for each day of the week
- Allows for different schedules per day
Photo
- URL to stored image
- Additional metadata (caption, upload date)
- Can be associated with restaurants or reviews
Domain Relationships
The relationships between these objects create our domain structure:
-
User-Restaurant:
- Users can create restaurants (as owners)
- One user can create multiple restaurants
- Each restaurant has one owner
-
User-Review:
- Users write reviews
- One user can write multiple reviews
- Each review has one author
-
Restaurant-Review:
- Restaurants contain reviews
- One restaurant can have multiple reviews
- Each review belongs to one restaurant
-
Complex Object Relationships:
- Restaurant contains one Address
- Address contains one GeoLocation
- Restaurant contains one OperatingHours
- OperatingHours contains seven TimeRange objects (one per day)
- Reviews can contain multiple Photos
Elasticsearch Considerations
Given our focus on search functionality, our domain model has been influenced by Elasticsearch requirements:
- Restaurant will be a top-level document
- Other objects (Address, Reviews, Photos, etc.) will be nested within these documents
- This structure optimizes for search operations while maintaining relationship integrity
Summary
- The
Usercan create restaurants and write reviews with basic profile info - Each
Restauranthas core details, ratings, photos, and nested structures - A
Reviewincludes content, 1-5 star rating, and photos within 48hr edit window - Supporting objects like
AddressandOperatingHourshelp organize data