Compare commits
46 Commits
common-con
...
compose-wi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c5a20bdb0 | ||
|
|
c14ee0062c | ||
|
|
5eb293d378 | ||
|
|
b8469d562f | ||
|
|
afd4df3f39 | ||
|
|
0228841260 | ||
|
|
24ad8a84da | ||
|
|
e3acbb9832 | ||
|
|
36a800165b | ||
|
|
e5e86cb733 | ||
|
|
f5c7b50a6d | ||
|
|
6ae95cfa51 | ||
|
|
ec03c6418b | ||
|
|
021df191ec | ||
|
|
2e0a5aeb73 | ||
|
|
8b978a94ec | ||
|
|
9596511883 | ||
|
|
191e577e51 | ||
|
|
d67af1432b | ||
|
|
52b4dbeacc | ||
|
|
4a8d8a0ec3 | ||
|
|
a9f040edcc | ||
|
|
b0baf3b5aa | ||
|
|
86fb1d20d3 | ||
|
|
dfb7d80849 | ||
|
|
cdcfdafbdc | ||
|
|
e29394eac0 | ||
|
|
06c583d0cd | ||
|
|
1d14e75691 | ||
|
|
9991e73a37 | ||
|
|
8f9e875865 | ||
|
|
a92fb4c7cd | ||
|
|
f974ac1bf1 | ||
|
|
11770f68f4 | ||
|
|
96473d45c8 | ||
|
|
c089c9777b | ||
|
|
68f8a4fe7b | ||
|
|
60a0ea582e | ||
|
|
8ffa3f052d | ||
|
|
6c1c1b1785 | ||
|
|
7283ac7042 | ||
|
|
7add92a05c | ||
|
|
aa13772572 | ||
|
|
d612a560aa | ||
|
|
8b3a094d22 | ||
|
|
e7ed4ff0bf |
2
.github/workflows/node.js.yml
vendored
2
.github/workflows/node.js.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [18.x, 16.x, 14.x]
|
node-version: [18.x, 16.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -54,24 +54,6 @@ npx jest
|
|||||||
```
|
```
|
||||||
> While mocha is a bit smaller and faster, jest runs tests in parallel and isolation, which allows to run all tests.
|
> While mocha is a bit smaller and faster, jest runs tests in parallel and isolation, which allows to run all tests.
|
||||||
|
|
||||||
|
|
||||||
### Serve `npm`
|
|
||||||
|
|
||||||
We've included a simple npm registry mock, which allows you to do an `npm install @capire/<package>` locally. Use it as follows:
|
|
||||||
|
|
||||||
1. Start the @capire registry:
|
|
||||||
```sh
|
|
||||||
npm run registry
|
|
||||||
```
|
|
||||||
> While running this will have `@capire:registry=http://localhost:4444` set with npmrc.
|
|
||||||
|
|
||||||
2. Install one of the @capire packages wherever you like, for example:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm add @capire/common @capire/bookshop
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Code Tours
|
## Code Tours
|
||||||
|
|
||||||
Take one of the [guided tours](.tours) in VS Code through our CAP samples and learn which CAP features are showcased by the different parts of the repository. Just install the [CodeTour extension](https://marketplace.visualstudio.com/items?itemName=vsls-contrib.codetour) for VS Code. We'll add more code tours in the future. Stay tuned!
|
Take one of the [guided tours](.tours) in VS Code through our CAP samples and learn which CAP features are showcased by the different parts of the repository. Just install the [CodeTour extension](https://marketplace.visualstudio.com/items?itemName=vsls-contrib.codetour) for VS Code. We'll add more code tours in the future. Stay tuned!
|
||||||
|
|||||||
3
bookshop/cds-plugin.js
Normal file
3
bookshop/cds-plugin.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
cds.once('bootstrap',(app)=>{
|
||||||
|
app.serve ('/bookshop') .from ('@capire/bookshop','app/vue')
|
||||||
|
})
|
||||||
@@ -4,15 +4,10 @@
|
|||||||
* currencies, if not obtained through @capire/common.
|
* currencies, if not obtained through @capire/common.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = async (tx)=>{
|
// NOTE: We use cds.on('served') to delay the UPSERTs after the db init
|
||||||
|
// to run after all INSERTs from .csv files happened.
|
||||||
const has_common = tx.model.definitions['sap.common.Currencies']?.elements.numcode
|
module.exports = cds.on('served', ()=> cds.run(
|
||||||
if (has_common) return
|
UPSERT.into ('sap.common.Currencies') .columns (
|
||||||
|
|
||||||
const already_filled = await tx.exists('sap.common.Currencies',{code:'EUR'})
|
|
||||||
if (already_filled) return
|
|
||||||
|
|
||||||
await tx.run (INSERT.into ('sap.common.Currencies') .columns (
|
|
||||||
[ 'code', 'symbol', 'name' ]
|
[ 'code', 'symbol', 'name' ]
|
||||||
) .rows (
|
) .rows (
|
||||||
[ 'EUR', '€', 'Euro' ],
|
[ 'EUR', '€', 'Euro' ],
|
||||||
@@ -20,5 +15,5 @@ module.exports = async (tx)=>{
|
|||||||
[ 'GBP', '£', 'British Pound' ],
|
[ 'GBP', '£', 'British Pound' ],
|
||||||
[ 'ILS', '₪', 'Shekel' ],
|
[ 'ILS', '₪', 'Shekel' ],
|
||||||
[ 'JPY', '¥', 'Yen' ],
|
[ 'JPY', '¥', 'Yen' ],
|
||||||
|
)
|
||||||
))
|
))
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ namespace sap.capire.bookshop;
|
|||||||
|
|
||||||
entity Books : managed {
|
entity Books : managed {
|
||||||
key ID : Integer;
|
key ID : Integer;
|
||||||
title : localized String(111);
|
title : localized String(111) @mandatory ;
|
||||||
descr : localized String(1111);
|
descr : localized String(1111);
|
||||||
author : Association to Authors;
|
author : Association to Authors @mandatory;
|
||||||
genre : Association to Genres;
|
genre : Association to Genres;
|
||||||
stock : Integer;
|
stock : Integer;
|
||||||
price : Decimal;
|
price : Decimal;
|
||||||
@@ -15,7 +15,7 @@ entity Books : managed {
|
|||||||
|
|
||||||
entity Authors : managed {
|
entity Authors : managed {
|
||||||
key ID : Integer;
|
key ID : Integer;
|
||||||
name : String(111);
|
name : String(111) @mandatory;
|
||||||
dateOfBirth : Date;
|
dateOfBirth : Date;
|
||||||
dateOfDeath : Date;
|
dateOfDeath : Date;
|
||||||
placeOfBirth : String;
|
placeOfBirth : String;
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
"index.cds",
|
"index.cds",
|
||||||
"index.js"
|
"index.js"
|
||||||
],
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"@cap-js/sqlite": "*"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sap/cds": ">=5.9",
|
"@sap/cds": ">=5.9",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
@@ -21,7 +24,9 @@
|
|||||||
},
|
},
|
||||||
"cds": {
|
"cds": {
|
||||||
"requires": {
|
"requires": {
|
||||||
"db": "sql"
|
"bookshop-services": {
|
||||||
|
"model": "@capire/bookshop"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
using { sap.capire.bookshop as my } from '../db/schema';
|
using { sap.capire.bookshop as my } from '../db/schema';
|
||||||
service AdminService @(requires:'admin') {
|
service AdminService @(requires:'admin', path:'/admin') {
|
||||||
entity Books as projection on my.Books;
|
entity Books as projection on my.Books;
|
||||||
entity Authors as projection on my.Authors;
|
entity Authors as projection on my.Authors;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Exposes user information
|
* Exposes user information
|
||||||
*/
|
*/
|
||||||
service UserService {
|
service UserService @(path: '/user') {
|
||||||
/**
|
/**
|
||||||
* The current user
|
* The current user
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"@capire/reviews": "*",
|
"@capire/reviews": "*",
|
||||||
"@capire/orders": "*",
|
"@capire/orders": "*",
|
||||||
"@capire/common": "*",
|
"@capire/common": "*",
|
||||||
|
"@capire/fiori": "*",
|
||||||
"@capire/data-viewer": "*",
|
"@capire/data-viewer": "*",
|
||||||
"@sap/cds": ">=5",
|
"@sap/cds": ">=5",
|
||||||
"express": "^4.17.1"
|
"express": "^4.17.1"
|
||||||
|
|||||||
@@ -1,22 +1,18 @@
|
|||||||
const cds = require ('@sap/cds')
|
const cds = require ('@sap/cds')
|
||||||
|
|
||||||
|
// Add routes to UIs from imported packages
|
||||||
|
cds.once('bootstrap',(app)=>{
|
||||||
|
app.serve ('/admin-authors') .from ('@capire/fiori','app/admin-authors')
|
||||||
|
app.serve ('/admin-books') .from ('@capire/fiori','app/admin-books')
|
||||||
|
app.serve ('/browse-books') .from ('@capire/fiori','app/browse')
|
||||||
|
})
|
||||||
|
|
||||||
// Add mashup logic
|
// Add mashup logic
|
||||||
cds.once('served', require('./srv/mashup'))
|
cds.once('served', require('./srv/mashup'))
|
||||||
|
|
||||||
// Add routes to UIs from imported packages
|
|
||||||
cds.once('bootstrap',(app)=>{
|
|
||||||
app.serve ('/bookshop') .from ('@capire/bookshop','app/vue')
|
|
||||||
app.serve ('/reviews') .from ('@capire/reviews','app/vue')
|
|
||||||
app.serve ('/orders') .from('@capire/orders','app/orders')
|
|
||||||
app.serve ('/data') .from('@capire/data-viewer','app/viewer')
|
|
||||||
})
|
|
||||||
|
|
||||||
// Add Swagger UI
|
// Add Swagger UI
|
||||||
require('./srv/swagger-ui')
|
require('./srv/swagger-ui')
|
||||||
|
|
||||||
// Returning cds.server
|
|
||||||
module.exports = cds.server
|
|
||||||
|
|
||||||
// For didactic reasons in capire
|
// For didactic reasons in capire
|
||||||
const { ReviewsService, OrdersService } = cds.requires
|
const { ReviewsService, OrdersService } = cds.requires
|
||||||
if (!ReviewsService?.credentials && !OrdersService?.credentials) cds.requires.messaging = false
|
if (!ReviewsService?.credentials && !OrdersService?.credentials) cds.requires.messaging = false
|
||||||
|
|||||||
@@ -30,13 +30,3 @@ extend Orders with {
|
|||||||
book : Association to Books on product.ID = book.ID
|
book : Association to Books on product.ID = book.ID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add orders fiori app (in case of embedded orders service)
|
|
||||||
using from '@capire/orders/app/fiori';
|
|
||||||
|
|
||||||
// Add data browser
|
|
||||||
using from '@capire/data-viewer';
|
|
||||||
|
|
||||||
// Incorporate pre-build extensions from...
|
|
||||||
using from '@capire/common';
|
|
||||||
|
|||||||
0
common/cds-plugin.js
Normal file
0
common/cds-plugin.js
Normal file
@@ -4,5 +4,12 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sap/cds": "*"
|
"@sap/cds": "*"
|
||||||
|
},
|
||||||
|
"cds": {
|
||||||
|
"requires": {
|
||||||
|
"common-data": {
|
||||||
|
"model": "@capire/common"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
168
compose/app/appconfig/fioriSandboxConfig.json
Normal file
168
compose/app/appconfig/fioriSandboxConfig.json
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
{
|
||||||
|
"services": {
|
||||||
|
"LaunchPage": {
|
||||||
|
"adapter": {
|
||||||
|
"config": {
|
||||||
|
"catalogs": [],
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"id": "Bookshop",
|
||||||
|
"title": "Bookshop",
|
||||||
|
"isPreset": true,
|
||||||
|
"isVisible": true,
|
||||||
|
"isGroupLocked": false,
|
||||||
|
"tiles": [
|
||||||
|
{
|
||||||
|
"id": "BrowseBooks",
|
||||||
|
"tileType": "sap.ushell.ui.tile.StaticTile",
|
||||||
|
"properties": {
|
||||||
|
"title": "Browse Books",
|
||||||
|
"targetURL": "#Books-display"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "BrowseGenres",
|
||||||
|
"tileType": "sap.ushell.ui.tile.StaticTile",
|
||||||
|
"properties": {
|
||||||
|
"title": "Browse Genres (OData v2)",
|
||||||
|
"targetURL": "#Genres-display"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "Administration",
|
||||||
|
"title": "Administration",
|
||||||
|
"isPreset": true,
|
||||||
|
"isVisible": true,
|
||||||
|
"isGroupLocked": false,
|
||||||
|
"tiles": [
|
||||||
|
{
|
||||||
|
"id": "ManageBooks",
|
||||||
|
"tileType": "sap.ushell.ui.tile.StaticTile",
|
||||||
|
"properties": {
|
||||||
|
"title": "Manage Books",
|
||||||
|
"targetURL": "#Books-manage"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ManageAuthors",
|
||||||
|
"tileType": "sap.ushell.ui.tile.StaticTile",
|
||||||
|
"properties": {
|
||||||
|
"title": "Manage Authors",
|
||||||
|
"targetURL": "#Authors-display"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "ManageOrders",
|
||||||
|
"tileType": "sap.ushell.ui.tile.StaticTile",
|
||||||
|
"properties": {
|
||||||
|
"title": "Manage Orders",
|
||||||
|
"targetURL": "#Orders-manage"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"NavTargetResolution": {
|
||||||
|
"config": {
|
||||||
|
"enableClientSideTargetResolution": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ClientSideTargetResolution": {
|
||||||
|
"adapter": {
|
||||||
|
"config": {
|
||||||
|
"inbounds": {
|
||||||
|
"BrowseBooks": {
|
||||||
|
"semanticObject": "Books",
|
||||||
|
"action": "display",
|
||||||
|
"title": "Browse Books",
|
||||||
|
"signature": {
|
||||||
|
"parameters": {
|
||||||
|
"Books.ID": {
|
||||||
|
"renameTo": "ID"
|
||||||
|
},
|
||||||
|
"Authors.books.ID": {
|
||||||
|
"renameTo": "ID"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalParameters": "ignored"
|
||||||
|
},
|
||||||
|
"resolutionResult": {
|
||||||
|
"applicationType": "SAPUI5",
|
||||||
|
"additionalInformation": "SAPUI5.Component=bookshop",
|
||||||
|
"url": "/browse/webapp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"BrowseAuthors": {
|
||||||
|
"semanticObject": "Authors",
|
||||||
|
"action": "display",
|
||||||
|
"title": "Browse Authors",
|
||||||
|
"signature": {
|
||||||
|
"parameters": {
|
||||||
|
"Books.author.ID":{
|
||||||
|
"renameTo": "ID"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalParameters": "ignored"
|
||||||
|
},
|
||||||
|
"resolutionResult": {
|
||||||
|
"applicationType": "SAPUI5",
|
||||||
|
"additionalInformation": "SAPUI5.Component=authors",
|
||||||
|
"url": "/admin-authors/webapp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"BrowseGenres": {
|
||||||
|
"semanticObject": "Genres",
|
||||||
|
"action": "display",
|
||||||
|
"title": "Browse Genres",
|
||||||
|
"signature": {
|
||||||
|
"parameters": {
|
||||||
|
"Genre.ID": {
|
||||||
|
"renameTo": "ID"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalParameters": "ignored"
|
||||||
|
},
|
||||||
|
"resolutionResult": {
|
||||||
|
"applicationType": "SAPUI5",
|
||||||
|
"additionalInformation": "SAPUI5.Component=genres",
|
||||||
|
"url": "/genres/webapp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ManageBooks": {
|
||||||
|
"semanticObject": "Books",
|
||||||
|
"action": "manage",
|
||||||
|
"title": "Manage Books",
|
||||||
|
"signature": {
|
||||||
|
"parameters": {},
|
||||||
|
"additionalParameters": "allowed"
|
||||||
|
},
|
||||||
|
"resolutionResult": {
|
||||||
|
"applicationType": "SAPUI5",
|
||||||
|
"additionalInformation": "SAPUI5.Component=books",
|
||||||
|
"url": "/admin-books/webapp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ManageOrders": {
|
||||||
|
"semanticObject": "Orders",
|
||||||
|
"action": "manage",
|
||||||
|
"signature": {
|
||||||
|
"parameters": {},
|
||||||
|
"additionalParameters": "allowed"
|
||||||
|
},
|
||||||
|
"resolutionResult": {
|
||||||
|
"applicationType": "SAPUI5",
|
||||||
|
"additionalInformation": "SAPUI5.Component=orders",
|
||||||
|
"url": "/orders/webapp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
compose/package.json
Normal file
12
compose/package.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "@capire/bookstore",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@capire/bookshop": "*",
|
||||||
|
"@capire/reviews": "*",
|
||||||
|
"@capire/fiori": "*",
|
||||||
|
"@capire/orders": "*",
|
||||||
|
"@sap/cds": ">=5",
|
||||||
|
"express": "^4.17.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
8
compose/server.js
Normal file
8
compose/server.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
const cds = require ('@sap/cds')
|
||||||
|
|
||||||
|
// Add Swagger UI
|
||||||
|
require('./srv/swagger-ui')
|
||||||
|
|
||||||
|
// For didactic reasons in capire
|
||||||
|
const { ReviewsService, OrdersService } = cds.requires
|
||||||
|
if (!ReviewsService?.credentials && !OrdersService?.credentials) cds.requires.messaging = false
|
||||||
10
compose/srv/swagger-ui.js
Normal file
10
compose/srv/swagger-ui.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
// Adding Swagger UI - see https://cap.cloud.sap/docs/advanced/openapi
|
||||||
|
const cds = require ('@sap/cds')
|
||||||
|
try {
|
||||||
|
const cds_swagger = require ('cds-swagger-ui-express')
|
||||||
|
cds.once ('bootstrap', app => app.use (cds_swagger()) )
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code !== 'MODULE_NOT_FOUND') throw err
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/* global Vue axios */ //> from vue.html
|
/* global Vue axios */ //> from vue.html
|
||||||
const GET = (url) => axios.get('/-data'+url)
|
const GET = (url) => axios.get('/odata/v4/-data'+url)
|
||||||
const storageGet = (key, def) => localStorage.getItem('data-viewer:'+key) || def
|
const storageGet = (key, def) => localStorage.getItem('data-viewer:'+key) || def
|
||||||
const storageSet = (key, val) => localStorage.setItem('data-viewer:'+key, val)
|
const storageSet = (key, val) => localStorage.setItem('data-viewer:'+key, val)
|
||||||
const columnKeysFirst = (c1, c2) => {
|
const columnKeysFirst = (c1, c2) => {
|
||||||
|
|||||||
3
data-viewer/cds-plugin.js
Normal file
3
data-viewer/cds-plugin.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
cds.once('bootstrap',(app)=>{
|
||||||
|
app.serve ('/data') .from('@capire/data-viewer','app/viewer')
|
||||||
|
})
|
||||||
@@ -9,5 +9,12 @@
|
|||||||
"app",
|
"app",
|
||||||
"srv",
|
"srv",
|
||||||
"index.cds"
|
"index.cds"
|
||||||
]
|
],
|
||||||
|
"cds": {
|
||||||
|
"requires": {
|
||||||
|
"orders-service": {
|
||||||
|
"model": "@capire/data-viewer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
"resources": "resources.json",
|
"resources": "resources.json",
|
||||||
"dataSources": {
|
"dataSources": {
|
||||||
"main": {
|
"main": {
|
||||||
"uri": "/v2/browse",
|
"uri": "/odata/v2/browse",
|
||||||
"type": "OData",
|
"type": "OData",
|
||||||
"settings": {
|
"settings": {
|
||||||
"annotations": ["localAnnotations"],
|
"annotations": ["localAnnotations"],
|
||||||
|
|||||||
9
fiori/cds-plugin.js
Normal file
9
fiori/cds-plugin.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// install OData v2 adapter
|
||||||
|
const cds = require("@sap/cds")
|
||||||
|
const proxy = require('@cap-js-community/odata-v2-adapter')
|
||||||
|
const opts = global.it ? { target:'auto' } : {} // for tests, set 'auto' to detect port dynamically
|
||||||
|
cds.once('bootstrap', app => {
|
||||||
|
app.use(proxy(opts)) // install proxy
|
||||||
|
// cds.log('cov2ap','silent') // suppress anoying log outpout, e.g. for `npm run mocha -- --reporter nyan`
|
||||||
|
app.serve ('/fiori-apps') .from ('@capire/fiori','app/fiori-apps.html')
|
||||||
|
})
|
||||||
@@ -1 +1,8 @@
|
|||||||
|
using from './db/sqlite/index';
|
||||||
|
using from './app/services';
|
||||||
|
using from './app/genres/fiori-service';
|
||||||
|
using from './app/browse/fiori-service';
|
||||||
|
using from './app/admin-books/fiori-service';
|
||||||
|
using from './app/admin-authors/fiori-service';
|
||||||
using from './db/common';
|
using from './db/common';
|
||||||
|
using from './app/common';
|
||||||
@@ -22,6 +22,9 @@
|
|||||||
"kind": "odata",
|
"kind": "odata",
|
||||||
"model": "@capire/orders"
|
"model": "@capire/orders"
|
||||||
},
|
},
|
||||||
|
"self": {
|
||||||
|
"model": "@capire/fiori"
|
||||||
|
},
|
||||||
"messaging": {
|
"messaging": {
|
||||||
"[production]": {
|
"[production]": {
|
||||||
"kind": "enterprise-messaging"
|
"kind": "enterprise-messaging"
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ const cds = require("@sap/cds")
|
|||||||
const proxy = require('@cap-js-community/odata-v2-adapter')
|
const proxy = require('@cap-js-community/odata-v2-adapter')
|
||||||
const opts = global.it ? { target:'auto' } : {} // for tests, set 'auto' to detect port dynamically
|
const opts = global.it ? { target:'auto' } : {} // for tests, set 'auto' to detect port dynamically
|
||||||
cds.on('bootstrap', app => app.use(proxy(opts))) // install proxy
|
cds.on('bootstrap', app => app.use(proxy(opts))) // install proxy
|
||||||
cds.log('cov2ap','silent') // suppress anoying log outpout, e.g. for `npm run mocha -- --reporter nyan`
|
// cds.log('cov2ap','silent') // suppress anoying log outpout, e.g. for `npm run mocha -- --reporter nyan`
|
||||||
|
|
||||||
module.exports = require('@capire/bookstore/server.js')
|
module.exports = require('@capire/bookstore/server.js')
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
service say {
|
service say @(path: '/say') {
|
||||||
function hello (to:String) returns String;
|
function hello (to:String) returns String;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"i18n": "i18n/i18n.properties",
|
"i18n": "i18n/i18n.properties",
|
||||||
"dataSources": {
|
"dataSources": {
|
||||||
"OrdersService": {
|
"OrdersService": {
|
||||||
"uri": "/orders/",
|
"uri": "/odata/v4/orders/",
|
||||||
"type": "OData",
|
"type": "OData",
|
||||||
"settings": {
|
"settings": {
|
||||||
"odataVersion": "4.0"
|
"odataVersion": "4.0"
|
||||||
|
|||||||
3
orders/cds-plugin.js
Normal file
3
orders/cds-plugin.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
cds.once('bootstrap',(app)=>{
|
||||||
|
app.serve ('/orders') .from('@capire/orders','app/orders')
|
||||||
|
})
|
||||||
@@ -4,5 +4,12 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@capire/common": "*",
|
"@capire/common": "*",
|
||||||
"@sap/cds": ">=5"
|
"@sap/cds": ">=5"
|
||||||
|
},
|
||||||
|
"cds": {
|
||||||
|
"requires": {
|
||||||
|
"orders-service": {
|
||||||
|
"model": "@capire/orders"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
938
package-lock.json
generated
938
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
|||||||
"repository": "https://github.com/sap-samples/cloud-cap-samples.git",
|
"repository": "https://github.com/sap-samples/cloud-cap-samples.git",
|
||||||
"author": "daniel.hutzel@sap.com",
|
"author": "daniel.hutzel@sap.com",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sap/cds": ">=5.5.3"
|
"@sap/cds": ">=7"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"./bookshop",
|
"./bookshop",
|
||||||
|
|||||||
3
reviews/cds-plugin.js
Normal file
3
reviews/cds-plugin.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
cds.once('bootstrap',(app)=>{
|
||||||
|
app.serve ('/reviews') .from ('@capire/reviews','app/vue')
|
||||||
|
})
|
||||||
@@ -12,6 +12,10 @@
|
|||||||
},
|
},
|
||||||
"cds": {
|
"cds": {
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"ReviewsService": {
|
||||||
|
"kind": "odata",
|
||||||
|
"model": "@capire/reviews"
|
||||||
|
},
|
||||||
"messaging": {
|
"messaging": {
|
||||||
"[development]": { "kind": "file-based-messaging" },
|
"[development]": { "kind": "file-based-messaging" },
|
||||||
"[hybrid]": { "kind": "enterprise-messaging-shared" },
|
"[hybrid]": { "kind": "enterprise-messaging-shared" },
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using { sap.capire.reviews as my } from '../db/schema';
|
using { sap.capire.reviews as my } from '../db/schema';
|
||||||
|
|
||||||
service ReviewsService {
|
service ReviewsService @(path:'/reviews') {
|
||||||
|
|
||||||
// Sync API
|
// Sync API
|
||||||
entity Reviews as projection on my.Reviews excluding { likes }
|
entity Reviews as projection on my.Reviews excluding { likes }
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ describe('cap/samples - Fiori APIs - v2', function() {
|
|||||||
// if (this.timeout) this.timeout(1e6)
|
// if (this.timeout) this.timeout(1e6)
|
||||||
|
|
||||||
it('serves $metadata documents in v2', async () => {
|
it('serves $metadata documents in v2', async () => {
|
||||||
const { headers, data } = await GET `/v2/browse/$metadata`
|
const { headers, data } = await GET `/odata/v2/browse/$metadata`
|
||||||
expect(headers).to.contain({
|
expect(headers).to.contain({
|
||||||
'content-type': 'application/xml',
|
'content-type': 'application/xml',
|
||||||
'dataserviceversion': '2.0',
|
'dataserviceversion': '2.0',
|
||||||
@@ -17,7 +17,7 @@ describe('cap/samples - Fiori APIs - v2', function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('serves Books in v2', async () => {
|
it('serves Books in v2', async () => {
|
||||||
const { data } = await GET `/v2/browse/Books`
|
const { data } = await GET `/odata/v2/browse/Books`
|
||||||
expect(data).to.containSubset({d:{results:[]}})
|
expect(data).to.containSubset({d:{results:[]}})
|
||||||
expect(data.d.results.length).to.be.greaterThanOrEqual(5)
|
expect(data.d.results.length).to.be.greaterThanOrEqual(5)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user