diff --git a/gdpr/db/schema.cds b/gdpr/db/schema.cds new file mode 100644 index 00000000..cf326778 --- /dev/null +++ b/gdpr/db/schema.cds @@ -0,0 +1,30 @@ +// Proxy for importing schema from bookshop sample +using from '@capire/bookshop'; +using { Currency, managed, cuid } from '@sap/cds/common'; + +namespace sap.capire.bookshop; + +entity Orders : managed { + key ID : cds.UUID; + OrderNo : String @title:'Order Number'; //> readable key + Customer : Association to Customers; + Items : Composition of many OrderItems on Items.parent = $self; + total : Decimal(9,2) @readonly; + currency : Currency; +} +entity OrderItems { + key ID : cds.UUID; + parent : Association to Orders not null; + book : Association to bookshop.Books; + amount : Integer; + netAmount: Decimal(9,2); +} + +entity Customers : managed { + key ID : UUID; + Email : String; + FirstName : String; + LastName : String; + CreditCardNo : String; + dateOfBirth : Date; +} \ No newline at end of file diff --git a/gdpr/srv/pdm_service.cds b/gdpr/srv/pdm_service.cds index 370f5a06..217a89b9 100644 --- a/gdpr/srv/pdm_service.cds +++ b/gdpr/srv/pdm_service.cds @@ -1,5 +1,8 @@ +using from '@capire/bookshop'; +using { sap.capire.bookshop as db } from '../db/schema'; + @requires: 'system-user' - service GDPRService { + service PDM_Service { entity Customers as projection on db.Customers; @@ -13,4 +16,15 @@ Items.book.ID as Item_Book_ID, Items.amount as Item_Amount, Items.netAmount as Item_NetAmount}; + }; + + annotate PDM_Service.Customers with @( + PersonalData.EntitySemantics: 'DataSubject' + ) + { + ID @PersonalData.FieldSemantics: 'DataSubjectID'; + FirstName @PersonalData.IsPotentiallyPersonal; + LastName @PersonalData.IsPotentiallyPersonal; + CreditCardNo @PersonalData.IsPotentiallyPersonal; + dateOfBirth @PersonalData.IsPotentiallyPersonal; }; \ No newline at end of file