enhance example
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -2,5 +2,6 @@
|
|||||||
"files.exclude": {
|
"files.exclude": {
|
||||||
"**/.gitignore": true,
|
"**/.gitignore": true,
|
||||||
"**/.vscode": true
|
"**/.vscode": true
|
||||||
}
|
},
|
||||||
|
"files.watcherExclude": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
using { sap.capire.bookshop.Books } from '@capire/bookshop';
|
using { sap.capire.bookshop.Books } from '@capire/bookshop';
|
||||||
using { sap.capire.bookshop.Orders } from '@capire/orders';
|
using { sap.capire.bookshop.Orders } from '@capire/orders';
|
||||||
using { sap.capire.bookshop.OrderItems } 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;
|
namespace sap.capire.bookshop;
|
||||||
|
|
||||||
@@ -10,11 +10,42 @@ extend Orders with {
|
|||||||
Customer : Association to Customers;
|
Customer : Association to Customers;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity Customers : managed {
|
entity Customers : cuid, managed {
|
||||||
key ID : UUID;
|
|
||||||
email : String;
|
email : String;
|
||||||
firstName : String;
|
firstName : String;
|
||||||
lastName : String;
|
lastName : String;
|
||||||
creditCardNo : String;
|
creditCardNo : String;
|
||||||
dateOfBirth : Date;
|
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};
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ using { sap.capire.bookshop.OrderItems } from '@capire/orders';
|
|||||||
|
|
||||||
entity Customers as projection on db.Customers;
|
entity Customers as projection on db.Customers;
|
||||||
|
|
||||||
|
entity CustomerPostalAddress as projection on db.CustomerPostalAddress;
|
||||||
|
|
||||||
entity OrderItemView as
|
entity OrderItemView as
|
||||||
SELECT from Orders
|
SELECT from Orders
|
||||||
{ key ID,
|
{ key ID,
|
||||||
@@ -20,18 +22,10 @@ using { sap.capire.bookshop.OrderItems } from '@capire/orders';
|
|||||||
Items.amount as Item_Amount,
|
Items.amount as Item_Amount,
|
||||||
Items.netAmount as Item_NetAmount};
|
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')
|
annotate PDMService.OrderItemView with @(PersonalData.EntitySemantics: 'ContractRelated')
|
||||||
{
|
{
|
||||||
Customer_ID @PersonalData.FieldSemantics: 'DataSubjectID';
|
Customer_ID @PersonalData.FieldSemantics: 'DataSubjectID';
|
||||||
|
Customer_Email @PersonalData.IsPotentiallyPersonal;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user