Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9af7b242d | ||
|
|
8a55c2e68b |
10
.env
10
.env
@@ -1,8 +1,2 @@
|
|||||||
cds.features.snapi = true
|
cds.features.snapi = y
|
||||||
cds.odata.version = v4
|
cds.cdsc.beta.aspectCompositions = true
|
||||||
cds.odata.containment = true
|
|
||||||
cds.odata.proxies = true
|
|
||||||
cds.odata.format = structured
|
|
||||||
cds.cdsc.beta.uniqueconstraints = true
|
|
||||||
cds.cdsc.beta.aspectCompositions = true
|
|
||||||
cds.cdsc.severities.unexpected-key = info
|
|
||||||
28
.github/workflows/node.js.yml
vendored
28
.github/workflows/node.js.yml
vendored
@@ -1,28 +0,0 @@
|
|||||||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
||||||
|
|
||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [10.x, 12.16.2]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
- run: npm install
|
|
||||||
- run: npm test
|
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
Find here a collection of samples for the [SAP Cloud Application Programming Model](https://cap.cloud.sap) organized in a simplistic [monorepo setup](samples.md#all-in-one-monorepo). → See [**Overview** of contained samples](samples.md)
|
Find here a collection of samples for the [SAP Cloud Application Programming Model](https://cap.cloud.sap) organized in a simplistic [monorepo setup](samples.md#all-in-one-monorepo). → See [**Overview** of contained samples](samples.md)
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Preliminaries
|
### Preliminaries
|
||||||
|
|
||||||
@@ -40,19 +39,19 @@ After that open this link in your browser: [http://localhost:4004](http://localh
|
|||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
Run the provided tests with [_jest_](http://jestjs.io) or [_mocha_](http://mochajs.org), for example:
|
Run the provided tests with [_jest_](http://jestjs.io) or [_mocha_](http://mochajs.org), e.g.:
|
||||||
```sh
|
```sh
|
||||||
npx jest
|
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.
|
||||||
|
|
||||||
|
|
||||||
## Get Support
|
## Get Support
|
||||||
|
|
||||||
Check out the documentation at [https://cap.cloud.sap](https://cap.cloud.sap). <br>
|
Check out the cap docs at [https://cap.cloud.sap](https://cap.cloud.sap). <br>
|
||||||
In case you find a bug or need support, please [open an issue in here](https://github.com/SAP-samples/cloud-cap-samples/issues/new).
|
In case you find a bug or need support, please [open an issue in here](https://github.com/SAP-samples/cloud-cap-samples/issues/new).
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](/LICENSE) file.
|
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](/LICENSE) file.
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
cds.features.snapi = true
|
|
||||||
cds.odata.version = v4
|
|
||||||
cds.odata.containment = true
|
|
||||||
cds.odata.proxies = true
|
|
||||||
cds.odata.format = structured
|
|
||||||
cds.cdsc.beta.uniqueconstraints = true
|
|
||||||
cds.cdsc.beta.aspectCompositions = true
|
|
||||||
cds.cdsc.severities.unexpected-key = info
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
ID;amount;parent_ID;book_ID;netAmount
|
ID;amount;parent_ID;book_ID
|
||||||
58040e66-1dcd-4ffb-ab10-fdce32028b79;1;7e2f2640-6866-4dcf-8f4d-3027aa831cad;201;11.11
|
58040e66-1dcd-4ffb-ab10-fdce32028b79;1;7e2f2640-6866-4dcf-8f4d-3027aa831cad;201
|
||||||
64e718c9-ff99-47f1-8ca3-950c850777d4;1;7e2f2640-6866-4dcf-8f4d-3027aa831cad;271;15
|
64e718c9-ff99-47f1-8ca3-950c850777d4;1;7e2f2640-6866-4dcf-8f4d-3027aa831cad;271
|
||||||
e9641166-e050-4261-bfee-d1e797e6cb7f;2;64e718c9-ff99-47f1-8ca3-950c850777d4;252;28
|
e9641166-e050-4261-bfee-d1e797e6cb7f;2;64e718c9-ff99-47f1-8ca3-950c850777d4;252
|
||||||
|
@@ -4,13 +4,10 @@ namespace sap.capire.bookshop;
|
|||||||
|
|
||||||
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 OrderItems on Items.parent = $self;
|
Items : Composition of many {
|
||||||
|
key pos : Integer;
|
||||||
|
book : Association to Books;
|
||||||
|
amount : Integer;
|
||||||
|
};
|
||||||
currency : Currency;
|
currency : Currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity OrderItems : cuid {
|
|
||||||
parent : Association to Orders;
|
|
||||||
book : Association to Books;
|
|
||||||
amount : Integer;
|
|
||||||
netAmount : Decimal(9,2);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
using { sap.capire.bookshop.Authors } from '@capire/bookshop';
|
|
||||||
|
|
||||||
define view Foo as select from Authors {
|
|
||||||
ID, name, books[where title like 'Cat%'].currency.code
|
|
||||||
};
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
using { User, cuid, managed } from '@sap/cds/common';
|
|
||||||
|
|
||||||
// Looks like inheritance, but isn't
|
|
||||||
entity Foo @bar : cuid, managed { bar:Car; }
|
|
||||||
|
|
||||||
// It's just syntactical sugar for Aspects
|
|
||||||
entity Boo {}
|
|
||||||
extend Boo with cuid;
|
|
||||||
extend Boo with managed;
|
|
||||||
extend Boo with { bar:Car; }
|
|
||||||
annotate Boo with @bar;
|
|
||||||
|
|
||||||
// There's close to no limits
|
|
||||||
entity Moo : Foo {}
|
|
||||||
entity Zoo {}; extend Zoo with Foo;
|
|
||||||
|
|
||||||
// This one will apply to all uses above
|
|
||||||
type Car : String;
|
|
||||||
annotate Car with @car;
|
|
||||||
|
|
||||||
// And these to all uses here and wherever else
|
|
||||||
extend managed with {
|
|
||||||
notes : String;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CDS is built with CDS
|
|
||||||
annotate cds.UUID with @odata.Type: 'Edm.Integer';
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
using { CatalogService } from '@capire/bookshop';
|
|
||||||
|
|
||||||
extend sap.capire.bookshop.Books with {
|
|
||||||
ISBN : String;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** your docs go here */
|
|
||||||
extend projection CatalogService.Books with {
|
|
||||||
ISBN
|
|
||||||
}
|
|
||||||
@@ -34,7 +34,7 @@ cds.once('served', async()=>{
|
|||||||
|
|
||||||
// Other bootstrapping events you could hook in to...
|
// Other bootstrapping events you could hook in to...
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
cds.on('bootstrap',(app) => {/* ... */})
|
cds.on('boostrap',(app) => {/* ... */})
|
||||||
cds.on('loaded', (model) => {/* ... */})
|
cds.on('loaded', (model) => {/* ... */})
|
||||||
cds.on('connect', (srv) => {/* ... */})
|
cds.on('connect', (srv) => {/* ... */})
|
||||||
cds.on('serving', (srv) => {/* ... */})
|
cds.on('serving', (srv) => {/* ... */})
|
||||||
|
|||||||
@@ -359,11 +359,6 @@ describe('cds.ql → cqn', () => {
|
|||||||
CQL`SELECT from Foo where x in (SELECT y from Bar)`
|
CQL`SELECT from Foo where x in (SELECT y from Bar)`
|
||||||
)
|
)
|
||||||
|
|
||||||
// using query api
|
|
||||||
expect(SELECT.from('Books').where(
|
|
||||||
`author.name in`, SELECT('name').from('Authors'))).to.eql(CQL`SELECT from Books where author.name in (SELECT name from Authors)`
|
|
||||||
)
|
|
||||||
|
|
||||||
// in classical semi joins
|
// in classical semi joins
|
||||||
expect(
|
expect(
|
||||||
SELECT('x').from(Foo) .where ( `exists`,
|
SELECT('x').from(Foo) .where ( `exists`,
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ describe('Localized Data', () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
xit('supports @cds.localized:false', async ()=>{
|
it('supports @cds.localized:false', async ()=>{
|
||||||
const { data } = await GET(`/browse/BooksSans?&$select=title,localized_title&$expand=currency&$filter=locale eq 'de' or locale eq null`, {
|
const { data } = await GET(`/browse/BooksSans?&$select=title,localized_title&$expand=currency&$filter=locale eq 'de' or locale eq null`, {
|
||||||
headers: { 'Accept-Language': 'de' },
|
headers: { 'Accept-Language': 'de' },
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user