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,5 +2,6 @@
"files.exclude": {
"**/.gitignore": true,
"**/.vscode": true
}
},
"files.watcherExclude": {}
}

View File

@@ -0,0 +1,3 @@
ID;modifiedAt;createdAt;createdBy;modifiedBy;Customer_ID;street;town;country_code;someOtherField
1e2f2640-6866-4dcf-8f4d-3027aa831cad;2019-04-04;2019-01-31;admin@business.com;admin@business.com;8e2f2640-6866-4dcf-8f4d-3027aa831cad;Hauptstrasse 11;Berlin;DE;Eine Bemerkung
24e718c9-ff99-47f1-8ca3-950c850777d4;2019-04-04;2019-01-30;admin@business.com;admin@business.com;74e718c9-ff99-47f1-8ca3-950c850777d4;Main Street 22;London;GB;Some Remark
1 ID modifiedAt createdAt createdBy modifiedBy Customer_ID street town country_code someOtherField
2 1e2f2640-6866-4dcf-8f4d-3027aa831cad 2019-04-04 2019-01-31 admin@business.com admin@business.com 8e2f2640-6866-4dcf-8f4d-3027aa831cad Hauptstrasse 11 Berlin DE Eine Bemerkung
3 24e718c9-ff99-47f1-8ca3-950c850777d4 2019-04-04 2019-01-30 admin@business.com admin@business.com 74e718c9-ff99-47f1-8ca3-950c850777d4 Main Street 22 London GB Some Remark

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};

View File

@@ -9,6 +9,8 @@ using { sap.capire.bookshop.OrderItems } from '@capire/orders';
entity Customers as projection on db.Customers;
entity CustomerPostalAddress as projection on db.CustomerPostalAddress;
entity OrderItemView as
SELECT from Orders
{ key ID,
@@ -20,18 +22,10 @@ using { sap.capire.bookshop.OrderItems } from '@capire/orders';
Items.amount as Item_Amount,
Items.netAmount as Item_NetAmount};
annotate PDMService.Customers with @(PersonalData.EntitySemantics: 'DataSubject')
{
ID @PersonalData.FieldSemantics: 'DataSubjectID';
firstName @PersonalData.IsPotentiallyPersonal;
lastName @PersonalData.IsPotentiallyPersonal;
creditCardNo @PersonalData.IsPotentiallySensitive;
dateOfBirth @PersonalData.IsPotentiallyPersonal;
};
annotate PDMService.OrderItemView with @(PersonalData.EntitySemantics: 'ContractRelated')
{
Customer_ID @PersonalData.FieldSemantics: 'DataSubjectID';
Customer_ID @PersonalData.FieldSemantics: 'DataSubjectID';
Customer_Email @PersonalData.IsPotentiallyPersonal;
};
};