enhance example

This commit is contained in:
Wolfgang Koch
2020-11-10 11:15:16 +01:00
parent b8f0f5e2f9
commit 77aa129bbf
4 changed files with 44 additions and 15 deletions

View File

@@ -2,7 +2,7 @@
using { sap.capire.bookshop.Books } from '@capire/bookshop';
using { sap.capire.bookshop.Orders } from '@capire/orders';
using { sap.capire.bookshop.OrderItems } from '@capire/orders';
using { Currency, managed, cuid } from '@sap/cds/common';
using { Currency, Country, managed, cuid } from '@sap/cds/common';
namespace sap.capire.bookshop;
@@ -10,11 +10,42 @@ extend Orders with {
Customer : Association to Customers;
}
entity Customers : managed {
key ID : UUID;
entity Customers : cuid, managed {
email : String;
firstName : String;
lastName : String;
creditCardNo : String;
dateOfBirth : Date;
}
}
entity CustomerPostalAddress : cuid, managed {
Customer : Association to one Customers;
street : String(128);
town : String(128);
country : Country;
someOtherField : String(128);
};
// annotations for Data Privacy
annotate Customers with @PersonalData.EntitySemantics: 'DataSubject'
{
ID @PersonalData.FieldSemantics: 'DataSubjectID';
emailAddress @PersonalData.IsPotentiallyPersonal;
firstName @PersonalData.IsPotentiallyPersonal;
lastName @PersonalData.IsPotentiallyPersonal;
creditCardNo @PersonalData.IsPotentiallySensitive;
}
annotate CustomerPostalAddress with @PersonalData.EntitySemantics: 'DataSubjectDetails'
{
Customer @PersonalData.FieldSemantics: 'DataSubjectID';
street @PersonalData.IsPotentiallyPersonal;
town @PersonalData.IsPotentiallyPersonal;
country @PersonalData.IsPotentiallyPersonal;
}
// annotations for Audit Log
annotate Customers with @AuditLog.Operation: {Read: true, Insert: true, Update: true, Delete: true};
annotate CustomerPostalAddress with @AuditLog.Operation: {Read: true, Insert: true, Update: true, Delete: true};