Compare commits
49 Commits
ESM
...
multitenan
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2cc9fe50c4 | ||
|
|
c479d86aab | ||
|
|
2a933ead92 | ||
|
|
88c05a9c7f | ||
|
|
0a8ab2c137 | ||
|
|
aadfd9f7a1 | ||
|
|
8e2e899722 | ||
|
|
d516ffdb06 | ||
|
|
ab87eb6ee9 | ||
|
|
b379822569 | ||
|
|
46aec07596 | ||
|
|
35df5e1552 | ||
|
|
cf717c4cf3 | ||
|
|
8bc6343223 | ||
|
|
33c21f6f3a | ||
|
|
7810585a0f | ||
|
|
68c8b95554 | ||
|
|
fac88be2bf | ||
|
|
b59a02588c | ||
|
|
0f02e25b1e | ||
|
|
be46fff7e9 | ||
|
|
2814486bfd | ||
|
|
7f75401346 | ||
|
|
1d91a8e2d9 | ||
|
|
60ba27ff3c | ||
|
|
b7ff0cd100 | ||
|
|
67038e7fe1 | ||
|
|
ac895a508a | ||
|
|
172aab7f8d | ||
|
|
82d1891ece | ||
|
|
01a528ba83 | ||
|
|
804887e208 | ||
|
|
0972858cbb | ||
|
|
d57974fb5e | ||
|
|
e14a4e8c40 | ||
|
|
483a5f2696 | ||
|
|
f952764b48 | ||
|
|
70d132fed9 | ||
|
|
e3551dc917 | ||
|
|
0f47b9ae8e | ||
|
|
76bde6ff41 | ||
|
|
09aa318879 | ||
|
|
81f762d7be | ||
|
|
309c76caae | ||
|
|
13fc17a760 | ||
|
|
c458bf0f47 | ||
|
|
0d8abf71cb | ||
|
|
dc5cc5e607 | ||
|
|
594043e55c |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -10,8 +10,12 @@ target/
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
*.log
|
*.log
|
||||||
*.mtar
|
*.mtar
|
||||||
|
*mta-op*/
|
||||||
connection.properties
|
connection.properties
|
||||||
default-env.json
|
default-env.json
|
||||||
packages/messageBox
|
packages/messageBox
|
||||||
reviews/msg-box
|
reviews/msg-box
|
||||||
reviews/db/test.db
|
reviews/db/test.db
|
||||||
|
|
||||||
|
package-lock.json
|
||||||
|
*log*.txt
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# cds.requires.messaging.kind = file-based-messaging
|
|
||||||
PORT = 4004
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
//
|
|
||||||
// Add Author.age and .lifetime with a DB-specific function
|
|
||||||
//
|
|
||||||
|
|
||||||
using { AdminService } from '../schema';
|
|
||||||
|
|
||||||
extend projection AdminService.Authors with {
|
|
||||||
YEARS_BETWEEN(dateOfBirth, dateOfDeath) as age: Integer,
|
|
||||||
YEAR(dateOfBirth) || ' – ' || YEAR(dateOfDeath) as lifetime : String
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using { sap.capire.bookshop } from '@capire/bookshop';
|
|
||||||
|
|
||||||
// Forward-declare calculated fields to be filled in database-specific ways
|
|
||||||
// TODO find a better way to have 'default' fields that still can be overwritten.
|
|
||||||
extend bookshop.Authors with {
|
|
||||||
virtual age: Integer;
|
|
||||||
virtual lifetime: String;
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
//
|
|
||||||
// Add Author.age and .lifetime with a DB-specific function
|
|
||||||
//
|
|
||||||
|
|
||||||
using { AdminService } from '../schema';
|
|
||||||
|
|
||||||
extend projection AdminService.Authors with {
|
|
||||||
strftime('%Y',dateOfDeath)-strftime('%Y',dateOfBirth) as age: Integer,
|
|
||||||
strftime('%Y',dateOfBirth) || ' – ' || strftime('%Y',dateOfDeath) as lifetime : String
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@capire/fiori",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"dependencies": {
|
|
||||||
"@capire/bookshop": "*",
|
|
||||||
"@capire/reviews": "*",
|
|
||||||
"@capire/orders": "*",
|
|
||||||
"@capire/common": "*",
|
|
||||||
"@sap/cds": ">=4",
|
|
||||||
"express": "^4.17.1",
|
|
||||||
"passport": "^0.4.1"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"start": "cds run --in-memory?",
|
|
||||||
"watch": "cds watch"
|
|
||||||
},
|
|
||||||
"cds": {
|
|
||||||
"hana": {
|
|
||||||
"deploy-format": "hdbtable"
|
|
||||||
},
|
|
||||||
"requires": {
|
|
||||||
"auth": {
|
|
||||||
"strategy": "dummy"
|
|
||||||
},
|
|
||||||
"ReviewsService": {
|
|
||||||
"kind": "odata",
|
|
||||||
"model": "@capire/reviews"
|
|
||||||
},
|
|
||||||
"OrdersService": {
|
|
||||||
"kind": "odata",
|
|
||||||
"model": "@capire/orders"
|
|
||||||
},
|
|
||||||
"db": {
|
|
||||||
"kind": "sql",
|
|
||||||
"[development]": {
|
|
||||||
"model": "db/sqlite"
|
|
||||||
},
|
|
||||||
"[production]": {
|
|
||||||
"model": "db/hana"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
|
|
||||||
@bookshop = http://localhost:4004
|
|
||||||
@reviews-service = {{bookshop}}/reviews
|
|
||||||
# Uncomment this when running a separate reviews service
|
|
||||||
@reviews-service = http://localhost:4005/reviews
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#################################################
|
|
||||||
#
|
|
||||||
# Reviews Service
|
|
||||||
#
|
|
||||||
|
|
||||||
GET {{reviews-service}}/Reviews
|
|
||||||
|
|
||||||
###
|
|
||||||
|
|
||||||
POST {{reviews-service}}/Reviews
|
|
||||||
Authorization: Basic {{$processEnv USER}}:
|
|
||||||
Content-Type: application/json
|
|
||||||
|
|
||||||
{"subject":"201", "title":"boo", "rating":3 }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#################################################
|
|
||||||
#
|
|
||||||
# Bookshop Services
|
|
||||||
#
|
|
||||||
|
|
||||||
GET {{bookshop}}/browse/Books/201/reviews?
|
|
||||||
&$select=rating,date,title
|
|
||||||
&$top=3
|
|
||||||
|
|
||||||
###
|
|
||||||
|
|
||||||
GET {{bookshop}}/browse/Books(201)?
|
|
||||||
&$select=ID,title,rating
|
|
||||||
&$expand=reviews
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#################################################
|
|
||||||
#
|
|
||||||
# Orders Service, incl. draft choreography
|
|
||||||
#
|
|
||||||
@newOrderID = e939604c-ab83-4d4f-bdb6-95fe30b3773e
|
|
||||||
|
|
||||||
GET {{bookshop}}/orders/Orders
|
|
||||||
|
|
||||||
### Create order, still inactive
|
|
||||||
POST {{bookshop}}/orders/Orders
|
|
||||||
Content-Type: application/json
|
|
||||||
|
|
||||||
{"ID": "{{newOrderID}}"}
|
|
||||||
|
|
||||||
### Get inactive order. We have to specify `IsActiveEntity`.
|
|
||||||
GET {{bookshop}}/orders/Orders(ID={{newOrderID}},IsActiveEntity=false)
|
|
||||||
|
|
||||||
### Activate order using `.../<servicename>.draftActivate`
|
|
||||||
POST {{bookshop}}/orders/Orders(ID={{newOrderID}},IsActiveEntity=false)/OrdersService.draftActivate
|
|
||||||
Content-Type: application/json
|
|
||||||
|
|
||||||
### Get active order
|
|
||||||
GET {{bookshop}}/orders/Orders(ID={{newOrderID}},IsActiveEntity=true)
|
|
||||||
|
|
||||||
### Create author
|
|
||||||
POST {{bookshop}}/admin/Authors
|
|
||||||
Content-Type: application/json
|
|
||||||
Authorization: Basic alice:
|
|
||||||
|
|
||||||
{
|
|
||||||
"ID": 200,
|
|
||||||
"name": "William Shakespeare",
|
|
||||||
"dateOfBirth": "1564-04-26",
|
|
||||||
"dateOfDeath": "1616-04-23"
|
|
||||||
}
|
|
||||||
1
multitenancy/.cdsrc.json
Normal file
1
multitenancy/.cdsrc.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
33
multitenancy/.gitignore
vendored
Normal file
33
multitenancy/.gitignore
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# CAP multitenancy
|
||||||
|
_out
|
||||||
|
*.db
|
||||||
|
connection.properties
|
||||||
|
default-*.json
|
||||||
|
gen/
|
||||||
|
node_modules/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Web IDE, App Studio
|
||||||
|
.che/
|
||||||
|
.gen/
|
||||||
|
|
||||||
|
# MTA
|
||||||
|
*_mta_build_tmp
|
||||||
|
*.mtar
|
||||||
|
*.mta
|
||||||
|
mta_archives/
|
||||||
|
*mta-op*/
|
||||||
|
|
||||||
|
|
||||||
|
# Other
|
||||||
|
.DS_Store
|
||||||
|
*.orig
|
||||||
|
*.log
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
*.flattened-pom.xml
|
||||||
|
*log*.txt
|
||||||
|
|
||||||
|
# IDEs
|
||||||
|
# .vscode
|
||||||
|
# .idea
|
||||||
20
multitenancy/.vscode/extensions.json
vendored
Normal file
20
multitenancy/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
|
||||||
|
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
|
||||||
|
|
||||||
|
// List of extensions which should be recommended for users of this workspace.
|
||||||
|
"recommendations": [
|
||||||
|
// >>>>>>>> Add CDS Editor here as soon it is available of vscode marketplace!,
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
|
"mechatroner.rainbow-csv",
|
||||||
|
"humao.rest-client",
|
||||||
|
"alexcvzz.vscode-sqlite",
|
||||||
|
"hbenl.vscode-mocha-test-adapter",
|
||||||
|
"sdras.night-owl"
|
||||||
|
],
|
||||||
|
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
||||||
|
"unwantedRecommendations": [
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
15
multitenancy/.vscode/launch.json
vendored
Normal file
15
multitenancy/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"command": "cds run --with-mocks --in-memory?",
|
||||||
|
"name": "cds run",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "node-terminal",
|
||||||
|
"skipFiles": [ "<node_internals>/**" ]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
7
multitenancy/.vscode/settings.json
vendored
Normal file
7
multitenancy/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"files.exclude": {
|
||||||
|
"**/.gitignore": true,
|
||||||
|
"**/.git": true,
|
||||||
|
"**/.vscode": true
|
||||||
|
}
|
||||||
|
}
|
||||||
25
multitenancy/.vscode/tasks.json
vendored
Normal file
25
multitenancy/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "cds watch",
|
||||||
|
"command": "cds",
|
||||||
|
"args": ["watch"],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "cds run",
|
||||||
|
"command": "cds",
|
||||||
|
"args": ["run", "--with-mocks", "--in-memory?"],
|
||||||
|
"problemMatcher": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
25
multitenancy/README.md
Normal file
25
multitenancy/README.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Getting Started
|
||||||
|
|
||||||
|
Welcome to your new project.
|
||||||
|
|
||||||
|
It contains these folders and files, following our recommended project layout:
|
||||||
|
|
||||||
|
File or Folder | Purpose
|
||||||
|
---------|----------
|
||||||
|
`app/` | content for UI frontends goes here
|
||||||
|
`db/` | your domain models and data go here
|
||||||
|
`srv/` | your service models and code go here
|
||||||
|
`package.json` | project metadata and configuration
|
||||||
|
`readme.md` | this getting started guide
|
||||||
|
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
- Open a new terminal and run `cds watch`
|
||||||
|
- (in VS Code simply choose _**Terminal** > Run Task > cds watch_)
|
||||||
|
- Start adding content, for example, a [db/schema.cds](db/schema.cds).
|
||||||
|
|
||||||
|
|
||||||
|
## Learn More
|
||||||
|
|
||||||
|
Learn more at https://cap.cloud.sap/docs/get-started/.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using CatalogService from '@capire/bookshop';
|
using CatalogService from '../../srv/cat-service';
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
Common Annotations shared by all apps
|
Common Annotations shared by all apps
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using { sap.capire.bookshop as my } from '@capire/bookshop';
|
using { sap.capire.bookshop as my } from '../db/schema';
|
||||||
using { sap.common } from '@capire/common';
|
using { sap.common } from '../db/capire_common';
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
92
multitenancy/app/orders/fiori-service.cds
Normal file
92
multitenancy/app/orders/fiori-service.cds
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Note: this is designed for the OrdersService being co-located with
|
||||||
|
// bookshop. It does not work if OrdersService is run as a separate
|
||||||
|
// process, and is not intended to do so.
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
using { OrdersService } from '../../srv/orders-service';
|
||||||
|
|
||||||
|
|
||||||
|
@odata.draft.enabled
|
||||||
|
annotate OrdersService.Orders with @(
|
||||||
|
UI: {
|
||||||
|
SelectionFields: [ createdAt, createdBy ],
|
||||||
|
LineItem: [
|
||||||
|
{Value: OrderNo, Label:'OrderNo'},
|
||||||
|
// {Value: buyer, Label:'Customer'}, we do not need this, because we want extend it later
|
||||||
|
{Value: createdAt, Label:'Date'}
|
||||||
|
],
|
||||||
|
HeaderInfo: {
|
||||||
|
TypeName: 'Order', TypeNamePlural: 'Orders',
|
||||||
|
Title: {
|
||||||
|
Label: 'Order number ', //A label is possible but it is not considered on the ObjectPage yet
|
||||||
|
Value: OrderNo
|
||||||
|
},
|
||||||
|
Description: {Value: createdBy}
|
||||||
|
},
|
||||||
|
Identification: [ //Is the main field group
|
||||||
|
{Value: createdBy, Label:'Customer'},
|
||||||
|
{Value: createdAt, Label:'Date'},
|
||||||
|
{Value: OrderNo },
|
||||||
|
],
|
||||||
|
HeaderFacets: [
|
||||||
|
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Created}', Target: '@UI.FieldGroup#Created'},
|
||||||
|
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Modified}', Target: '@UI.FieldGroup#Modified'},
|
||||||
|
],
|
||||||
|
Facets: [
|
||||||
|
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'},
|
||||||
|
{$Type: 'UI.ReferenceFacet', Label: '{i18n>OrderItems}', Target: 'Items/@UI.LineItem'},
|
||||||
|
],
|
||||||
|
FieldGroup#Details: {
|
||||||
|
Data: [
|
||||||
|
{Value: currency_code, Label:'Currency'}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
FieldGroup#Created: {
|
||||||
|
Data: [
|
||||||
|
{Value: createdBy},
|
||||||
|
{Value: createdAt},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
FieldGroup#Modified: {
|
||||||
|
Data: [
|
||||||
|
{Value: modifiedBy},
|
||||||
|
{Value: modifiedAt},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
createdAt @UI.HiddenFilter:false;
|
||||||
|
createdBy @UI.HiddenFilter:false;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
annotate OrdersService.Orders_Items with @(
|
||||||
|
UI: {
|
||||||
|
LineItem: [
|
||||||
|
{Value: product_ID, Label:'Product ID'},
|
||||||
|
{Value: title, Label:'Product Title'},
|
||||||
|
{Value: price, Label:'Unit Price'},
|
||||||
|
{Value: amount, Label:'Quantity'},
|
||||||
|
],
|
||||||
|
Identification: [ //Is the main field group
|
||||||
|
{Value: amount, Label:'Amount'},
|
||||||
|
{Value: title, Label:'Product'},
|
||||||
|
{Value: price, Label:'Unit Price'},
|
||||||
|
],
|
||||||
|
Facets: [
|
||||||
|
{$Type: 'UI.ReferenceFacet', Label: '{i18n>OrderItems}', Target: '@UI.Identification'},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
amount @(
|
||||||
|
Common.FieldControl: #Mandatory
|
||||||
|
);
|
||||||
|
};
|
||||||
8
multitenancy/app/orders/webapp/Component.js
Normal file
8
multitenancy/app/orders/webapp/Component.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
sap.ui.define(["sap/fe/core/AppComponent"], function(AppComponent) {
|
||||||
|
"use strict";
|
||||||
|
return AppComponent.extend("orders.Component", {
|
||||||
|
metadata: { manifest: "json" }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/* eslint no-undef:0 */
|
||||||
11
multitenancy/app/orders/webapp/i18n/i18n.properties
Normal file
11
multitenancy/app/orders/webapp/i18n/i18n.properties
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# This is the resource bundle of itelo
|
||||||
|
# __ldi.translation.uuid=c3431418-9caf-11e8-98d0-529269fb1459
|
||||||
|
|
||||||
|
# JCI app descriptor contains lower case TITLE
|
||||||
|
appTitle=Bookshop Sample
|
||||||
|
|
||||||
|
# JCI app descriptor contains lower case DESCRIPTION
|
||||||
|
appSubTitle=CAP Sample Application
|
||||||
|
|
||||||
|
# JCI app descriptor contains lower case DESCRIPTION
|
||||||
|
appDescription=CDS Sample Service
|
||||||
170
multitenancy/app/orders/webapp/manifest.json
Normal file
170
multitenancy/app/orders/webapp/manifest.json
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
{
|
||||||
|
"_version": "1.8.0",
|
||||||
|
"sap.app": {
|
||||||
|
"id": "orders",
|
||||||
|
"type": "application",
|
||||||
|
"title": "Order Books",
|
||||||
|
"description": "Sample Application",
|
||||||
|
"i18n": "i18n/i18n.properties",
|
||||||
|
"dataSources": {
|
||||||
|
"OrdersService": {
|
||||||
|
"uri": "/orders/",
|
||||||
|
"type": "OData",
|
||||||
|
"settings": {
|
||||||
|
"odataVersion": "4.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"-sourceTemplate": {
|
||||||
|
"id": "ui5template.basicSAPUI5ApplicationProject",
|
||||||
|
"-id": "ui5template.smartTemplate",
|
||||||
|
"-version": "1.40.12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sap.ui5": {
|
||||||
|
"dependencies": {
|
||||||
|
"libs": {
|
||||||
|
"sap.fe.templates": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models": {
|
||||||
|
"i18n": {
|
||||||
|
"type": "sap.ui.model.resource.ResourceModel",
|
||||||
|
"uri": "i18n/i18n.properties"
|
||||||
|
},
|
||||||
|
"": {
|
||||||
|
"dataSource": "OrdersService",
|
||||||
|
"settings": {
|
||||||
|
"synchronizationMode": "None",
|
||||||
|
"operationMode": "Server",
|
||||||
|
"autoExpandSelect" : true,
|
||||||
|
"earlyRequests": true,
|
||||||
|
"groupProperties": {
|
||||||
|
"default": {
|
||||||
|
"submit": "Auto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"routing": {
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"pattern": ":?query:",
|
||||||
|
"name": "OrdersList",
|
||||||
|
"target": "OrdersList"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pattern": "Orders({key}):?query:",
|
||||||
|
"name": "OrdersDetails",
|
||||||
|
"target": "OrdersDetails"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pattern": "Orders({boo})/Items({boo2}):?query:",
|
||||||
|
"name": "OrderItemsDetails",
|
||||||
|
"target": "OrderItemsDetails"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pattern": "Books({key}):?query:",
|
||||||
|
"name": "BooksDetails",
|
||||||
|
"target": "BooksDetails"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"targets": {
|
||||||
|
"OrdersList": {
|
||||||
|
"type": "Component",
|
||||||
|
"id": "OrdersList",
|
||||||
|
"name": "sap.fe.templates.ListReport",
|
||||||
|
"options": {
|
||||||
|
"settings" : {
|
||||||
|
"entitySet" : "Orders",
|
||||||
|
"navigation" : {
|
||||||
|
"Orders" : {
|
||||||
|
"detail" : {
|
||||||
|
"route" : "OrdersDetails"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"OrdersDetails": {
|
||||||
|
"type": "Component",
|
||||||
|
"id": "OrdersDetails",
|
||||||
|
"name": "sap.fe.templates.ObjectPage",
|
||||||
|
"options": {
|
||||||
|
"settings" : {
|
||||||
|
"entitySet": "Orders",
|
||||||
|
"navigation" : {
|
||||||
|
"Items": {
|
||||||
|
"detail": {
|
||||||
|
"route": "OrderItemsDetails"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"book": {
|
||||||
|
"detail": {
|
||||||
|
"route": "BooksDetails"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dummy": {
|
||||||
|
"detail": {
|
||||||
|
"route": "BooksDetails"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"OrderItemsDetails": {
|
||||||
|
"type": "Component",
|
||||||
|
"id": "OrderItemsDetails",
|
||||||
|
"name": "sap.fe.templates.ObjectPage",
|
||||||
|
"options": {
|
||||||
|
"settings" : {
|
||||||
|
"entitySet": "Orders_Items"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"BooksDetails": {
|
||||||
|
"type": "Component",
|
||||||
|
"id": "BooksDetails",
|
||||||
|
"name": "sap.fe.templates.ObjectPage",
|
||||||
|
"options": {
|
||||||
|
"settings" : {
|
||||||
|
"entitySet": "Books",
|
||||||
|
"navigation": {
|
||||||
|
"author": {
|
||||||
|
"detail": {
|
||||||
|
"route": "AuthorsDetails"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AuthorsDetails": {
|
||||||
|
"type": "Component",
|
||||||
|
"id": "AuthorsDetails",
|
||||||
|
"name": "sap.fe.templates.ObjectPage",
|
||||||
|
"options": {
|
||||||
|
"settings" : {
|
||||||
|
"entitySet": "Authors"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contentDensities": {
|
||||||
|
"compact": true,
|
||||||
|
"cozy": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sap.ui": {
|
||||||
|
"technology": "UI5",
|
||||||
|
"fullWidth": false
|
||||||
|
},
|
||||||
|
"sap.fiori": {
|
||||||
|
"registrationIds": [],
|
||||||
|
"archeType": "transactional"
|
||||||
|
}
|
||||||
|
}
|
||||||
19
multitenancy/app/package.json
Normal file
19
multitenancy/app/package.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "approuter",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"devDependencies": {},
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.0.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "node node_modules/@sap/approuter/approuter.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"@sap/approuter": ">=9.0.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,9 +4,8 @@
|
|||||||
|
|
||||||
using from './admin/fiori-service';
|
using from './admin/fiori-service';
|
||||||
using from './browse/fiori-service';
|
using from './browse/fiori-service';
|
||||||
|
using from './orders/fiori-service';
|
||||||
using from './common';
|
using from './common';
|
||||||
|
|
||||||
using from '@capire/common';
|
using from '../db/capire_common';
|
||||||
|
|
||||||
// only works in case of embedded orders service
|
|
||||||
using from '@capire/orders/app/orders/fiori-service';
|
|
||||||
28
multitenancy/app/xs-app.json
Normal file
28
multitenancy/app/xs-app.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"welcomeFile": "/admin-fiori.html",
|
||||||
|
"authenticationMethod": "route",
|
||||||
|
"sessionTimeout": 30,
|
||||||
|
"logout": {
|
||||||
|
"logoutEndpoint": "/do/logout",
|
||||||
|
"logoutPage": "/"
|
||||||
|
},
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"source": "^/((admin|browse|orders)/webapp/.*)$",
|
||||||
|
"target": "$1",
|
||||||
|
"localDir": ".",
|
||||||
|
"authenticationType": "xsuaa"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "^(/[^/]+\\.html(\\?.*)?)$",
|
||||||
|
"target": "$1",
|
||||||
|
"localDir": ".",
|
||||||
|
"authenticationType": "xsuaa"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "^.*$",
|
||||||
|
"destination": "srv-api",
|
||||||
|
"authenticationType": "xsuaa"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
45
multitenancy/db/capire_common.cds
Normal file
45
multitenancy/db/capire_common.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
5
multitenancy/db/data/sap.capire.bookshop-Authors.csv
Normal file
5
multitenancy/db/data/sap.capire.bookshop-Authors.csv
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ID;name;dateOfBirth;placeOfBirth;dateOfDeath;placeOfDeath
|
||||||
|
101;Emily Brontë;1818-07-30;Thornton, Yorkshire;1848-12-19;Haworth, Yorkshire
|
||||||
|
107;Charlotte Brontë;1818-04-21;Thornton, Yorkshire;1855-03-31;Haworth, Yorkshire
|
||||||
|
150;Edgar Allen Poe;1809-01-19;Boston, Massachusetts;1849-10-07;Baltimore, Maryland
|
||||||
|
170;Richard Carpenter;1929-08-14;King’s Lynn, Norfolk;2012-02-26;Hertfordshire, England
|
||||||
|
500 Internal Server Error
Gitea Version: 1.24.4 |