io.zenwave360.sdk.resources.jdl.orders-model-semantic-annotations.jdl Maven / Gradle / Ivy
/* Customers */
@aggregate
@search(elasticsearch)
@searchCriteria // self-defined criteria
entity Customer {
username String required minlength(3) maxlength(250),
password String required minlength(3) maxlength(250),
email String required minlength(3) maxlength(250),
firstName String required minlength(3) maxlength(250),
lastName String required minlength(3) maxlength(250)
}
/* Orders */
@aggregate
@searchCriteria(OrderSearchCriteria)
entity CustomerOrder { // Order is a reserved word
date Instant,
status OrderStatus
customer Customer
orderedItems OrderedItem[]
paymentDetails PaymentDetails[]
shippingDetails ShippingDetails
}
enum OrderStatus { CONFIRMED, SHIPPED, DELIVERED }
@skip
entity OrderSearchCriteria {
status OrderStatus
dateFrom Instant
dateTo Instant
}
@embedded
entity OrderedItem {
catalogItemId Long,
name String required minlength(3) maxlength(250),
price BigDecimal required,
quantity Integer
}
@embedded
entity PaymentDetails {
creditCardNumber String
}
@embedded
entity ShippingDetails {
address String
}
service Customer with CustomerUseCases
service CustomerOrder with CustomerOrderUseCases