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:

  1. User-Restaurant:

    • Users can create restaurants (as owners)
    • One user can create multiple restaurants
    • Each restaurant has one owner
  2. User-Review:

    • Users write reviews
    • One user can write multiple reviews
    • Each review has one author
  3. Restaurant-Review:

    • Restaurants contain reviews
    • One restaurant can have multiple reviews
    • Each review belongs to one restaurant
  4. 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 User can create restaurants and write reviews with basic profile info
  • Each Restaurant has core details, ratings, photos, and nested structures
  • A Review includes content, 1-5 star rating, and photos within 48hr edit window
  • Supporting objects like Address and OperatingHours help organize data
© 2026 Devtiro Ltd. All rights reserved