diff --git a/.vscode/settings.json b/.vscode/settings.json index 72bc8cb5..cc8b0364 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,6 @@ "files.exclude": { "**/.gitignore": true, "**/.vscode": true - } + }, + "files.watcherExclude": {} } diff --git a/gdpr/db/data/sap.capire.bookshop-CustomerPostalAddress.csv b/gdpr/db/data/sap.capire.bookshop-CustomerPostalAddress.csv new file mode 100644 index 00000000..7735a345 --- /dev/null +++ b/gdpr/db/data/sap.capire.bookshop-CustomerPostalAddress.csv @@ -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 \ No newline at end of file diff --git a/gdpr/db/schema.cds b/gdpr/db/schema.cds index 6af9a5a2..a189a41d 100644 --- a/gdpr/db/schema.cds +++ b/gdpr/db/schema.cds @@ -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; -} \ No newline at end of file +} + +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}; diff --git a/gdpr/srv/pdm-service.cds b/gdpr/srv/pdm-service.cds index 17c79f81..8dd628df 100644 --- a/gdpr/srv/pdm-service.cds +++ b/gdpr/srv/pdm-service.cds @@ -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; }; }; \ No newline at end of file