namespace correction

This commit is contained in:
Wolfgang Koch
2021-05-14 11:32:50 +02:00
parent 24ad6090d2
commit f1927f184e
9 changed files with 108 additions and 122 deletions

View File

@@ -10,58 +10,56 @@ using {
namespace Z_bookshop.extension;
// extend existing entity
extend orders.Orders with {
Z_Customer : Association to one Z_Customers;
Z_SalesRegion : Association to one Z_SalesRegion;
Z_priority : String @assert.range enum {high; medium; low} default 'medium';
Z_Remarks : Composition of many Z_Remarks on Z_Remarks.Z_parent = $self;
// Z_Remarks : Composition of many Z_Remarks on Z_Remarks.parent = $self;
}
// new entity - as association target
entity Z_Customers // : cuid, managed
entity Z_Customers : cuid, managed
{
key Z_ID : UUID; // workaround
Z_email : String;
Z_firstName : String;
Z_lastName : String;
Z_creditCardNo : String;
Z_dateOfBirth : Date;
Z_status : String @assert.range enum {platinum; gold; silver; bronze} default 'bronze';
Z_creditScore : Decimal @assert.range: [ 1.0, 100.0 ] default 50.0;
Z_PostalAddresses : Composition of many Z_CustomerPostalAddresses on Z_PostalAddresses.Z_Customer = $self;
email : String;
firstName : String;
lastName : String;
creditCardNo : String;
dateOfBirth : Date;
status : String @assert.range enum {platinum; gold; silver; bronze} default 'bronze';
creditScore : Decimal @assert.range: [ 1.0, 100.0 ] default 50.0;
PostalAddresses : Composition of many Z_CustomerPostalAddresses on PostalAddresses.Customer = $self;
}
// new unique constraint (secondary index)
annotate Z_Customers with @assert.unique: { Z_email: [ Z_email ] }
annotate Z_Customers with @assert.unique: { email: [ email ] }
{
Z_email @mandatory; // mandatory check
email @mandatory; // mandatory check
}
// new entity - as composition target
entity Z_CustomerPostalAddresses // :
entity Z_CustomerPostalAddresses : cuid, managed
{
key Z_ID : UUID; // workaround
Z_Customer : Association to one Z_Customers;
Z_description : String;
Z_street : String;
Z_town : String;
Z_country : Country;
Customer : Association to one Z_Customers;
description : String;
street : String;
town : String;
country : Country;
}
// new entity - as code list
entity Z_SalesRegion: CodeList {
key Z_regionCode : String(11);
key regionCode : String(11);
}
// new entity - as composition target
entity Z_Remarks // : cuid, managed
entity Z_Remarks : cuid, managed
{
key Z_ID : UUID; // workaround
Z_parent : Association to one orders.Orders;
// number : Integer; // try without Z_
Z_number : Integer;
Z_remarksLine : String;
parent : Association to one orders.Orders;
number : Integer;
remarksLine : String;
}