pdm service

This commit is contained in:
Wolfgang Koch
2020-10-15 14:15:51 +02:00
parent bde5cd9818
commit 8575b75edb
8 changed files with 52 additions and 25 deletions

View File

@@ -0,0 +1,3 @@
ID;modifiedAt;createdAt;createdBy;modifiedBy;Email;FirstName;LastName;CreditCardNo;dateOfBirth
8e2f2640-6866-4dcf-8f4d-3027aa831cad;2019-04-04;2019-01-31;admin@business.com;admin@business.com;john.doe@test.com;John;Doe;9977-6655-4433-2211;1970-01-01
74e718c9-ff99-47f1-8ca3-950c850777d4;2019-04-04;2019-01-30;admin@business.com;admin@business.com;jane.doe@sap.com;Jane;Doe;2211-3344-5566-7788;1980-11-11
1 ID modifiedAt createdAt createdBy modifiedBy Email FirstName LastName CreditCardNo dateOfBirth
2 8e2f2640-6866-4dcf-8f4d-3027aa831cad 2019-04-04 2019-01-31 admin@business.com admin@business.com john.doe@test.com John Doe 9977-6655-4433-2211 1970-01-01
3 74e718c9-ff99-47f1-8ca3-950c850777d4 2019-04-04 2019-01-30 admin@business.com admin@business.com jane.doe@sap.com Jane Doe 2211-3344-5566-7788 1980-11-11

View File

@@ -0,0 +1,3 @@
ID;modifiedAt;createdAt;createdBy;modifiedBy;OrderNo;Customer_ID;currency_code
7e2f2640-6866-4dcf-8f4d-3027aa831cad;2019-04-04;2019-01-31;john.doe@test.com;john.doe@test.com;1;8e2f2640-6866-4dcf-8f4d-3027aa831cad;USD
64e718c9-ff99-47f1-8ca3-950c850777d4;2019-04-04;2019-01-30;jane.doe@test.com;jane.doe@test.com;2;74e718c9-ff99-47f1-8ca3-950c850777d4;USD
1 ID modifiedAt createdAt createdBy modifiedBy OrderNo Customer_ID currency_code
2 7e2f2640-6866-4dcf-8f4d-3027aa831cad 2019-04-04 2019-01-31 john.doe@test.com john.doe@test.com 1 8e2f2640-6866-4dcf-8f4d-3027aa831cad USD
3 64e718c9-ff99-47f1-8ca3-950c850777d4 2019-04-04 2019-01-30 jane.doe@test.com jane.doe@test.com 2 74e718c9-ff99-47f1-8ca3-950c850777d4 USD

View File

@@ -1,24 +1,14 @@
// Proxy for importing schema from bookshop sample
using from '@capire/bookshop';
using { Currency, managed, cuid } from '@sap/cds/common';
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';
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);
}
extend Orders with {
Customer : Association to Customers;
}
entity Customers : managed {
key ID : UUID;

3
gdpr/index.cds Normal file
View File

@@ -0,0 +1,3 @@
namespace sap.capire.gdpr; //> important for reflection
using from './db/schema';
using from './srv/pdm-service';

22
gdpr/package.json Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "@capire/fiori",
"version": "1.0.0",
"dependencies": {
"@capire/bookshop": "../bookshop",
"@capire/orders": "../orders",
"@capire/common": "../common",
"@sap/cds": "^4",
"express": "^4.17.1"
},
"scripts": {
"start": "cds run --in-memory?",
"watch": "cds watch"
},
"cds": {
"requires": {
"db": {
"kind": "sql"
}
}
}
}

View File

@@ -1,15 +1,18 @@
using from '@capire/bookshop';
using { sap.capire.bookshop as db } from '../db/schema';
//using from '@capire/orders';
using { sap.capire.bookshop as db } from '../db/schema';
using { sap.capire.bookshop.Books } from '@capire/bookshop';
using { sap.capire.bookshop.Orders } from '@capire/orders';
using { sap.capire.bookshop.OrderItems } from '@capire/orders';
@requires: 'system-user'
//@requires: 'system-user'
service PDM_Service {
entity Customers as projection on db.Customers;
entity OrderItems as
SELECT from db.Orders
{ key ID,
key Items.ID as Item_ID,
entity OrderItemView as
SELECT from Orders
{ //key ID,
//key Items.ID as Item_ID,
OrderNo,
Customer.ID as Customer_ID,
Customer.Email as Customer_Email,
@@ -22,7 +25,7 @@ using { sap.capire.bookshop as db } from '../db/schema';
PersonalData.EntitySemantics: 'DataSubject'
)
{
ID @PersonalData.FieldSemantics: 'DataSubjectID';
ID @PersonalData.FieldSemantics: 'DataSubjectID';
FirstName @PersonalData.IsPotentiallyPersonal;
LastName @PersonalData.IsPotentiallyPersonal;
CreditCardNo @PersonalData.IsPotentiallyPersonal;

3
orders/index.cds Normal file
View File

@@ -0,0 +1,3 @@
namespace sap.capire.orders; //> important for reflection
using from './db/schema';
using from './srv/orders-service';