Compare commits
52 Commits
graphql
...
d034457-UI
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e08cdf7831 | ||
|
|
1ec44aaecf | ||
|
|
a6ea2fb130 | ||
|
|
1fde0c928b | ||
|
|
fa854a2411 | ||
|
|
40b6acee6a | ||
|
|
a37f1b8e0c | ||
|
|
042ddec41c | ||
|
|
8d8aa6c2c9 | ||
|
|
756ed48ce3 | ||
|
|
19b680ab3d | ||
|
|
33380c0792 | ||
|
|
0d5b65d93f | ||
|
|
dcf5ec6068 | ||
|
|
fb41dd100b | ||
|
|
769aa2b4f5 | ||
|
|
f6c5e620c0 | ||
|
|
7013cb6296 | ||
|
|
6411ce4ea3 | ||
|
|
cd914a8d87 | ||
|
|
b35e92b5bc | ||
|
|
8350aff111 | ||
|
|
9aa604c5a0 | ||
|
|
f5cb53adf8 | ||
|
|
9fe16edc55 | ||
|
|
0093883f25 | ||
|
|
14024a4837 | ||
|
|
2e13b37096 | ||
|
|
7407b0aae3 | ||
|
|
152d088ff4 | ||
|
|
19c886d6dc | ||
|
|
575cffe70a | ||
|
|
03869e5896 | ||
|
|
597afeb3d8 | ||
|
|
d376e6e063 | ||
|
|
2a44cfa9dc | ||
|
|
7964c9aefd | ||
|
|
ce752097d0 | ||
|
|
e838f380c5 | ||
|
|
e89e012eba | ||
|
|
bf0f57efe5 | ||
|
|
40ea057f7f | ||
|
|
31d2f4c932 | ||
|
|
8cc2db7118 | ||
|
|
482b71e60b | ||
|
|
7536451e29 | ||
|
|
2703e8b999 | ||
|
|
ac2e4dd6f9 | ||
|
|
c718fa400d | ||
|
|
730da6e435 | ||
|
|
7d9b4f7a5d | ||
|
|
35d3708592 |
@@ -18,6 +18,7 @@ app.use('/-/:tarball', (req,res,next) => {
|
|||||||
const { tarball } = req.params
|
const { tarball } = req.params
|
||||||
const [, pkg ] = /^\w+-(\w+)/.exec(tarball)
|
const [, pkg ] = /^\w+-(\w+)/.exec(tarball)
|
||||||
fs.lstat(tarball,(err => {
|
fs.lstat(tarball,(err => {
|
||||||
|
if (err) console.debug (`npm pack ../${pkg}`)
|
||||||
if (err) exec(`npm pack ../${pkg}`,{cwd},next)
|
if (err) exec(`npm pack ../${pkg}`,{cwd},next)
|
||||||
else next()
|
else next()
|
||||||
}))
|
}))
|
||||||
@@ -49,7 +50,7 @@ app.get('/*', (req,res)=>{
|
|||||||
"name": package.name,
|
"name": package.name,
|
||||||
"version": package.version,
|
"version": package.version,
|
||||||
"dist": {
|
"dist": {
|
||||||
"tarball": `/-/${tarball}`
|
"tarball": `${server.url}/-/${tarball}`
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -61,7 +62,7 @@ app.get('/*', (req,res)=>{
|
|||||||
})
|
})
|
||||||
|
|
||||||
const server = app.listen(port, ()=>{
|
const server = app.listen(port, ()=>{
|
||||||
const url = `http://localhost:${server.address().port}`
|
const url = server.url = `http://localhost:${server.address().port}`
|
||||||
console.log (`npm set ${scope}:registry=${url}`)
|
console.log (`npm set ${scope}:registry=${url}`)
|
||||||
exec(`npm set ${scope}:registry=${url}`)
|
exec(`npm set ${scope}:registry=${url}`)
|
||||||
console.log (`${scope} registry listening on ${url}`)
|
console.log (`${scope} registry listening on ${url}`)
|
||||||
|
|||||||
@@ -68,26 +68,35 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "fiori/package.json",
|
"file": "fiori/package.json",
|
||||||
"description": "#### Configuration\n\nThe `cds` section in `package.json` is a place to configure which of the `db/sqlite` and `db/hana` folders are used for which database.\nWe use [Node.js profiles](https://cap.cloud.sap/docs/node.js/cds-env#profiles) to separate the configuration.\nIn the `development` profile, you can see that `db/sqlite` is set as the model, while the `db/hana` folder is configured in the `production` profile.",
|
"description": "#### Configuration\n\nThe `cds.requires` section in `package.json` is a place to configure which of the `db/sqlite` and `db/hana` folders are used for which database.\n\nWe use [Node.js profiles](https://cap.cloud.sap/docs/node.js/cds-env#profiles) to separate the configuration.\nIn the `development` profile, you can see that `db/sqlite` is set as the model, while the `db/hana` folder is configured in the `production` profile. `db-ext` is a pseudo datasource, its name doesn't matter.\n\nSee [`cds.resolve`](https://cap.cloud.sap/docs/node.js/cds-compile#cds-resolve) to learn more about how models are found.",
|
||||||
"line": 17,
|
"selection": {
|
||||||
|
"start": {
|
||||||
|
"line": 41,
|
||||||
|
"character": 1
|
||||||
|
},
|
||||||
|
"end": {
|
||||||
|
"line": 48,
|
||||||
|
"character": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
"title": "Configuration"
|
"title": "Configuration"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "fiori/package.json",
|
"file": "fiori/package.json",
|
||||||
"description": "#### Run with SQLite\n\nTo run with `development` and an in-memory SQLite database, you don't need to do anything special, because it's activated by default. Just run:\n\n>> cds watch fiori\n\nThen open [http://localhost:4004/admin/Authors](http://localhost:4004/admin/Authors) to see the two new fields.\n",
|
"description": "#### Run with SQLite\n\nTo run with `development` and an in-memory SQLite database, you don't need to do anything special, because it's activated by default. Just run:\n\n>> cds watch fiori\n\nThen open [http://localhost:4004/admin/Authors](http://localhost:4004/admin/Authors) to see the two new fields.\n",
|
||||||
"line": 28,
|
"line": 43,
|
||||||
"title": "Run with SQLite"
|
"title": "Run with SQLite"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "fiori/package.json",
|
"file": "fiori/package.json",
|
||||||
"description": "#### Deploy the CDS Model to SAP HANA\n\nTo 'activate' SAP HANA through the `production` profile, you can use the global `--production` flag:\n\n>> cd fiori; cds deploy --to hana --production\n\n[Learn more about SAP HANA deployment](https://cap.cloud.sap/docs/guides/databases#get-hana)\n\n#### Run the Application\n\n>> cd fiori; cds watch --production\n\nThe service on [http://localhost:4004/admin/Authors](http://localhost:4004/admin/Authors) is the same as before, but this time the `Authors` entity is backed by a database view with an SAP HANA function.\n\n#### More\n\nIf you don't see data, you can add some in the next step.",
|
"description": "#### Deploy the CDS Model to SAP HANA\n\nTo 'activate' SAP HANA through the `production` profile, you can use the global `--production` flag:\n\n>> cd fiori; cds deploy --to hana --production\n\n[Learn more about SAP HANA deployment](https://cap.cloud.sap/docs/guides/databases#get-hana)\n\n#### Run the Application\n\n>> cd fiori; cds watch --production\n\nThe service on [http://localhost:4004/admin/Authors](http://localhost:4004/admin/Authors) is the same as before, but this time the `Authors` entity is backed by a database view with an SAP HANA function.\n\n#### More\n\nIf you don't see data, you can add some in the next step.",
|
||||||
"line": 31,
|
"line": 46,
|
||||||
"title": "Run with SAP HANA"
|
"title": "Run with SAP HANA"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "fiori/test/requests.http",
|
"file": "fiori/test/requests.http",
|
||||||
"description": "### Add More Data\n\nOptionally you can add some `Authors` data by clicking on the _Send Request_ link (provided by the [REST client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) extension).",
|
"description": "### Add More Data\n\nOptionally you can add some `Authors` data by clicking on the _Send Request_ link (provided by the [REST client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client) extension).",
|
||||||
"line": 68,
|
"line": 72,
|
||||||
"selection": {
|
"selection": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 67,
|
"line": 67,
|
||||||
@@ -104,6 +113,5 @@
|
|||||||
"title": "Wrap-up",
|
"title": "Wrap-up",
|
||||||
"description": "### Summary\n\nThat's it! You have seen: \n- How to integrate database-specific functions in a CDS model.\n- How to switch between the two implementations for SQLite and SAP HANA."
|
"description": "### Summary\n\nThat's it! You have seen: \n- How to integrate database-specific functions in a CDS model.\n- How to switch between the two implementations for SQLite and SAP HANA."
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"ref": "main"
|
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "hello/world.cds",
|
"file": "hello/srv/world.cds",
|
||||||
"description": "### Hello World!\n\nThis is a simplistic [Hello World](https://cap.cloud.sap/docs/get-started/hello-world) service using [CDS](https://cap.cloud.sap/docs/cds/) and [cds.services](https://cap.cloud.sap/docs/node.js/api#services-api).",
|
"description": "### Hello World!\n\nThis is a simplistic [Hello World](https://cap.cloud.sap/docs/get-started/hello-world) service using [CDS](https://cap.cloud.sap/docs/cds/) and [cds.services](https://cap.cloud.sap/docs/node.js/api#services-api).",
|
||||||
"line": 2,
|
"line": 2,
|
||||||
"selection": {
|
"selection": {
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "orders/db/schema.cds",
|
"file": "orders/db/schema.cds",
|
||||||
"description": "### Compositions and Serving Documents\n\nA standalone orders management service, demonstrating:\n- Using [Compositions](https://cap.cloud.sap/docs/cds/cdl#compositions) in [Domain Models](https://cap.cloud.sap/docs/guides/domain-models), along with\n- [Serving deeply nested documents](https://cap.cloud.sap/docs/guides/generic-providers#serving-structured-data)\n",
|
"description": "### Orders - Compositions and Serving Documents\n\nA standalone orders management service, demonstrating:\n- Using [Compositions](https://cap.cloud.sap/docs/cds/cdl#compositions) in [Domain Models](https://cap.cloud.sap/docs/guides/domain-models), along with\n- [Serving deeply nested documents](https://cap.cloud.sap/docs/guides/generic-providers#serving-structured-data)\n",
|
||||||
"line": 1,
|
"line": 1,
|
||||||
"selection": {
|
"selection": {
|
||||||
"start": {
|
"start": {
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "reviews/db/schema.cds",
|
"file": "reviews/db/schema.cds",
|
||||||
"description": "### More Modularity\n\nShows how to implement a modular service to manage product reviews, including:\n- Consuming other services synchronously and asynchronously\n- Serving requests synchronously\n- Emitting events asynchronously\n- Grow as you go, with:\n- Mocking app services\n- Running service meshes\n- Late-cut Micro Services\n- As well as managed data, input validations, and authorization\n",
|
"description": "### Reviews - More Modularity\n\nShows how to implement a modular service to manage product reviews, including:\n- Consuming other services synchronously and asynchronously\n- Serving requests synchronously\n- Emitting events asynchronously\n- Grow as you go, with:\n- Mocking app services\n- Running service meshes\n- Late-cut Micro Services\n- As well as managed data, input validations, and authorization\n",
|
||||||
"line": 1,
|
"line": 1,
|
||||||
"selection": {
|
"selection": {
|
||||||
"start": {
|
"start": {
|
||||||
@@ -99,8 +99,12 @@
|
|||||||
"title": "Reviews"
|
"title": "Reviews"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "fiori/app/index.cds",
|
"title": "Bookstore",
|
||||||
"description": "### Annotations for SAP Fiori Elements\n\nA [composite app, reusing and combining](https://cap.cloud.sap/docs/guides/verticalize) these packages:\n - [@capire/bookshop](bookshop)\n - [@capire/reviews](reviews)\n - [@capire/orders](orders)\n - [@capire/common](common)\n\n[Adds a SAP Fiori elements application](https://cap.cloud.sap/docs/guides/fiori/) to bookshop, thereby introducing to:\n - [OData Annotations](https://cap.cloud.sap/docs/guides/fiori#adding-odata-annotations) in `.cds` files\n - Support for [Fiori Draft](https://cap.cloud.sap/docs/guides/fiori#draft)\n - Support for [Value Helps](https://cap.cloud.sap/docs/guides/fiori#value-help)\n - Serving SAP Fiori apps locally\n\n[The Vue.js app](bookshop/app/vue) imported from bookshop is served as well.\n",
|
"description": "### Bookstore - Reuse and UI\n\n- A [composite app, reusing and combining](https://cap.cloud.sap/docs/guides/reuse-and-compose) these packages:\n - [@capire/bookshop](bookshop)\n - [@capire/reviews](reviews)\n - [@capire/orders](orders)\n - [@capire/common](common)\n- [The Vue.js app](bookshop/app/vue) imported from bookshop is served as well\n- [The Vue.js app](reviews/app/vue) imported from reviews is served as well\n- [The Fiori app](orders/app) imported from orders is served as well\n- [OpenAPI export + Swagger UI](https://cap.cloud.sap/docs/advanced/openapi)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "fiori/app/services.cds",
|
||||||
|
"description": "### Annotations for SAP Fiori Elements\n\n- [Adds an SAP Fiori elements application](https://cap.cloud.sap/docs/guides/fiori/) to bookstore, thereby introducing to:\n- [OData Annotations](https://cap.cloud.sap/docs/guides/fiori#adding-odata-annotations) in `.cds` files\n- Support for [Fiori Draft](https://cap.cloud.sap/docs/guides/fiori#draft)\n- Support for [Value Helps](https://cap.cloud.sap/docs/guides/fiori#value-help)\n- Serving SAP Fiori apps locally\n",
|
||||||
"line": 1,
|
"line": 1,
|
||||||
"selection": {
|
"selection": {
|
||||||
"start": {
|
"start": {
|
||||||
@@ -117,14 +121,13 @@
|
|||||||
{
|
{
|
||||||
"file": "package.json",
|
"file": "package.json",
|
||||||
"description": "### All-in-one Monorepo\n\nEach sample sub directory essentially is a standard npm package, some with standard npm dependencies to other samples. The root folder's [package.json](package.json) has local links to the sub folders, such that an `npm install` populates a local `node_modules` folder acts like a local npm registry to the individual sample packages.\n",
|
"description": "### All-in-one Monorepo\n\nEach sample sub directory essentially is a standard npm package, some with standard npm dependencies to other samples. The root folder's [package.json](package.json) has local links to the sub folders, such that an `npm install` populates a local `node_modules` folder acts like a local npm registry to the individual sample packages.\n",
|
||||||
"line": 8,
|
|
||||||
"selection": {
|
"selection": {
|
||||||
"start": {
|
"start": {
|
||||||
"line": 8,
|
"line": 8,
|
||||||
"character": 1
|
"character": 1
|
||||||
},
|
},
|
||||||
"end": {
|
"end": {
|
||||||
"line": 15,
|
"line": 16,
|
||||||
"character": 1
|
"character": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -133,4 +136,4 @@
|
|||||||
],
|
],
|
||||||
"isPrimary": true,
|
"isPrimary": true,
|
||||||
"description": "Overview of CAP Samples for Node.js"
|
"description": "Overview of CAP Samples for Node.js"
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using { Currency, managed, sap } from '@sap/cds/common';
|
using { Currency, managed, sap, extensible } from '@sap/cds/common';
|
||||||
namespace sap.capire.bookshop;
|
namespace sap.capire.bookshop;
|
||||||
|
|
||||||
entity Books : managed {
|
entity Books : managed, extensible {
|
||||||
key ID : Integer;
|
key ID : Integer;
|
||||||
title : localized String(111);
|
title : localized String(111);
|
||||||
descr : localized String(1111);
|
descr : localized String(1111);
|
||||||
@@ -13,7 +13,7 @@ entity Books : managed {
|
|||||||
image : LargeBinary @Core.MediaType : 'image/png';
|
image : LargeBinary @Core.MediaType : 'image/png';
|
||||||
}
|
}
|
||||||
|
|
||||||
entity Authors : managed {
|
entity Authors : managed, extensible {
|
||||||
key ID : Integer;
|
key ID : Integer;
|
||||||
name : String(111);
|
name : String(111);
|
||||||
dateOfBirth : Date;
|
dateOfBirth : Date;
|
||||||
|
|||||||
@@ -7,13 +7,12 @@ class CatalogService extends cds.ApplicationService { init(){
|
|||||||
// Reduce stock of ordered books if available stock suffices
|
// Reduce stock of ordered books if available stock suffices
|
||||||
this.on ('submitOrder', async req => {
|
this.on ('submitOrder', async req => {
|
||||||
const {book,quantity} = req.data
|
const {book,quantity} = req.data
|
||||||
|
if (quantity < 1) return req.reject (400,`quantity has to be 1 or more`)
|
||||||
let {stock} = await SELECT `stock` .from (Books,book)
|
let {stock} = await SELECT `stock` .from (Books,book)
|
||||||
if (stock >= quantity) {
|
if (quantity > stock) return req.reject (409,`${quantity} exceeds stock for book #${book}`)
|
||||||
await UPDATE (Books,book) .with (`stock -=`, quantity)
|
await UPDATE (Books,book) .with ({ stock: stock -= quantity })
|
||||||
await this.emit ('OrderedBook', { book, quantity, buyer:req.user.id })
|
await this.emit ('OrderedBook', { book, quantity, buyer:req.user.id })
|
||||||
return { stock }
|
return { stock }
|
||||||
}
|
|
||||||
else return req.error (409,`${quantity} exceeds stock for book #${book}`)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Add some discount for overstocked books
|
// Add some discount for overstocked books
|
||||||
|
|||||||
@@ -32,6 +32,19 @@ GET {{server}}/admin/Authors?
|
|||||||
# &sap-language=de
|
# &sap-language=de
|
||||||
Authorization: Basic alice:
|
Authorization: Basic alice:
|
||||||
|
|
||||||
|
### ------------------------------------------------------------------------
|
||||||
|
# Create Author
|
||||||
|
POST {{server}}/admin/Authors
|
||||||
|
Content-Type: application/json;IEEE754Compatible=true
|
||||||
|
Authorization: Basic alice:
|
||||||
|
|
||||||
|
{
|
||||||
|
"ID": 112,
|
||||||
|
"name": "Shakespeeeeere",
|
||||||
|
"age": 22
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
### ------------------------------------------------------------------------
|
### ------------------------------------------------------------------------
|
||||||
# Create book
|
# Create book
|
||||||
POST {{server}}/admin/Books
|
POST {{server}}/admin/Books
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
2
bookstore/index.cds
Normal file
2
bookstore/index.cds
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
namespace sap.capire.bookshop; //> important for reflection
|
||||||
|
using from './srv/mashup';
|
||||||
@@ -25,13 +25,7 @@
|
|||||||
"[production]": { "kind": "enterprise-messaging" }
|
"[production]": { "kind": "enterprise-messaging" }
|
||||||
},
|
},
|
||||||
"db": {
|
"db": {
|
||||||
"kind": "sql",
|
"kind": "sql"
|
||||||
"[development]": {
|
|
||||||
"model": "db/sqlite"
|
|
||||||
},
|
|
||||||
"[production]": {
|
|
||||||
"model": "db/hana"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"log": { "service": true }
|
"log": { "service": true }
|
||||||
|
|||||||
@@ -20,9 +20,11 @@ extend Books with {
|
|||||||
//
|
//
|
||||||
// Extend Orders with Books as Products
|
// Extend Orders with Books as Products
|
||||||
//
|
//
|
||||||
using { sap.capire.orders.Orders_Items } from '@capire/orders';
|
using { sap.capire.orders.Orders } from '@capire/orders';
|
||||||
extend Orders_Items with {
|
extend Orders with {
|
||||||
book : Association to Books on product.ID = book.ID
|
extend Items with {
|
||||||
|
book : Association to Books on product.ID = book.ID
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
47
fiori/app/admin-authors/fiori-service.cds
Normal file
47
fiori/app/admin-authors/fiori-service.cds
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using {AdminService} from '@capire/bookshop';
|
||||||
|
|
||||||
|
annotate AdminService.Authors with @odata.draft.enabled;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Authors Object Page
|
||||||
|
//
|
||||||
|
annotate AdminService.Authors with @(UI : {
|
||||||
|
HeaderInfo : {
|
||||||
|
TypeName : 'Author',
|
||||||
|
TypeNamePlural : 'Authors',
|
||||||
|
Description : {Value : lifetime}
|
||||||
|
},
|
||||||
|
Facets : [
|
||||||
|
{
|
||||||
|
$Type : 'UI.ReferenceFacet',
|
||||||
|
Label : '{i18n>Details}',
|
||||||
|
Target : '@UI.FieldGroup#Details'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$Type : 'UI.ReferenceFacet',
|
||||||
|
Label : '{i18n>Books}',
|
||||||
|
Target : 'books/@UI.LineItem'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
FieldGroup #Details : {Data : [
|
||||||
|
{Value : placeOfBirth},
|
||||||
|
{Value : placeOfDeath},
|
||||||
|
{Value : dateOfBirth},
|
||||||
|
{Value : dateOfDeath},
|
||||||
|
{
|
||||||
|
Value : age,
|
||||||
|
Label : '{i18n>Age}'
|
||||||
|
},
|
||||||
|
]},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Workaround to avoid errors for unknown db-specific calculated fields above
|
||||||
|
extend sap.capire.bookshop.Authors with {
|
||||||
|
virtual age : Integer;
|
||||||
|
virtual lifetime : String;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workaround for Fiori popup for asking user to enter a new UUID on Create
|
||||||
|
annotate AdminService.Authors with { ID @Core.Computed; }
|
||||||
7
fiori/app/admin-authors/webapp/Component.js
Normal file
7
fiori/app/admin-authors/webapp/Component.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
sap.ui.define(["sap/fe/core/AppComponent"], function (AppComponent) {
|
||||||
|
"use strict";
|
||||||
|
return AppComponent.extend("authors.Component", {
|
||||||
|
metadata: { manifest: "json" },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/* eslint no-undef:0 */
|
||||||
11
fiori/app/admin-authors/webapp/i18n/i18n.properties
Normal file
11
fiori/app/admin-authors/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 Authors
|
||||||
|
|
||||||
|
# JCI app descriptor contains lower case DESCRIPTION
|
||||||
|
appSubTitle=Bookshop Authors
|
||||||
|
|
||||||
|
# JCI app descriptor contains lower case DESCRIPTION
|
||||||
|
appDescription=Bookshop Authors
|
||||||
145
fiori/app/admin-authors/webapp/manifest.json
Normal file
145
fiori/app/admin-authors/webapp/manifest.json
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
{
|
||||||
|
"_version": "1.28.0",
|
||||||
|
"sap.app": {
|
||||||
|
"id": "authors",
|
||||||
|
"type": "application",
|
||||||
|
"title": "Manage Authors",
|
||||||
|
"description": "Sample Application",
|
||||||
|
"i18n": "i18n/i18n.properties",
|
||||||
|
"applicationVersion": {
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
|
"dataSources": {
|
||||||
|
"AdminService": {
|
||||||
|
"uri": "/admin/",
|
||||||
|
"type": "OData",
|
||||||
|
"settings": {
|
||||||
|
"odataVersion": "4.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceTemplate": {
|
||||||
|
"id": "ui5template.basicSAPUI5ApplicationProject",
|
||||||
|
"-id": "ui5template.smartTemplate",
|
||||||
|
"version": "1.40.12"
|
||||||
|
},
|
||||||
|
"crossNavigation": {
|
||||||
|
"inbounds": {
|
||||||
|
"intent1": {
|
||||||
|
"signature": {
|
||||||
|
"parameters": {
|
||||||
|
"Books.author.ID":{
|
||||||
|
"renameTo": "ID"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalParameters": "ignored"
|
||||||
|
},
|
||||||
|
"semanticObject": "Authors",
|
||||||
|
"action": "display",
|
||||||
|
"title": "{{appTitle}}",
|
||||||
|
"info": "{{appInfo}}",
|
||||||
|
"subTitle": "{{appSubTitle}}",
|
||||||
|
"icon": "sap-icon://SAP-icons-TNT/user",
|
||||||
|
"indicatorDataSource": {
|
||||||
|
"dataSource": "AdminService",
|
||||||
|
"path": "Authors/$count",
|
||||||
|
"refresh": 1800
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sap.ui5": {
|
||||||
|
"flexEnabled": true,
|
||||||
|
"config": {
|
||||||
|
"experimentalCAPScenario": true
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"minUI5Version": "1.81.0",
|
||||||
|
"libs": {
|
||||||
|
"sap.fe.templates": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models": {
|
||||||
|
"i18n": {
|
||||||
|
"type": "sap.ui.model.resource.ResourceModel",
|
||||||
|
"uri": "i18n/i18n.properties"
|
||||||
|
},
|
||||||
|
"": {
|
||||||
|
"dataSource": "AdminService",
|
||||||
|
"settings": {
|
||||||
|
"synchronizationMode": "None",
|
||||||
|
"operationMode": "Server",
|
||||||
|
"autoExpandSelect": true,
|
||||||
|
"earlyRequests": true,
|
||||||
|
"groupProperties": {
|
||||||
|
"default": {
|
||||||
|
"submit": "Auto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"routing": {
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"pattern": ":?query:",
|
||||||
|
"name": "AuthorsList",
|
||||||
|
"target": "AuthorsList"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pattern": "Authors({key}):?query:",
|
||||||
|
"name": "AuthorsDetails",
|
||||||
|
"target": "AuthorsDetails"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"targets": {
|
||||||
|
"AuthorsList": {
|
||||||
|
"type": "Component",
|
||||||
|
"id": "AuthorsList",
|
||||||
|
"name": "sap.fe.templates.ListReport",
|
||||||
|
"options": {
|
||||||
|
"settings": {
|
||||||
|
"entitySet": "Authors",
|
||||||
|
"initialLoad": true,
|
||||||
|
"navigation": {
|
||||||
|
"Authors": {
|
||||||
|
"detail": {
|
||||||
|
"route": "AuthorsDetails"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AuthorsDetails": {
|
||||||
|
"type": "Component",
|
||||||
|
"id": "AuthorsDetailsList",
|
||||||
|
"name": "sap.fe.templates.ObjectPage",
|
||||||
|
"options": {
|
||||||
|
"settings": {
|
||||||
|
"entitySet": "Authors"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contentDensities": {
|
||||||
|
"compact": true,
|
||||||
|
"cozy": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sap.ui": {
|
||||||
|
"technology": "UI5",
|
||||||
|
"fullWidth": false,
|
||||||
|
"deviceTypes":{
|
||||||
|
"desktop": true,
|
||||||
|
"tablet": true,
|
||||||
|
"phone": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sap.fiori": {
|
||||||
|
"registrationIds": [],
|
||||||
|
"archeType": "transactional"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using { AdminService } from '@capire/bookshop';
|
using { AdminService } from '@capire/bookstore';
|
||||||
using from '../common'; // to help UI linter get the complete annotations
|
using from '../common'; // to help UI linter get the complete annotations
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -40,27 +40,6 @@ annotate AdminService.Books with @(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
annotate AdminService.Authors with @(
|
|
||||||
UI: {
|
|
||||||
HeaderInfo: {
|
|
||||||
Description: {Value: lifetime}
|
|
||||||
},
|
|
||||||
Facets: [
|
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'},
|
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Books}', Target: 'books/@UI.LineItem'},
|
|
||||||
],
|
|
||||||
FieldGroup#Details: {
|
|
||||||
Data: [
|
|
||||||
{Value: placeOfBirth},
|
|
||||||
{Value: placeOfDeath},
|
|
||||||
{Value: dateOfBirth},
|
|
||||||
{Value: dateOfDeath},
|
|
||||||
{Value: age, Label: '{i18n>Age}'},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -85,10 +64,14 @@ annotate AdminService.Books.texts with @(
|
|||||||
|
|
||||||
// Add Value Help for Locales
|
// Add Value Help for Locales
|
||||||
annotate AdminService.Books.texts {
|
annotate AdminService.Books.texts {
|
||||||
locale @ValueList:{entity:'Languages',type:#fixed}
|
locale @ValueList:{entity:'Languages'};
|
||||||
|
locale @Common.ValueListWithFixedValues:true; //show as drop down, not a dialog
|
||||||
}
|
}
|
||||||
// In addition we need to expose Languages through AdminService as a target for ValueList
|
// In addition we need to expose Languages through AdminService as a target for ValueList
|
||||||
using { sap } from '@sap/cds/common';
|
using { sap } from '@sap/cds/common';
|
||||||
extend service AdminService {
|
extend service AdminService {
|
||||||
@readonly entity Languages as projection on sap.common.Languages;
|
@readonly entity Languages as projection on sap.common.Languages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Workaround for Fiori popup for asking user to enter a new UUID on Create
|
||||||
|
annotate AdminService.Books with { ID @Core.Computed; }
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
sap.ui.define(["sap/fe/core/AppComponent"], function(AppComponent) {
|
sap.ui.define(["sap/fe/core/AppComponent"], function(AppComponent) {
|
||||||
"use strict";
|
"use strict";
|
||||||
return AppComponent.extend("admin.Component", {
|
return AppComponent.extend("books.Component", {
|
||||||
metadata: { manifest: "json" }
|
metadata: { manifest: "json" }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_version": "1.8.0",
|
"_version": "1.8.0",
|
||||||
"sap.app": {
|
"sap.app": {
|
||||||
"id": "admin",
|
"id": "books",
|
||||||
"type": "application",
|
"type": "application",
|
||||||
"title": "Manage Books",
|
"title": "Manage Books",
|
||||||
"description": "Sample Application",
|
"description": "Sample Application",
|
||||||
@@ -22,6 +22,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sap.ui5": {
|
"sap.ui5": {
|
||||||
|
"flexEnabled": true,
|
||||||
|
"config": {
|
||||||
|
"experimentalCAPScenario": true
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"libs": {
|
"libs": {
|
||||||
"sap.fe.templates": {}
|
"sap.fe.templates": {}
|
||||||
@@ -73,6 +77,7 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"settings" : {
|
"settings" : {
|
||||||
"entitySet" : "Books",
|
"entitySet" : "Books",
|
||||||
|
"initialLoad": true,
|
||||||
"navigation" : {
|
"navigation" : {
|
||||||
"Books" : {
|
"Books" : {
|
||||||
"detail" : {
|
"detail" : {
|
||||||
142
fiori/app/appconfig/fioriSandboxConfig.json
Normal file
142
fiori/app/appconfig/fioriSandboxConfig.json
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
{
|
||||||
|
"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": "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"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,50 +1,60 @@
|
|||||||
using CatalogService from '@capire/bookshop';
|
using CatalogService from '@capire/bookstore';
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Books Object Page
|
// Books Object Page
|
||||||
//
|
//
|
||||||
annotate CatalogService.Books with @(
|
annotate CatalogService.Books with @(UI : {
|
||||||
UI: {
|
HeaderInfo : {
|
||||||
HeaderInfo: {
|
TypeName : 'Book',
|
||||||
TypeName: 'Book',
|
TypeNamePlural : 'Books',
|
||||||
TypeNamePlural: 'Books',
|
Description : {Value : author}
|
||||||
Description: {Value: author}
|
},
|
||||||
},
|
HeaderFacets : [{
|
||||||
HeaderFacets: [
|
$Type : 'UI.ReferenceFacet',
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Description}', Target: '@UI.FieldGroup#Descr'},
|
Label : '{i18n>Description}',
|
||||||
],
|
Target : '@UI.FieldGroup#Descr'
|
||||||
Facets: [
|
}, ],
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Price'},
|
Facets : [{
|
||||||
],
|
$Type : 'UI.ReferenceFacet',
|
||||||
FieldGroup#Descr: {
|
Label : '{i18n>Details}',
|
||||||
Data: [
|
Target : '@UI.FieldGroup#Price'
|
||||||
{Value: descr},
|
}, ],
|
||||||
]
|
FieldGroup #Descr : {Data : [{Value : descr}, ]},
|
||||||
},
|
FieldGroup #Price : {Data : [
|
||||||
FieldGroup#Price: {
|
{Value : price},
|
||||||
Data: [
|
{
|
||||||
{Value: price},
|
Value : currency.symbol,
|
||||||
{Value: currency.symbol, Label: '{i18n>Currency}'},
|
Label : '{i18n>Currency}'
|
||||||
]
|
},
|
||||||
},
|
]},
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Books Object Page
|
// Books Object Page
|
||||||
//
|
//
|
||||||
annotate CatalogService.Books with @(
|
annotate CatalogService.Books with @(UI : {
|
||||||
UI: {
|
SelectionFields : [
|
||||||
SelectionFields: [ ID, price, currency_code ],
|
ID,
|
||||||
LineItem: [
|
price,
|
||||||
{Value: title},
|
currency_code
|
||||||
{Value: author, Label:'{i18n>Author}'},
|
],
|
||||||
{Value: genre.name},
|
LineItem : [
|
||||||
{Value: price},
|
{
|
||||||
{Value: currency.symbol, Label:' '},
|
Value : ID,
|
||||||
]
|
Label : '{i18n>Title}'
|
||||||
},
|
},
|
||||||
);
|
{
|
||||||
|
Value : author,
|
||||||
|
Label : '{i18n>Author}'
|
||||||
|
},
|
||||||
|
{Value : genre.name},
|
||||||
|
{Value : price},
|
||||||
|
{
|
||||||
|
Value : currency.symbol,
|
||||||
|
Label : ' '
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}, );
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
{
|
{
|
||||||
"_version": "1.8.0",
|
"_version": "1.28.0",
|
||||||
"sap.app": {
|
"sap.app": {
|
||||||
"id": "bookshop",
|
"id": "bookshop",
|
||||||
"type": "application",
|
"type": "application",
|
||||||
"title": "Browse Books",
|
"title": "Browse Books",
|
||||||
"description": "Sample Application",
|
"description": "Sample Application",
|
||||||
"i18n": "i18n/i18n.properties",
|
"i18n": "i18n/i18n.properties",
|
||||||
|
"applicationVersion": {
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
"dataSources": {
|
"dataSources": {
|
||||||
"CatalogService": {
|
"CatalogService": {
|
||||||
"uri": "/browse/",
|
"uri": "/browse/",
|
||||||
@@ -15,14 +18,43 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"-sourceTemplate": {
|
"sourceTemplate": {
|
||||||
"id": "ui5template.basicSAPUI5ApplicationProject",
|
"id": "ui5template.basicSAPUI5ApplicationProject",
|
||||||
"-id": "ui5template.smartTemplate",
|
"-id": "ui5template.smartTemplate",
|
||||||
"-version": "1.40.12"
|
"version": "1.40.12"
|
||||||
|
},
|
||||||
|
"crossNavigation": {
|
||||||
|
"inbounds": {
|
||||||
|
"intent1": {
|
||||||
|
"signature": {
|
||||||
|
"parameters": {
|
||||||
|
"Books.ID":{
|
||||||
|
"renameTo": "ID"
|
||||||
|
},
|
||||||
|
"Authors.books.ID": {
|
||||||
|
"renameTo": "ID"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalParameters": "ignored"
|
||||||
|
},
|
||||||
|
"semanticObject": "Books",
|
||||||
|
"action": "display",
|
||||||
|
"title": "{{appTitle}}",
|
||||||
|
"info": "{{appInfo}}",
|
||||||
|
"subTitle": "{{appSubTitle}}",
|
||||||
|
"icon": "sap-icon://course-book",
|
||||||
|
"indicatorDataSource": {
|
||||||
|
"dataSource": "CatalogService",
|
||||||
|
"path": "Books/$count",
|
||||||
|
"refresh": 1800
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sap.ui5": {
|
"sap.ui5": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"minUI5Version": "1.81.0",
|
||||||
"libs": {
|
"libs": {
|
||||||
"sap.fe.templates": {}
|
"sap.fe.templates": {}
|
||||||
}
|
}
|
||||||
@@ -68,6 +100,7 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"settings": {
|
"settings": {
|
||||||
"entitySet": "Books",
|
"entitySet": "Books",
|
||||||
|
"initialLoad": true,
|
||||||
"navigation": {
|
"navigation": {
|
||||||
"Books": {
|
"Books": {
|
||||||
"detail": {
|
"detail": {
|
||||||
@@ -97,7 +130,12 @@
|
|||||||
},
|
},
|
||||||
"sap.ui": {
|
"sap.ui": {
|
||||||
"technology": "UI5",
|
"technology": "UI5",
|
||||||
"fullWidth": false
|
"fullWidth": false,
|
||||||
|
"deviceTypes":{
|
||||||
|
"desktop": true,
|
||||||
|
"tablet": true,
|
||||||
|
"phone": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"sap.fiori": {
|
"sap.fiori": {
|
||||||
"registrationIds": [],
|
"registrationIds": [],
|
||||||
|
|||||||
@@ -1,8 +1,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 '@capire/bookstore';
|
||||||
using { sap.common } from '@capire/common';
|
using { sap.common } from '@capire/common';
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -10,39 +10,52 @@ using { sap.common } from '@capire/common';
|
|||||||
// Books Lists
|
// Books Lists
|
||||||
//
|
//
|
||||||
annotate my.Books with @(
|
annotate my.Books with @(
|
||||||
Common.SemanticKey: [title],
|
Common.SemanticKey : [ID],
|
||||||
UI: {
|
UI : {
|
||||||
Identification: [{Value:title}],
|
Identification : [{Value : title}],
|
||||||
SelectionFields: [ ID, author_ID, price, currency_code ],
|
SelectionFields : [
|
||||||
LineItem: [
|
ID,
|
||||||
{Value: ID},
|
author_ID,
|
||||||
{Value: title},
|
price,
|
||||||
{Value: author.name, Label:'{i18n>Author}'},
|
currency_code
|
||||||
{Value: genre.name},
|
],
|
||||||
{Value: stock},
|
LineItem : [
|
||||||
{Value: price},
|
{
|
||||||
{Value: currency.symbol, Label:' '},
|
Value : ID,
|
||||||
]
|
Label : '{i18n>Title}'
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
Value : author.ID,
|
||||||
|
Label : '{i18n>Author}'
|
||||||
|
},
|
||||||
|
{Value : genre.name},
|
||||||
|
{Value : stock},
|
||||||
|
{Value : price},
|
||||||
|
{
|
||||||
|
Value : currency.symbol,
|
||||||
|
Label : ' '
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
author @ValueList.entity:'Authors';
|
ID @Common: {
|
||||||
|
SemanticObject : 'Books',
|
||||||
|
Text: title,
|
||||||
|
TextArrangement : #TextOnly
|
||||||
|
};
|
||||||
|
author @ValueList.entity : 'Authors';
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Books Details
|
// Books Details
|
||||||
//
|
//
|
||||||
annotate my.Books with @(
|
annotate my.Books with @(UI : {HeaderInfo : {
|
||||||
UI: {
|
TypeName : '{i18n>Book}',
|
||||||
HeaderInfo: {
|
TypeNamePlural : '{i18n>Books}',
|
||||||
TypeName: '{i18n>Book}',
|
Title : {Value : title},
|
||||||
TypeNamePlural: '{i18n>Books}',
|
Description : {Value : author.name}
|
||||||
Title: {Value: title},
|
}, });
|
||||||
Description: {Value: author.name}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -50,13 +63,19 @@ annotate my.Books with @(
|
|||||||
// Books Elements
|
// Books Elements
|
||||||
//
|
//
|
||||||
annotate my.Books with {
|
annotate my.Books with {
|
||||||
ID @title:'{i18n>ID}' @UI.HiddenFilter;
|
ID @title : '{i18n>ID}';
|
||||||
title @title:'{i18n>Title}';
|
title @title : '{i18n>Title}';
|
||||||
genre @title:'{i18n>Genre}' @Common: { Text: genre.name, TextArrangement: #TextOnly };
|
genre @title : '{i18n>Genre}' @Common : {
|
||||||
author @title:'{i18n>Author}' @Common: { Text: author.name, TextArrangement: #TextOnly };
|
Text : genre.name,
|
||||||
price @title:'{i18n>Price}' @Measures.ISOCurrency: currency_code;
|
TextArrangement : #TextOnly
|
||||||
stock @title:'{i18n>Stock}';
|
};
|
||||||
descr @UI.MultiLineText;
|
author @title : '{i18n>Author}' @Common : {
|
||||||
|
Text : author.name,
|
||||||
|
TextArrangement : #TextOnly
|
||||||
|
};
|
||||||
|
price @title : '{i18n>Price}' @Measures.ISOCurrency : currency_code;
|
||||||
|
stock @title : '{i18n>Stock}';
|
||||||
|
descr @UI.MultiLineText;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -64,42 +83,45 @@ annotate my.Books with {
|
|||||||
// Genres List
|
// Genres List
|
||||||
//
|
//
|
||||||
annotate my.Genres with @(
|
annotate my.Genres with @(
|
||||||
Common.SemanticKey: [name],
|
Common.SemanticKey : [name],
|
||||||
UI: {
|
UI : {
|
||||||
SelectionFields: [ name ],
|
SelectionFields : [name],
|
||||||
LineItem:[
|
LineItem : [
|
||||||
{Value: name},
|
{Value : name},
|
||||||
{Value: parent.name, Label: 'Main Genre'},
|
{
|
||||||
],
|
Value : parent.name,
|
||||||
}
|
Label : 'Main Genre'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Genre Details
|
// Genre Details
|
||||||
//
|
//
|
||||||
annotate my.Genres with @(
|
annotate my.Genres with @(UI : {
|
||||||
UI: {
|
Identification : [{Value : name}],
|
||||||
Identification: [{Value:name}],
|
HeaderInfo : {
|
||||||
HeaderInfo: {
|
TypeName : '{i18n>Genre}',
|
||||||
TypeName: '{i18n>Genre}',
|
TypeNamePlural : '{i18n>Genres}',
|
||||||
TypeNamePlural: '{i18n>Genres}',
|
Title : {Value : name},
|
||||||
Title: {Value: name},
|
Description : {Value : ID}
|
||||||
Description: {Value: ID}
|
},
|
||||||
},
|
Facets : [{
|
||||||
Facets: [
|
$Type : 'UI.ReferenceFacet',
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>SubGenres}', Target: 'children/@UI.LineItem'},
|
Label : '{i18n>SubGenres}',
|
||||||
],
|
Target : 'children/@UI.LineItem'
|
||||||
}
|
}, ],
|
||||||
);
|
});
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Genres Elements
|
// Genres Elements
|
||||||
//
|
//
|
||||||
annotate my.Genres with {
|
annotate my.Genres with {
|
||||||
ID @title: '{i18n>ID}';
|
ID @title : '{i18n>ID}';
|
||||||
name @title: '{i18n>Genre}';
|
name @title : '{i18n>Genre}';
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -107,38 +129,42 @@ annotate my.Genres with {
|
|||||||
// Authors List
|
// Authors List
|
||||||
//
|
//
|
||||||
annotate my.Authors with @(
|
annotate my.Authors with @(
|
||||||
Common.SemanticKey: [name],
|
Common.SemanticKey : [ID],
|
||||||
UI: {
|
UI : {
|
||||||
Identification: [{Value:name}],
|
Identification : [{Value : name}],
|
||||||
SelectionFields: [ name ],
|
SelectionFields : [name],
|
||||||
LineItem:[
|
LineItem : [
|
||||||
{Value: ID},
|
{Value : ID},
|
||||||
{Value: name},
|
{Value : dateOfBirth},
|
||||||
{Value: dateOfBirth},
|
{Value : dateOfDeath},
|
||||||
{Value: dateOfDeath},
|
{Value : placeOfBirth},
|
||||||
{Value: placeOfBirth},
|
{Value : placeOfDeath},
|
||||||
{Value: placeOfDeath},
|
],
|
||||||
],
|
}
|
||||||
}
|
) {
|
||||||
);
|
ID @Common: {
|
||||||
|
SemanticObject : 'Authors',
|
||||||
|
Text: name,
|
||||||
|
TextArrangement : #TextOnly,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Author Details
|
// Author Details
|
||||||
//
|
//
|
||||||
annotate my.Authors with @(
|
annotate my.Authors with @(UI : {
|
||||||
UI: {
|
HeaderInfo : {
|
||||||
HeaderInfo: {
|
TypeName : '{i18n>Author}',
|
||||||
TypeName: '{i18n>Author}',
|
TypeNamePlural : '{i18n>Authors}',
|
||||||
TypeNamePlural: '{i18n>Authors}',
|
Title : {Value : name},
|
||||||
Title: {Value: name},
|
Description : {Value : dateOfBirth}
|
||||||
Description: {Value: dateOfBirth}
|
},
|
||||||
},
|
Facets : [{
|
||||||
Facets: [
|
$Type : 'UI.ReferenceFacet',
|
||||||
{$Type: 'UI.ReferenceFacet', Target: 'books/@UI.LineItem'},
|
Target : 'books/@UI.LineItem'
|
||||||
],
|
}, ],
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -146,12 +172,12 @@ annotate my.Authors with @(
|
|||||||
// Authors Elements
|
// Authors Elements
|
||||||
//
|
//
|
||||||
annotate my.Authors with {
|
annotate my.Authors with {
|
||||||
ID @title:'{i18n>ID}' @UI.HiddenFilter;
|
ID @title : '{i18n>ID}';
|
||||||
name @title:'{i18n>Name}';
|
name @title : '{i18n>Name}';
|
||||||
dateOfBirth @title:'{i18n>DateOfBirth}';
|
dateOfBirth @title : '{i18n>DateOfBirth}';
|
||||||
dateOfDeath @title:'{i18n>DateOfDeath}';
|
dateOfDeath @title : '{i18n>DateOfDeath}';
|
||||||
placeOfBirth @title:'{i18n>PlaceOfBirth}';
|
placeOfBirth @title : '{i18n>PlaceOfBirth}';
|
||||||
placeOfDeath @title:'{i18n>PlaceOfDeath}';
|
placeOfDeath @title : '{i18n>PlaceOfDeath}';
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -159,99 +185,105 @@ annotate my.Authors with {
|
|||||||
// Languages List
|
// Languages List
|
||||||
//
|
//
|
||||||
annotate common.Languages with @(
|
annotate common.Languages with @(
|
||||||
Common.SemanticKey: [code],
|
Common.SemanticKey : [code],
|
||||||
Identification: [{Value:code}],
|
Identification : [{Value : code}],
|
||||||
UI: {
|
UI : {
|
||||||
SelectionFields: [ name, descr ],
|
SelectionFields : [
|
||||||
LineItem:[
|
name,
|
||||||
{Value: code},
|
descr
|
||||||
{Value: name},
|
],
|
||||||
],
|
LineItem : [
|
||||||
}
|
{Value : code},
|
||||||
|
{Value : name},
|
||||||
|
],
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Language Details
|
// Language Details
|
||||||
//
|
//
|
||||||
annotate common.Languages with @(
|
annotate common.Languages with @(UI : {
|
||||||
UI: {
|
HeaderInfo : {
|
||||||
HeaderInfo: {
|
TypeName : '{i18n>Language}',
|
||||||
TypeName: '{i18n>Language}',
|
TypeNamePlural : '{i18n>Languages}',
|
||||||
TypeNamePlural: '{i18n>Languages}',
|
Title : {Value : name},
|
||||||
Title: {Value: name},
|
Description : {Value : descr}
|
||||||
Description: {Value: descr}
|
},
|
||||||
},
|
Facets : [{
|
||||||
Facets: [
|
$Type : 'UI.ReferenceFacet',
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'},
|
Label : '{i18n>Details}',
|
||||||
],
|
Target : '@UI.FieldGroup#Details'
|
||||||
FieldGroup#Details: {
|
}, ],
|
||||||
Data: [
|
FieldGroup #Details : {Data : [
|
||||||
{Value: code},
|
{Value : code},
|
||||||
{Value: name},
|
{Value : name},
|
||||||
{Value: descr}
|
{Value : descr}
|
||||||
]
|
]},
|
||||||
},
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Currencies List
|
// Currencies List
|
||||||
//
|
//
|
||||||
annotate common.Currencies with @(
|
annotate common.Currencies with @(
|
||||||
Common.SemanticKey: [code],
|
Common.SemanticKey : [code],
|
||||||
Identification: [{Value:code}],
|
Identification : [{Value : code}],
|
||||||
UI: {
|
UI : {
|
||||||
SelectionFields: [ name, descr ],
|
SelectionFields : [
|
||||||
LineItem:[
|
name,
|
||||||
{Value: descr},
|
descr
|
||||||
{Value: symbol},
|
],
|
||||||
{Value: code},
|
LineItem : [
|
||||||
],
|
{Value : descr},
|
||||||
}
|
{Value : symbol},
|
||||||
|
{Value : code},
|
||||||
|
],
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Currency Details
|
// Currency Details
|
||||||
//
|
//
|
||||||
annotate common.Currencies with @(
|
annotate common.Currencies with @(UI : {
|
||||||
UI: {
|
HeaderInfo : {
|
||||||
HeaderInfo: {
|
TypeName : '{i18n>Currency}',
|
||||||
TypeName: '{i18n>Currency}',
|
TypeNamePlural : '{i18n>Currencies}',
|
||||||
TypeNamePlural: '{i18n>Currencies}',
|
Title : {Value : descr},
|
||||||
Title: {Value: descr},
|
Description : {Value : code}
|
||||||
Description: {Value: code}
|
},
|
||||||
},
|
Facets : [
|
||||||
Facets: [
|
{
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'},
|
$Type : 'UI.ReferenceFacet',
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Extended}', Target: '@UI.FieldGroup#Extended'},
|
Label : '{i18n>Details}',
|
||||||
],
|
Target : '@UI.FieldGroup#Details'
|
||||||
FieldGroup#Details: {
|
},
|
||||||
Data: [
|
{
|
||||||
{Value: name},
|
$Type : 'UI.ReferenceFacet',
|
||||||
{Value: symbol},
|
Label : '{i18n>Extended}',
|
||||||
{Value: code},
|
Target : '@UI.FieldGroup#Extended'
|
||||||
{Value: descr}
|
},
|
||||||
]
|
],
|
||||||
},
|
FieldGroup #Details : {Data : [
|
||||||
FieldGroup#Extended: {
|
{Value : name},
|
||||||
Data: [
|
{Value : symbol},
|
||||||
{Value: numcode},
|
{Value : code},
|
||||||
{Value: minor},
|
{Value : descr}
|
||||||
{Value: exponent}
|
]},
|
||||||
]
|
FieldGroup #Extended : {Data : [
|
||||||
},
|
{Value : numcode},
|
||||||
}
|
{Value : minor},
|
||||||
);
|
{Value : exponent}
|
||||||
|
]},
|
||||||
|
});
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Currencies Elements
|
// Currencies Elements
|
||||||
//
|
//
|
||||||
annotate common.Currencies with {
|
annotate common.Currencies with {
|
||||||
numcode @title:'{i18n>NumCode}';
|
numcode @title : '{i18n>NumCode}';
|
||||||
minor @title:'{i18n>MinorUnit}';
|
minor @title : '{i18n>MinorUnit}';
|
||||||
exponent @title:'{i18n>Exponent}';
|
exponent @title : '{i18n>Exponent}';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,32 +10,21 @@
|
|||||||
<script>
|
<script>
|
||||||
window["sap-ushell-config"] = {
|
window["sap-ushell-config"] = {
|
||||||
defaultRenderer: "fiori2",
|
defaultRenderer: "fiori2",
|
||||||
applications: {
|
applications: {},
|
||||||
"browse-books": {
|
bootstrapPlugins: {
|
||||||
title: "Browse Books",
|
RuntimeAuthoringPlugin: {
|
||||||
description: "w/ SAP Fiori Elements",
|
component: "sap.ushell.plugins.rta",
|
||||||
additionalInformation: "SAPUI5.Component=bookshop",
|
config: {
|
||||||
applicationType : "URL",
|
validateAppVersion: false,
|
||||||
url: "/browse/webapp",
|
},
|
||||||
navigationMode: "embedded"
|
},
|
||||||
},
|
PersonalizePlugin: {
|
||||||
"manage-books": {
|
component: "sap.ushell.plugins.rta-personalize",
|
||||||
title: "Manage Books",
|
config: {
|
||||||
description: "w/ SAP Fiori Elements",
|
validateAppVersion: false,
|
||||||
additionalInformation: "SAPUI5.Component=admin",
|
},
|
||||||
applicationType : "URL",
|
},
|
||||||
url: "/admin/webapp",
|
}
|
||||||
navigationMode: "embedded"
|
|
||||||
},
|
|
||||||
"manage-orders": {
|
|
||||||
title: "Manage Orders",
|
|
||||||
description: "w/ SAP Fiori Elements",
|
|
||||||
additionalInformation: "SAPUI5.Component=orders",
|
|
||||||
applicationType : "URL",
|
|
||||||
url: "/orders/webapp",
|
|
||||||
navigationMode: "embedded"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -47,8 +36,13 @@
|
|||||||
data-sap-ui-frameOptions="allow"
|
data-sap-ui-frameOptions="allow"
|
||||||
></script>
|
></script>
|
||||||
<script>
|
<script>
|
||||||
sap.ui.getCore().attachInit(()=> sap.ushell.Container.createRenderer().placeAt("content"))
|
sap.ui.getCore().attachInit(()=> sap.ushell.Container.createRenderer().placeAt("content"));
|
||||||
</script>
|
sap.ui
|
||||||
|
.getCore()
|
||||||
|
.getConfiguration()
|
||||||
|
.setFlexibilityServices([{ connector: "SessionStorageConnector" }]);
|
||||||
|
sap.ui.getCore().getConfiguration().setLanguage("en");
|
||||||
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="sapUiBody" id="content"></body>
|
<body class="sapUiBody" id="content"></body>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
This model controls what gets served to Fiori frontends...
|
This model controls what gets served to Fiori frontends...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using from './admin/fiori-service';
|
using from './admin-authors/fiori-service';
|
||||||
|
using from './admin-books/fiori-service';
|
||||||
using from './browse/fiori-service';
|
using from './browse/fiori-service';
|
||||||
using from './common';
|
using from './common';
|
||||||
|
|
||||||
using from '@capire/bookstore/srv/mashup';
|
using from '@capire/bookstore/srv/mashup';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Add Author.age and .lifetime with a DB-specific function
|
// Add Author.age and .lifetime with a DB-specific function
|
||||||
//
|
//
|
||||||
|
|
||||||
using { AdminService } from '../schema';
|
using { AdminService } from '@capire/bookshop';
|
||||||
|
|
||||||
extend projection AdminService.Authors with {
|
extend projection AdminService.Authors with {
|
||||||
YEARS_BETWEEN(dateOfBirth, dateOfDeath) as age: Integer,
|
YEARS_BETWEEN(dateOfBirth, dateOfDeath) as age: Integer,
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// Add Author.age and .lifetime with a DB-specific function
|
// Add Author.age and .lifetime with a DB-specific function
|
||||||
//
|
//
|
||||||
|
|
||||||
using { AdminService } from '../schema';
|
using { AdminService } from '@capire/bookshop';
|
||||||
|
|
||||||
extend projection AdminService.Authors with {
|
extend projection AdminService.Authors with {
|
||||||
strftime('%Y',dateOfDeath)-strftime('%Y',dateOfBirth) as age: Integer,
|
strftime('%Y',dateOfDeath)-strftime('%Y',dateOfBirth) as age: Integer,
|
||||||
@@ -13,6 +13,9 @@
|
|||||||
},
|
},
|
||||||
"cds": {
|
"cds": {
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"extensibility": {
|
||||||
|
"kind": "uiflex"
|
||||||
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"strategy": "dummy"
|
"strategy": "dummy"
|
||||||
},
|
},
|
||||||
@@ -25,9 +28,26 @@
|
|||||||
"model": "@capire/orders"
|
"model": "@capire/orders"
|
||||||
},
|
},
|
||||||
"messaging": {
|
"messaging": {
|
||||||
"[production]": { "kind": "enterprise-messaging" },
|
"[production]": {
|
||||||
"[development]": { "kind": "file-based-messaging" },
|
"kind": "enterprise-messaging"
|
||||||
"[hybrid!]": { "kind": "enterprise-messaging-shared" }
|
},
|
||||||
|
"[development]": {
|
||||||
|
"kind": "file-based-messaging"
|
||||||
|
},
|
||||||
|
"[hybrid!]": {
|
||||||
|
"kind": "enterprise-messaging-shared"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"db": {
|
||||||
|
"kind": "sql"
|
||||||
|
},
|
||||||
|
"db-ext": {
|
||||||
|
"[development]": {
|
||||||
|
"model": "db/sqlite"
|
||||||
|
},
|
||||||
|
"[production]": {
|
||||||
|
"model": "db/hana"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"hana": {
|
"hana": {
|
||||||
"deploy-format": "hdbtable"
|
"deploy-format": "hdbtable"
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
"start:ts": "cds-ts serve srv/world.cds"
|
"start:ts": "cds-ts serve srv/world.cds"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.23",
|
"@types/jest": "^27.0.2",
|
||||||
"@types/node": "^15.12.0",
|
"@types/node": "^16.11.6",
|
||||||
"ts-jest": "^27.0.2",
|
"ts-jest": "^27.0.2",
|
||||||
"typescript": "^4.3.5"
|
"typescript": "^4.3.5"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
import type { Request } from "@sap/cds/apis/services"
|
||||||
|
|
||||||
module.exports = class say {
|
module.exports = class say {
|
||||||
hello(req: any) {
|
hello(req: Request) {
|
||||||
return `Hello ${req.data.to} from a TypeScript file!`
|
return `Hello ${req.data.to} from a TypeScript file!`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ annotate OrdersService.Orders with @(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
annotate OrdersService.Orders_Items with @(
|
annotate OrdersService.Orders.Items with @(
|
||||||
UI: {
|
UI: {
|
||||||
LineItem: [
|
LineItem: [
|
||||||
{Value: product_ID, Label:'Product ID'},
|
{Value: product_ID, Label:'Product ID'},
|
||||||
|
|||||||
@@ -3,21 +3,22 @@ namespace sap.capire.orders;
|
|||||||
|
|
||||||
entity Orders : cuid, managed {
|
entity Orders : cuid, managed {
|
||||||
OrderNo : String @title:'Order Number'; //> readable key
|
OrderNo : String @title:'Order Number'; //> readable key
|
||||||
Items : Composition of many Orders_Items on Items.up_ = $self;
|
Items : Composition of many {
|
||||||
|
key ID : UUID;
|
||||||
|
product : Association to Products;
|
||||||
|
quantity : Integer;
|
||||||
|
title : String; //> intentionally replicated as snapshot from product.title
|
||||||
|
price : Double; //> materialized calculated field
|
||||||
|
};
|
||||||
buyer : User;
|
buyer : User;
|
||||||
currency : Currency;
|
currency : Currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity Orders_Items {
|
|
||||||
key ID : UUID;
|
|
||||||
up_ : Association to Orders;
|
|
||||||
product : Association to Products @assert.integrity:false; // REVISIT: this is a temporary workaround for a glitch in cds-runtime
|
|
||||||
quantity : Integer;
|
|
||||||
title : String; //> intentionally replicated as snapshot from product.title
|
|
||||||
price : Double;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This is a stand-in for arbitrary ordered Products */
|
/** This is a stand-in for arbitrary ordered Products */
|
||||||
entity Products @(cds.persistence.skip:'always') {
|
entity Products @(cds.persistence.skip:'always') {
|
||||||
key ID : String;
|
key ID : String;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// this is to ensure we have filled-in currencies
|
||||||
|
using from '@capire/common';
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"name": "@capire/orders",
|
"name": "@capire/orders",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@capire/common": "*",
|
||||||
"@sap/cds": "^5"
|
"@sap/cds": "^5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ class OrdersService extends cds.ApplicationService {
|
|||||||
|
|
||||||
/** register custom handlers */
|
/** register custom handlers */
|
||||||
init(){
|
init(){
|
||||||
const { Orders_Items:OrderItems } = this.entities
|
const { 'Orders.Items':OrderItems } = this.entities
|
||||||
|
|
||||||
this.before ('UPDATE', 'Orders', async function(req) {
|
this.before ('UPDATE', 'Orders', async function(req) {
|
||||||
const { ID, Items } = req.data
|
const { ID, Items } = req.data
|
||||||
|
|||||||
10846
package-lock.json
generated
10846
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
subject;rating;title;text
|
subject;rating;reviewer;title;text
|
||||||
201;5;Intriguing;Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
|
201;5;adam;Intriguing;Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
|
||||||
201;4;Fascinating;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Id diam maecenas ultricies mi eget mauris pharetra et. Risus at ultrices mi tempus imperdiet nulla malesuada pellentesque. Pulvinar mattis nunc sed blandit libero. Facilisis magna etiam tempor orci eu. Nec sagittis aliquam malesuada bibendum arcu. Eu consequat ac felis donec. Ultricies tristique nulla aliquet enim tortor at auctor urna nunc. Tortor posuere ac ut consequat semper viverra nam libero. Amet nisl suscipit adipiscing bibendum est ultricies integer quis auctor. Scelerisque purus semper eget duis at tellus. Elementum tempus egestas sed sed risus pretium. Arcu dictum varius duis at. Amet luctus venenatis lectus magna fringilla urna. Eget velit aliquet sagittis id consectetur purus ut faucibus. Vitae auctor eu augue ut lectus. Fermentum iaculis eu non diam phasellus vestibulum.
|
201;4;bob;Fascinating;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Id diam maecenas ultricies mi eget mauris pharetra et. Risus at ultrices mi tempus imperdiet nulla malesuada pellentesque. Pulvinar mattis nunc sed blandit libero. Facilisis magna etiam tempor orci eu. Nec sagittis aliquam malesuada bibendum arcu. Eu consequat ac felis donec. Ultricies tristique nulla aliquet enim tortor at auctor urna nunc. Tortor posuere ac ut consequat semper viverra nam libero. Amet nisl suscipit adipiscing bibendum est ultricies integer quis auctor. Scelerisque purus semper eget duis at tellus. Elementum tempus egestas sed sed risus pretium. Arcu dictum varius duis at. Amet luctus venenatis lectus magna fringilla urna. Eget velit aliquet sagittis id consectetur purus ut faucibus. Vitae auctor eu augue ut lectus. Fermentum iaculis eu non diam phasellus vestibulum.
|
||||||
207;2;What is this?;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Libero justo laoreet sit amet cursus sit amet dictum. Nunc faucibus a pellentesque sit. Dis parturient montes nascetur ridiculus mus mauris vitae ultricies. Enim nunc faucibus a pellentesque. Commodo quis imperdiet massa tincidunt nunc pulvinar sapien. Cras ornare arcu dui vivamus. Facilisi etiam dignissim diam quis enim lobortis. Et molestie ac feugiat sed. Urna neque viverra justo nec ultrices dui. Ullamcorper a lacus vestibulum sed arcu non. Volutpat ac tincidunt vitae semper quis. Dignissim sodales ut eu sem. Feugiat in fermentum posuere urna nec. At augue eget arcu dictum varius.
|
207;2;bob;What is this?;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Libero justo laoreet sit amet cursus sit amet dictum. Nunc faucibus a pellentesque sit. Dis parturient montes nascetur ridiculus mus mauris vitae ultricies. Enim nunc faucibus a pellentesque. Commodo quis imperdiet massa tincidunt nunc pulvinar sapien. Cras ornare arcu dui vivamus. Facilisi etiam dignissim diam quis enim lobortis. Et molestie ac feugiat sed. Urna neque viverra justo nec ultrices dui. Ullamcorper a lacus vestibulum sed arcu non. Volutpat ac tincidunt vitae semper quis. Dignissim sodales ut eu sem. Feugiat in fermentum posuere urna nec. At augue eget arcu dictum varius.
|
||||||
251;3;It's dark...;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Suscipit tellus mauris a diam. Velit aliquet sagittis id consectetur purus ut. Viverra adipiscing at in tellus integer. Vitae elementum curabitur vitae nunc. Mattis ullamcorper velit sed ullamcorper morbi. Diam quis enim lobortis scelerisque. Auctor neque vitae tempus quam pellentesque nec nam aliquam. Semper auctor neque vitae tempus. Quis eleifend quam adipiscing vitae proin. Neque convallis a cras semper auctor neque vitae. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Sit amet consectetur adipiscing elit ut aliquam purus. Pretium quam vulputate dignissim suspendisse.
|
251;3;bob;It's dark...;Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Suscipit tellus mauris a diam. Velit aliquet sagittis id consectetur purus ut. Viverra adipiscing at in tellus integer. Vitae elementum curabitur vitae nunc. Mattis ullamcorper velit sed ullamcorper morbi. Diam quis enim lobortis scelerisque. Auctor neque vitae tempus quam pellentesque nec nam aliquam. Semper auctor neque vitae tempus. Quis eleifend quam adipiscing vitae proin. Neque convallis a cras semper auctor neque vitae. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Sit amet consectetur adipiscing elit ut aliquam purus. Pretium quam vulputate dignissim suspendisse.
|
||||||
|
@@ -28,14 +28,7 @@ service ReviewsService {
|
|||||||
annotate ReviewsService.Reviews with @restrict:[
|
annotate ReviewsService.Reviews with @restrict:[
|
||||||
{ grant:'READ', to:'any' }, // everybody can read reviews
|
{ grant:'READ', to:'any' }, // everybody can read reviews
|
||||||
{ grant:'CREATE', to:'authenticated-user' }, // users must login to add reviews
|
{ grant:'CREATE', to:'authenticated-user' }, // users must login to add reviews
|
||||||
/////////////////////////////////////////////////
|
{ grant:'UPDATE', to:'authenticated-user', where:'reviewer=$user' },
|
||||||
//
|
|
||||||
// Temporarily disabling this due to glitch in CAP Node.js runtime:
|
|
||||||
// { grant:'UPDATE', to:'authenticated-user', where:'reviewer=$user' },
|
|
||||||
// -> reenable it when the issue is fixed
|
|
||||||
{ grant:'UPDATE', to:'authenticated-user' },
|
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////
|
|
||||||
{ grant:'DELETE', to:'admin' },
|
{ grant:'DELETE', to:'admin' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ Each sub directory essentially is an individual npm package arranged in an [all-
|
|||||||
|
|
||||||
## [@capire/fiori](fiori)
|
## [@capire/fiori](fiori)
|
||||||
|
|
||||||
- [Adds an SAP Fiori elements application](https://cap.cloud.sap/docs/guides/fiori/) to bookshop, thereby introducing to:
|
- [Adds an SAP Fiori elements application](https://cap.cloud.sap/docs/guides/fiori/) to bookstore, thereby introducing to:
|
||||||
- [OData Annotations](https://cap.cloud.sap/docs/guides/fiori#adding-odata-annotations) in `.cds` files
|
- [OData Annotations](https://cap.cloud.sap/docs/guides/fiori#adding-odata-annotations) in `.cds` files
|
||||||
- Support for [Fiori Draft](https://cap.cloud.sap/docs/guides/fiori#draft)
|
- Support for [Fiori Draft](https://cap.cloud.sap/docs/guides/fiori#draft)
|
||||||
- Support for [Value Helps](https://cap.cloud.sap/docs/guides/fiori#value-help)
|
- Support for [Value Helps](https://cap.cloud.sap/docs/guides/fiori#value-help)
|
||||||
|
|||||||
@@ -42,24 +42,132 @@ describe('cds.ql → cqn', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (each === 'SELECT')
|
||||||
test('from Foo [<key>]', () => {
|
test('SELECT ( Foo )', () => {
|
||||||
|
expect({
|
||||||
expect(cqn = SELECT`from Foo[11]`)
|
SELECT: { from: { ref: ['Foo'] } },
|
||||||
.to.eql(SELECT`from Foo[${11}]`)
|
|
||||||
.to.eql(SELECT.from `Foo[11]`)
|
|
||||||
.to.eql(SELECT.from `Foo[${11}]`)
|
|
||||||
.to.eql(SELECT`Foo[11]`)
|
|
||||||
expect.plain(cqn)
|
|
||||||
.to.eql(CQL`SELECT from Foo[11]`)
|
|
||||||
.to.eql(srv.read`Foo[11]`)
|
|
||||||
.to.eql({
|
|
||||||
SELECT: { from: {
|
|
||||||
ref: [{ id: 'Foo', where: [{ val: 11 }] }]
|
|
||||||
}},
|
|
||||||
})
|
})
|
||||||
|
.to.eql(CQL`SELECT from Foo`)
|
||||||
|
.to.eql(SELECT(Foo))
|
||||||
|
})
|
||||||
|
|
||||||
if (cdr) expect.plain (cqn)
|
if (each === 'SELECT')
|
||||||
|
test('SELECT ( Foo ) .from ( Bar )', () => {
|
||||||
|
|
||||||
|
expect({
|
||||||
|
SELECT: { columns:[{ref:['Foo']}], from: { ref: ['Bar'] } },
|
||||||
|
})
|
||||||
|
.to.eql(CQL`SELECT Foo from Bar`)
|
||||||
|
.to.eql(SELECT `Foo` .from `Bar`)
|
||||||
|
.to.eql(SELECT `Foo` .from('Bar'))
|
||||||
|
.to.eql(SELECT('Foo').from('Bar'))
|
||||||
|
.to.eql(SELECT(['Foo']).from('Bar'))
|
||||||
|
.to.eql(SELECT(['Foo']).from('Bar'))
|
||||||
|
.to.eql(SELECT `Bar` .columns `Foo`)
|
||||||
|
.to.eql(SELECT `Bar` .columns ('Foo'))
|
||||||
|
.to.eql(SELECT `Bar` .columns (['Foo']))
|
||||||
|
.to.eql(SELECT.from `Bar` .columns ('Foo'))
|
||||||
|
.to.eql(SELECT.from `Bar` .columns (['Foo']))
|
||||||
|
|
||||||
|
expect({
|
||||||
|
SELECT: { columns:[
|
||||||
|
{ref:['Foo']},
|
||||||
|
{ref:['Boo']},
|
||||||
|
], from: { ref: ['Bar'] } },
|
||||||
|
})
|
||||||
|
.to.eql(CQL`SELECT Foo, Boo from Bar`)
|
||||||
|
.to.eql(SELECT `Foo, Boo` .from `Bar`)
|
||||||
|
.to.eql(SELECT `Foo, Boo` .from('Bar'))
|
||||||
|
.to.eql(SELECT('Foo','Boo').from('Bar'))
|
||||||
|
.to.eql(SELECT(['Foo','Boo']).from('Bar'))
|
||||||
|
.to.eql(SELECT `Bar` .columns `Foo, Boo`)
|
||||||
|
.to.eql(SELECT `Bar` .columns ('Foo','Boo'))
|
||||||
|
.to.eql(SELECT `Bar` .columns (['Foo','Boo']))
|
||||||
|
.to.eql(SELECT.from `Bar` .columns ('Foo','Boo'))
|
||||||
|
.to.eql(SELECT.from `Bar` .columns (['Foo','Boo']))
|
||||||
|
|
||||||
|
expect({
|
||||||
|
SELECT: { columns:[
|
||||||
|
{ref:['Foo']},
|
||||||
|
{ref:['Boo']},
|
||||||
|
{ref:['Moo']},
|
||||||
|
], from: { ref: ['Bar'] } },
|
||||||
|
})
|
||||||
|
.to.eql(CQL`SELECT Foo, Boo, Moo from Bar`)
|
||||||
|
.to.eql(SELECT `Foo, Boo, Moo` .from `Bar`)
|
||||||
|
.to.eql(SELECT `Foo, Boo, Moo` .from('Bar'))
|
||||||
|
.to.eql(SELECT('Foo','Boo','Moo').from('Bar'))
|
||||||
|
.to.eql(SELECT(['Foo','Boo','Moo']).from('Bar'))
|
||||||
|
.to.eql(SELECT `Bar` .columns `Foo, Boo, Moo`)
|
||||||
|
.to.eql(SELECT `Bar` .columns ('Foo','Boo','Moo'))
|
||||||
|
.to.eql(SELECT `Bar` .columns (['Foo','Boo','Moo']))
|
||||||
|
.to.eql(SELECT.from `Bar` .columns ('Foo','Boo','Moo'))
|
||||||
|
.to.eql(SELECT.from `Bar` .columns (['Foo','Boo','Moo']))
|
||||||
|
|
||||||
|
|
||||||
|
expect({
|
||||||
|
SELECT: { one:true, columns:[{ref:['Foo']}], from: { ref: ['Bar'] } },
|
||||||
|
})
|
||||||
|
// .to.eql(CQL`SELECT one Foo from Bar`)
|
||||||
|
.to.eql(SELECT.one `Foo` .from `Bar`)
|
||||||
|
.to.eql(SELECT.one `Foo` .from('Bar'))
|
||||||
|
.to.eql(SELECT.one('Foo').from('Bar'))
|
||||||
|
.to.eql(SELECT.one(['Foo']).from('Bar'))
|
||||||
|
.to.eql(SELECT.one(['Foo']).from('Bar'))
|
||||||
|
.to.eql(SELECT.one('Bar',['Foo']))
|
||||||
|
.to.eql(SELECT.one `Bar` .columns `Foo`)
|
||||||
|
.to.eql(SELECT.one('Bar').columns('Foo'))
|
||||||
|
.to.eql(SELECT.one('Bar').columns(['Foo']))
|
||||||
|
.to.eql(SELECT.one.from('Bar',['Foo']))
|
||||||
|
.to.eql(SELECT.one.from('Bar').columns('Foo'))
|
||||||
|
.to.eql(SELECT.one.from('Bar').columns(['Foo']))
|
||||||
|
|
||||||
|
expect({
|
||||||
|
SELECT: { one:true, columns:[
|
||||||
|
{ref:['Foo']},
|
||||||
|
{ref:['Boo']},
|
||||||
|
], from: { ref: ['Bar'] } },
|
||||||
|
})
|
||||||
|
// .to.eql(CQL`SELECT Foo, Boo from Bar`)
|
||||||
|
.to.eql(SELECT.one `Foo, Boo` .from `Bar`)
|
||||||
|
.to.eql(SELECT.one `Foo, Boo` .from('Bar'))
|
||||||
|
.to.eql(SELECT.one('Foo','Boo').from('Bar'))
|
||||||
|
.to.eql(SELECT.one(['Foo','Boo']).from('Bar'))
|
||||||
|
.to.eql(SELECT.one('Bar',['Foo','Boo']))
|
||||||
|
.to.eql(SELECT.one `Bar` .columns `Foo, Boo`)
|
||||||
|
.to.eql(SELECT.one('Bar').columns('Foo','Boo'))
|
||||||
|
.to.eql(SELECT.one('Bar').columns(['Foo','Boo']))
|
||||||
|
.to.eql(SELECT.one.from('Bar',['Foo','Boo']))
|
||||||
|
.to.eql(SELECT.one.from('Bar').columns('Foo','Boo'))
|
||||||
|
.to.eql(SELECT.one.from('Bar').columns(['Foo','Boo']))
|
||||||
|
|
||||||
|
expect({
|
||||||
|
SELECT: { one:true, columns:[
|
||||||
|
{ref:['Foo']},
|
||||||
|
{ref:['Boo']},
|
||||||
|
{ref:['Moo']},
|
||||||
|
], from: { ref: ['Bar'] } },
|
||||||
|
})
|
||||||
|
// .to.eql(CQL`SELECT Foo, Boo, Moo from Bar`)
|
||||||
|
.to.eql(SELECT.one `Foo, Boo, Moo` .from `Bar`)
|
||||||
|
.to.eql(SELECT.one `Foo, Boo, Moo` .from('Bar'))
|
||||||
|
.to.eql(SELECT.one('Foo','Boo','Moo').from('Bar'))
|
||||||
|
.to.eql(SELECT.one(['Foo','Boo','Moo']).from('Bar'))
|
||||||
|
.to.eql(SELECT.one('Bar',['Foo','Boo','Moo']))
|
||||||
|
.to.eql(SELECT.one `Bar` .columns `Foo, Boo, Moo`)
|
||||||
|
.to.eql(SELECT.one('Bar').columns('Foo','Boo','Moo'))
|
||||||
|
.to.eql(SELECT.one('Bar').columns(['Foo','Boo','Moo']))
|
||||||
|
.to.eql(SELECT.one.from('Bar',['Foo','Boo','Moo']))
|
||||||
|
.to.eql(SELECT.one.from('Bar').columns('Foo','Boo','Moo'))
|
||||||
|
.to.eql(SELECT.one.from('Bar').columns(['Foo','Boo','Moo']))
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
if (each === 'SELECT')
|
||||||
|
test('from ( Foo )', () => {
|
||||||
|
expect({
|
||||||
|
SELECT: { from: {ref: [{ id:'Foo', where: [{val:11}] }] }}
|
||||||
|
})
|
||||||
.to.eql(srv.read`Foo[${11}]`)
|
.to.eql(srv.read`Foo[${11}]`)
|
||||||
.to.eql(SELECT`Foo[${11}]`)
|
.to.eql(SELECT`Foo[${11}]`)
|
||||||
|
|
||||||
@@ -583,7 +691,7 @@ describe('cds.ql → cqn', () => {
|
|||||||
.to.eql(UPDATE(Books).where(`ID=`, 4711))
|
.to.eql(UPDATE(Books).where(`ID=`, 4711))
|
||||||
.to.eql(cqnWhere)
|
.to.eql(cqnWhere)
|
||||||
|
|
||||||
const cqnKey = (cds.version >= '5.6.0') ?
|
const cqnKey = (cds.version >= '5.6.0') ?
|
||||||
{
|
{
|
||||||
UPDATE: {
|
UPDATE: {
|
||||||
entity: { ref: [{ id: 'capire.bookshop.Books', where: [{ ref: ['ID'] }, '=', { val: 4711 }] }] }
|
entity: { ref: [{ id: 'capire.bookshop.Books', where: [{ ref: ['ID'] }, '=', { val: 4711 }] }] }
|
||||||
@@ -657,7 +765,7 @@ describe('cds.ql → cqn', () => {
|
|||||||
expect(DELETE.from(Books).where({ ID: 4711 }))
|
expect(DELETE.from(Books).where({ ID: 4711 }))
|
||||||
.to.eql(DELETE.from(Books).where(`ID=`, 4711))
|
.to.eql(DELETE.from(Books).where(`ID=`, 4711))
|
||||||
.to.eql(cqnWhere)
|
.to.eql(cqnWhere)
|
||||||
const cqnKey = (cds.version >= '5.6.0') ?
|
const cqnKey = (cds.version >= '5.6.0') ?
|
||||||
{
|
{
|
||||||
DELETE: {
|
DELETE: {
|
||||||
from: { ref: [{ id: 'capire.bookshop.Books', where: [{ ref: ['ID'] }, '=', { val: 4711 }]}] }
|
from: { ref: [{ id: 'capire.bookshop.Books', where: [{ ref: ['ID'] }, '=', { val: 4711 }]}] }
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
const cds = require('@sap/cds/lib')
|
const cds = require('@sap/cds/lib')
|
||||||
const {expect} = cds.test
|
const {expect} = cds.test
|
||||||
|
|
||||||
const { parse:cdr } = cds.ql
|
|
||||||
|
|
||||||
// should become cds.compile(...) when cds5 is released
|
// should become cds.compile(...) when cds5 is released
|
||||||
const model = cds.compile.to.csn (`
|
const model = cds.compile.to.csn (`
|
||||||
entity Categories {
|
entity Categories {
|
||||||
@@ -78,9 +76,7 @@ describe('Hierarchical Data', ()=>{
|
|||||||
{ ID:101, name:'Cat' },
|
{ ID:101, name:'Cat' },
|
||||||
{ ID:108, name:'Catweazle' }
|
{ ID:108, name:'Catweazle' }
|
||||||
]
|
]
|
||||||
return 'skipped as this will be fixed in a newer cds version'
|
expect ( await SELECT`ID,name`.from(Cats) ).to.eql (expected)
|
||||||
if (cdr) expect ( await SELECT.from(Cats) ).to.containSubset (expected)
|
|
||||||
else expect ( await SELECT.from(Cats) ).to.eql (expected)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user