This commit is contained in:
Daniel
2020-03-01 18:25:53 +01:00
parent 06755978b2
commit 3731a7ea23
43 changed files with 87 additions and 77 deletions

View File

@@ -4,7 +4,8 @@
"description": "A simple bookshop application, build in a self-contained all-in-one fashion, i.e. w/o reusing other packages.",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/cds": "latest",
"@sap/capire-common": "*",
"@sap/cds": "*",
"express": "*"
},
"scripts": {

45
common/index.cds Normal file
View File

@@ -0,0 +1,45 @@
using { sap } from '@sap/cds/common';
extend sap.common.Currencies with {
// Currencies.code = ISO 4217 alphabetic three-letter code
// with the first two letters being equal to ISO 3166 alphabetic country codes
// See also:
// [1] https://www.iso.org/iso-4217-currency-codes.html
// [2] https://www.currency-iso.org/en/home/tables/table-a1.html
// [3] https://www.ibm.com/support/knowledgecenter/en/SSZLC2_7.0.0/com.ibm.commerce.payments.developer.doc/refs/rpylerl2mst97.htm
numcode : Integer;
exponent : Integer; //> e.g. 2 --> 1 Dollar = 10^2 Cent
minor : String; //> e.g. 'Cent'
}
/**
* The Code Lists below are designed as optional extensions to
* the base schema. Switch them on by adding an Association to
* one of the code list entities in your models or by:
* annotate sap.common.Countries with @cds.persistence.skip:false;
*/
context sap.common_countries {
extend sap.common.Countries {
regions : Composition of many Regions on regions._parent = $self.code;
}
entity Regions : sap.common.CodeList {
key code : String(5); // ISO 3166-2 alpha5 codes, e.g. DE-BW
children : Composition of many Regions on children._parent = $self.code;
cities : Composition of many Cities on cities.region = $self;
_parent : String(11);
}
entity Cities : sap.common.CodeList {
key code : String(11);
region : Association to Regions;
districts : Composition of many Districts on districts.city = $self;
}
entity Districts : sap.common.CodeList {
key code : String(11);
city : Association to Cities;
}
}

7
common/package.json Normal file
View File

@@ -0,0 +1,7 @@
{
"name": "@sap/capire-common",
"version": "1.0.0",
"description": "A reuse package providing common domain models and services for common data.",
"repository": "https://github.com/SAP-samples/cloud-cap-samples.git",
"license": "SAP SAMPLE CODE LICENSE"
}

View File

@@ -1,4 +1,4 @@
using AdminService from '../../srv/admin-service';
using AdminService from '@sap/capire-bookshop/srv/admin-service';
////////////////////////////////////////////////////////////////////////////
//

View File

@@ -1,4 +1,4 @@
using CatalogService from '../../srv/cat-service';
using CatalogService from '@sap/capire-bookshop/srv/cat-service';
////////////////////////////////////////////////////////////////////////////
//

View File

@@ -2,7 +2,7 @@
Common Annotations shared by all apps
*/
using { sap.capire.bookshop as my } from '../db/schema';
using { sap.capire.bookshop as my } from '@sap/capire-bookshop/db/schema';
////////////////////////////////////////////////////////////////////////////

View File

@@ -6,3 +6,5 @@ using from './admin/fiori-service';
using from './browse/fiori-service';
using from './orders/fiori-service';
using from './common';
using from '@sap/capire-common';

View File

@@ -1,4 +1,4 @@
using AdminService from '../../srv/admin-service';
using AdminService from '@sap/capire-bookshop/srv/admin-service';
annotate AdminService.Books with {
price @Common.FieldControl: #ReadOnly;

23
fiori/package.json Normal file
View File

@@ -0,0 +1,23 @@
{
"name": "@sap/capire-fiori",
"version": "1.0.0",
"description": "A simple bookshop application, build in a self-contained all-in-one fashion, i.e. w/o reusing other packages.",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/capire-bookshop": "*",
"@sap/capire-common": "*",
"@sap/cds": "*",
"express": "*"
},
"scripts": {
"start": "cds run --in-memory?",
"watch": "cds watch"
},
"cds": {
"requires": {
"db": {
"kind": "sql"
}
}
}
}

View File

@@ -1 +0,0 @@
{"packages":["packages/*"],"version":"1.0.0"}

View File

@@ -5,22 +5,11 @@
"author": "daniel.hutzel@sap.com",
"private": true,
"scripts": {
"lerna": "npx --no-install lerna -v > /dev/null || npm i lerna --no-save",
"install": "(npm -s run lerna) && lerna bootstrap --hoist",
"cleanup": "lerna clean -y && rm -fr node_modules",
"bookshop": "cds watch packages/bookshop",
"bookshop-enhanced": "cds watch packages/bookshop-enhanced",
"reviews-service": "cds watch packages/reviews-service",
"bookstore": "cds watch packages/bookstore",
"media-server": "cds watch packages/media-server"
"bookshop": "cds watch bookshop"
},
"dependencies": {
"@sap/cds": "latest",
"express": "*"
},
"devDependencies": {
"sqlite3": "*"
"@sap/capire-bookshop": "./bookshop",
"@sap/capire-common": "./common"
},
"--add-these-to-devDependencies-for-tests": {
"@types/jest": "*",

View File

@@ -1,7 +0,0 @@
code;symbol;name;descr
EUR;€;Euro;European Euro
USD;$;US Dollar;United States Dollar
CAD;$;Canadian Dollar;Canadian Dollar
AUD;$;Australian Dollar;Australian Dollar
GBP;£;Pound;Great Britain Pound
ILS;₪;Shekel;Israeli New Shekel
1 code symbol name descr
2 EUR Euro European Euro
3 USD $ US Dollar United States Dollar
4 CAD $ Canadian Dollar Canadian Dollar
5 AUD $ Australian Dollar Australian Dollar
6 GBP £ Pound Great Britain Pound
7 ILS Shekel Israeli New Shekel

View File

@@ -1,6 +1,5 @@
using { sap.capire.contacts.PostalAddress } from './schema';
using { sap } from '@sap/cds/common';
namespace sap.capire.contacts;
namespace sap.common;
/**
* The Code Lists below are designed as optional extensions to
@@ -9,7 +8,6 @@ namespace sap.capire.contacts;
* annotate sap.common.Countries with @cds.persistence.skip:false;
*/
entity Countries as select from sap.common.Countries;
extend sap.common.Countries {
regions : Composition of many Regions on regions._parent = $self.code;
}
@@ -28,10 +26,3 @@ entity Districts : sap.common.CodeList {
key code : String(11);
city : Association to Cities;
}
annotate PostalAddress with {
district @ref: sap.capire.contacts.Districts;
city @ref: sap.capire.contacts.Cities;
region @ref: sap.capire.contacts.Regions;
country @ref: sap.capire.contacts.Countries;
}

View File

@@ -1,13 +0,0 @@
code;locale;name;descr
EUR;de;Euro;European Euro
USD;de;US-Dollar;United States Dollar
CAD;de;Kanadischer Dollar;Kanadischer Dollar
AUD;de;Australischer Dollar;Australischer Dollar
GBP;de;Pfund;Britische Pfund
ILS;de;Schekel;Israelische Schekel
EUR;fr;euro;de la Zone euro
USD;fr;dollar;dollar des États-Unis
CAD;fr;dollar canadien;dollar canadien
AUD;fr;dollar australien;dollar australien
GBP;fr;livre sterling;pound sterling
ILS;fr;Shekel;shekel israelien
1 code locale name descr
2 EUR de Euro European Euro
3 USD de US-Dollar United States Dollar
4 CAD de Kanadischer Dollar Kanadischer Dollar
5 AUD de Australischer Dollar Australischer Dollar
6 GBP de Pfund Britische Pfund
7 ILS de Schekel Israelische Schekel
8 EUR fr euro de la Zone euro
9 USD fr dollar dollar des États-Unis
10 CAD fr dollar canadien dollar canadien
11 AUD fr dollar australien dollar australien
12 GBP fr livre sterling pound sterling
13 ILS fr Shekel shekel israelien

View File

@@ -1,17 +0,0 @@
namespace sap.capire.currencies;
using { sap.common.Currencies } from '@sap/cds/common';
extend Currencies with {
// Currencies.code = ISO 4217 alphabetic three-letter code
// with the first two letters being equal to ISO 3166 alphabetic country codes
numcode : Integer;
exponent : Integer; //> e.g. 2 --> 1 Dollar = 10^2 Cent
minor : String; //> e.g. 'Cent'
// country : String; //> country or region
}
// see also
// [1] https://www.iso.org/iso-4217-currency-codes.html
// [2] https://www.currency-iso.org/en/home/tables/table-a1.html
// [3] https://www.ibm.com/support/knowledgecenter/en/SSZLC2_7.0.0/com.ibm.commerce.payments.developer.doc/refs/rpylerl2mst97.htm

View File

@@ -1,10 +0,0 @@
{
"name": "@sap/capire-currencies",
"version": "1.0.0",
"description": "A reuse package providing common domain models and services for currencies-related data.",
"repository": "https://github.com/SAP-samples/cloud-cap-samples.git",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/cds": "latest"
}
}