reloaded
This commit is contained in:
@@ -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.",
|
"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",
|
"license": "SAP SAMPLE CODE LICENSE",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sap/cds": "latest",
|
"@sap/capire-common": "*",
|
||||||
|
"@sap/cds": "*",
|
||||||
"express": "*"
|
"express": "*"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
45
common/index.cds
Normal file
45
common/index.cds
Normal 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
7
common/package.json
Normal 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"
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using AdminService from '../../srv/admin-service';
|
using AdminService from '@sap/capire-bookshop/srv/admin-service';
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using CatalogService from '../../srv/cat-service';
|
using CatalogService from '@sap/capire-bookshop/srv/cat-service';
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
Common Annotations shared by all apps
|
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';
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -6,3 +6,5 @@ using from './admin/fiori-service';
|
|||||||
using from './browse/fiori-service';
|
using from './browse/fiori-service';
|
||||||
using from './orders/fiori-service';
|
using from './orders/fiori-service';
|
||||||
using from './common';
|
using from './common';
|
||||||
|
|
||||||
|
using from '@sap/capire-common';
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using AdminService from '../../srv/admin-service';
|
using AdminService from '@sap/capire-bookshop/srv/admin-service';
|
||||||
|
|
||||||
annotate AdminService.Books with {
|
annotate AdminService.Books with {
|
||||||
price @Common.FieldControl: #ReadOnly;
|
price @Common.FieldControl: #ReadOnly;
|
||||||
23
fiori/package.json
Normal file
23
fiori/package.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
{"packages":["packages/*"],"version":"1.0.0"}
|
|
||||||
17
package.json
17
package.json
@@ -5,22 +5,11 @@
|
|||||||
"author": "daniel.hutzel@sap.com",
|
"author": "daniel.hutzel@sap.com",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lerna": "npx --no-install lerna -v > /dev/null || npm i lerna --no-save",
|
"bookshop": "cds watch bookshop"
|
||||||
"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"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sap/cds": "latest",
|
"@sap/capire-bookshop": "./bookshop",
|
||||||
"express": "*"
|
"@sap/capire-common": "./common"
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"sqlite3": "*"
|
|
||||||
},
|
},
|
||||||
"--add-these-to-devDependencies-for-tests": {
|
"--add-these-to-devDependencies-for-tests": {
|
||||||
"@types/jest": "*",
|
"@types/jest": "*",
|
||||||
|
|||||||
@@ -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,6 +1,5 @@
|
|||||||
using { sap.capire.contacts.PostalAddress } from './schema';
|
|
||||||
using { sap } from '@sap/cds/common';
|
using { sap } from '@sap/cds/common';
|
||||||
namespace sap.capire.contacts;
|
namespace sap.common;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Code Lists below are designed as optional extensions to
|
* 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;
|
* annotate sap.common.Countries with @cds.persistence.skip:false;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
entity Countries as select from sap.common.Countries;
|
|
||||||
extend sap.common.Countries {
|
extend sap.common.Countries {
|
||||||
regions : Composition of many Regions on regions._parent = $self.code;
|
regions : Composition of many Regions on regions._parent = $self.code;
|
||||||
}
|
}
|
||||||
@@ -28,10 +26,3 @@ entity Districts : sap.common.CodeList {
|
|||||||
key code : String(11);
|
key code : String(11);
|
||||||
city : Association to Cities;
|
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;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -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,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
|
|
||||||
@@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user