OrderDocument

@MappedEntity
data class OrderDocument(val id: String, val orderType: String, val restaurantId: String, val customerId: String, val status: String, val items: List<OrderItemDocument>, val deliveryInfo: DeliveryInfoDocument? = null, val tableInfo: TableInfoDocument? = null, val takeawayInfo: TakeawayInfoDocument? = null)

Represents the MongoDB document for storing order information.

Since orderType is a sealed hierarchy with three subtypes, this document uses a discriminator field orderType plus mutually-exclusive optional fields to flatten the hierarchy into a single MongoDB collection.

Constructors

Link copied to clipboard
constructor(id: String, orderType: String, restaurantId: String, customerId: String, status: String, items: List<OrderItemDocument>, deliveryInfo: DeliveryInfoDocument? = null, tableInfo: TableInfoDocument? = null, takeawayInfo: TakeawayInfoDocument? = null)

Properties

Link copied to clipboard

The identifier of the customer who placed the order.

Link copied to clipboard

Populated only when orderType is DELIVERY.

Link copied to clipboard
@Id
val id: String

The unique identifier for the order document. This is the primary key.

Link copied to clipboard

The list of items embedded within the order.

Link copied to clipboard

Discriminator indicating which String subtype this document represents.

Link copied to clipboard

The identifier of the restaurant the order belongs to.

Link copied to clipboard

The current status of the order (e.g., "PENDING", "PREPARING").

Link copied to clipboard

Populated only when orderType is DINE_IN.

Link copied to clipboard

Populated only when orderType is TAKEAWAY.

Functions

Link copied to clipboard

Converts an OrderDocument to an Order domain model.