Compare commits
93 Commits
addCustomR
...
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 | ||
|
|
455bee1f0c | ||
|
|
9aa9d866ca | ||
|
|
3c62b2be35 | ||
|
|
67938b99a7 | ||
|
|
3d58e0006f | ||
|
|
f3a8bd6a96 | ||
|
|
878e020b8f | ||
|
|
837ffdb212 | ||
|
|
3b31c1a14a | ||
|
|
7ec722e4c7 | ||
|
|
62adbb5291 | ||
|
|
dccbd9b009 | ||
|
|
18559e0f4b | ||
|
|
17045cb224 | ||
|
|
13f358d89c | ||
|
|
17639c6208 | ||
|
|
3e82f1ff0f | ||
|
|
c597115f1a | ||
|
|
d3afc3fda8 | ||
|
|
ba97f3dcc0 | ||
|
|
991ada8563 | ||
|
|
5eaff22dbe | ||
|
|
ac62fe379b | ||
|
|
2dcdfedcbc | ||
|
|
90d895ffc9 | ||
|
|
e642f400a0 | ||
|
|
e672fd1bed | ||
|
|
59a200a6fe | ||
|
|
3140806c12 | ||
|
|
b45a375689 | ||
|
|
30d9bb3e44 | ||
|
|
64744c9000 | ||
|
|
5049de9e05 | ||
|
|
4dce5ceb14 | ||
|
|
4abf11d188 | ||
|
|
fd01366a11 | ||
|
|
4f731897a0 | ||
|
|
32be688fce | ||
|
|
745247b903 | ||
|
|
72be4a28a6 | ||
|
|
3d7e9a8ea3 | ||
|
|
bed293f1b2 | ||
|
|
50b13f60ce | ||
|
|
f889c27338 | ||
|
|
624c6c5c72 | ||
|
|
12fd91ca4f | ||
|
|
535981dc7e |
52
.eslintrc
52
.eslintrc
@@ -1,29 +1,31 @@
|
|||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"eslint:recommended",
|
"plugin:@sap/cds/recommended",
|
||||||
"plugin:@sap/cds/recommended"
|
"eslint:recommended"
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"es2022": true,
|
"es2022": true,
|
||||||
"node": true,
|
"node": true,
|
||||||
"jest": true,
|
"jest": true,
|
||||||
"mocha": true
|
"mocha": true
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"SELECT": true,
|
"SELECT": true,
|
||||||
"INSERT": true,
|
"INSERT": true,
|
||||||
"UPSERT": true,
|
"UPSERT": true,
|
||||||
"UPDATE": true,
|
"UPDATE": true,
|
||||||
"DELETE": true,
|
"DELETE": true,
|
||||||
"CREATE": true,
|
"CREATE": true,
|
||||||
"DROP": true,
|
"DROP": true,
|
||||||
"cds": true
|
"CDL": true,
|
||||||
},
|
"CQL": true,
|
||||||
"rules": {
|
"cds": true
|
||||||
"no-console": "off",
|
},
|
||||||
"require-atomic-updates": "off",
|
"rules": {
|
||||||
|
"no-console": "off",
|
||||||
|
"require-atomic-updates": "off",
|
||||||
"require-await":"warn",
|
"require-await":"warn",
|
||||||
"no-unused-vars": ["warn", { "argsIgnorePattern": "_" }]
|
"no-unused-vars": ["warn", { "argsIgnorePattern": "_" }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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: [16.x, 14.x]
|
node-version: [18.x, 16.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -20,3 +20,5 @@ reviews/db/test.db
|
|||||||
*.openapi3.json
|
*.openapi3.json
|
||||||
*.sqlite
|
*.sqlite
|
||||||
*.db
|
*.db
|
||||||
|
|
||||||
|
**/@types
|
||||||
|
|||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -16,12 +16,12 @@
|
|||||||
},
|
},
|
||||||
"mochaExplorer.debuggerConfig": "Debug Mocha Tests",
|
"mochaExplorer.debuggerConfig": "Debug Mocha Tests",
|
||||||
"mochaExplorer.parallel": true,
|
"mochaExplorer.parallel": true,
|
||||||
"eslint.validate": [
|
"eslint.probe": [
|
||||||
"cds",
|
"cds",
|
||||||
"csn",
|
"csn",
|
||||||
"csv",
|
"csv",
|
||||||
"csv (semicolon)",
|
"csv (semicolon)",
|
||||||
"tsv",
|
"tsv",
|
||||||
"tab"
|
"tab"
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
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')
|
||||||
|
})
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
ID;name;dateOfBirth;placeOfBirth;dateOfDeath;placeOfDeath
|
ID,name,dateOfBirth,placeOfBirth,dateOfDeath,placeOfDeath
|
||||||
101;Emily Brontë;1818-07-30;Thornton, Yorkshire;1848-12-19;Haworth, Yorkshire
|
101,Emily Brontë,1818-07-30,"Thornton, Yorkshire",1848-12-19,"Haworth, Yorkshire"
|
||||||
107;Charlotte Brontë;1818-04-21;Thornton, Yorkshire;1855-03-31;Haworth, Yorkshire
|
107,Charlotte Brontë,1818-04-21,"Thornton, Yorkshire",1855-03-31,"Haworth, Yorkshire"
|
||||||
150;Edgar Allen Poe;1809-01-19;Boston, Massachusetts;1849-10-07;Baltimore, Maryland
|
150,Edgar Allen Poe,1809-01-19,"Boston, Massachusetts",1849-10-07,"Baltimore, Maryland"
|
||||||
170;Richard Carpenter;1929-08-14;King’s Lynn, Norfolk;2012-02-26;Hertfordshire, England
|
170,Richard Carpenter,1929-08-14,"King’s Lynn, Norfolk",2012-02-26,"Hertfordshire, England"
|
||||||
|
|||||||
|
@@ -1,6 +1,6 @@
|
|||||||
ID;title;descr;author_ID;stock;price;currency_code;genre_ID
|
ID,title,descr,author_ID,stock,price,currency_code,genre_ID
|
||||||
201;Wuthering Heights;"Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym ""Ellis Bell"". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850.";101;12;11.11;GBP;11
|
201,Wuthering Heights,"Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym ""Ellis Bell"". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850.",101,12,11.11,GBP,11
|
||||||
207;Jane Eyre;"Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name ""Currer Bell"", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism.";107;11;12.34;GBP;11
|
207,Jane Eyre,"Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name ""Currer Bell"", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism.",107,11,12.34,GBP,11
|
||||||
251;The Raven;"""The Raven"" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word ""Nevermore"". The poem makes use of folk, mythological, religious, and classical references.";150;333;13.13;USD;16
|
251,The Raven,"""The Raven"" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word ""Nevermore"". The poem makes use of folk, mythological, religious, and classical references.",150,333,13.13,USD,16
|
||||||
252;Eleonora;"""Eleonora"" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively ""happy"" ending.";150;555;14;USD;15
|
252,Eleonora,"""Eleonora"" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively ""happy"" ending.",150,555,14,USD,15
|
||||||
271;Catweazle;Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts.;170;22;150;JPY;13
|
271,Catweazle,"Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts.",170,22,150,JPY,13
|
||||||
|
5
bookshop/db/data/sap.capire.bookshop-Books.texts.csv
Normal file
5
bookshop/db/data/sap.capire.bookshop-Books.texts.csv
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ID,locale,title,descr
|
||||||
|
201,de,Sturmhöhe,"Sturmhöhe (Originaltitel: Wuthering Heights) ist der einzige Roman der englischen Schriftstellerin Emily Brontë (1818–1848). Der 1847 unter dem Pseudonym Ellis Bell veröffentlichte Roman wurde vom viktorianischen Publikum weitgehend abgelehnt, heute gilt er als ein Klassiker der britischen Romanliteratur des 19. Jahrhunderts."
|
||||||
|
201,fr,Les Hauts de Hurlevent,"Les Hauts de Hurlevent (titre original : Wuthering Heights), parfois orthographié Les Hauts de Hurle-Vent, est l'unique roman d'Emily Brontë, publié pour la première fois en 1847 sous le pseudonyme d’Ellis Bell. Loin d'être un récit moralisateur, Emily Brontë achève néanmoins le roman dans une atmosphère sereine, suggérant le triomphe de la paix et du Bien sur la vengeance et le Mal."
|
||||||
|
207,de,Jane Eyre,"Jane Eyre. Eine Autobiographie (Originaltitel: Jane Eyre. An Autobiography), erstmals erschienen im Jahr 1847 unter dem Pseudonym Currer Bell, ist der erste veröffentlichte Roman der britischen Autorin Charlotte Brontë und ein Klassiker der viktorianischen Romanliteratur des 19. Jahrhunderts. Der Roman erzählt in Form einer Ich-Erzählung die Lebensgeschichte von Jane Eyre (ausgesprochen /ˌdʒeɪn ˈɛə/), die nach einer schweren Kindheit eine Stelle als Gouvernante annimmt und sich in ihren Arbeitgeber verliebt, jedoch immer wieder um ihre Freiheit und Selbstbestimmung kämpfen muss. Als klein, dünn, blass, stets schlicht dunkel gekleidet und mit strengem Mittelscheitel beschrieben, gilt die Heldin des Romans Jane Eyre nicht zuletzt aufgrund der Kino- und Fernsehversionen der melodramatischen Romanvorlage als die bekannteste englische Gouvernante der Literaturgeschichte"
|
||||||
|
252,de,Eleonora,"“Eleonora” ist eine Erzählung von Edgar Allan Poe. Sie wurde 1841 erstveröffentlicht. In ihr geht es um das Paradox der Treue in der Treulosigkeit."
|
||||||
|
@@ -1,5 +0,0 @@
|
|||||||
ID;locale;title;descr
|
|
||||||
201;de;Sturmhöhe;Sturmhöhe (Originaltitel: Wuthering Heights) ist der einzige Roman der englischen Schriftstellerin Emily Brontë (1818–1848). Der 1847 unter dem Pseudonym Ellis Bell veröffentlichte Roman wurde vom viktorianischen Publikum weitgehend abgelehnt, heute gilt er als ein Klassiker der britischen Romanliteratur des 19. Jahrhunderts.
|
|
||||||
201;fr;Les Hauts de Hurlevent;Les Hauts de Hurlevent (titre original : Wuthering Heights), parfois orthographié Les Hauts de Hurle-Vent, est l'unique roman d'Emily Brontë, publié pour la première fois en 1847 sous le pseudonyme d’Ellis Bell. Loin d'être un récit moralisateur, Emily Brontë achève néanmoins le roman dans une atmosphère sereine, suggérant le triomphe de la paix et du Bien sur la vengeance et le Mal.
|
|
||||||
207;de;Jane Eyre;Jane Eyre. Eine Autobiographie (Originaltitel: Jane Eyre. An Autobiography), erstmals erschienen im Jahr 1847 unter dem Pseudonym Currer Bell, ist der erste veröffentlichte Roman der britischen Autorin Charlotte Brontë und ein Klassiker der viktorianischen Romanliteratur des 19. Jahrhunderts. Der Roman erzählt in Form einer Ich-Erzählung die Lebensgeschichte von Jane Eyre (ausgesprochen /ˌdʒeɪn ˈɛə/), die nach einer schweren Kindheit eine Stelle als Gouvernante annimmt und sich in ihren Arbeitgeber verliebt, jedoch immer wieder um ihre Freiheit und Selbstbestimmung kämpfen muss. Als klein, dünn, blass, stets schlicht dunkel gekleidet und mit strengem Mittelscheitel beschrieben, gilt die Heldin des Romans Jane Eyre nicht zuletzt aufgrund der Kino- und Fernsehversionen der melodramatischen Romanvorlage als die bekannteste englische Gouvernante der Literaturgeschichte
|
|
||||||
252;de;Eleonora;“Eleonora” ist eine Erzählung von Edgar Allan Poe. Sie wurde 1841 erstveröffentlicht. In ihr geht es um das Paradox der Treue in der Treulosigkeit.
|
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
ID;parent_ID;name
|
ID,parent_ID,name
|
||||||
10;;Fiction
|
10,,Fiction
|
||||||
11;10;Drama
|
11,10,Drama
|
||||||
12;10;Poetry
|
12,10,Poetry
|
||||||
13;10;Fantasy
|
13,10,Fantasy
|
||||||
14;10;Science Fiction
|
14,10,Science Fiction
|
||||||
15;10;Romance
|
15,10,Romance
|
||||||
16;10;Mystery
|
16,10,Mystery
|
||||||
17;10;Thriller
|
17,10,Thriller
|
||||||
18;10;Dystopia
|
18,10,Dystopia
|
||||||
19;10;Fairy Tale
|
19,10,Fairy Tale
|
||||||
20;;Non-Fiction
|
20,,Non-Fiction
|
||||||
21;20;Biography
|
21,20,Biography
|
||||||
22;21;Autobiography
|
22,21,Autobiography
|
||||||
23;20;Essay
|
23,20,Essay
|
||||||
24;20;Speech
|
24,20,Speech
|
||||||
|
|||||||
|
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -81,3 +81,6 @@ extend service AdminService {
|
|||||||
|
|
||||||
// Workaround for Fiori popup for asking user to enter a new UUID on Create
|
// Workaround for Fiori popup for asking user to enter a new UUID on Create
|
||||||
annotate AdminService.Books with { ID @Core.Computed; }
|
annotate AdminService.Books with { ID @Core.Computed; }
|
||||||
|
|
||||||
|
// Show Genre as drop down, not a dialog
|
||||||
|
annotate AdminService.Books with { genre @Common.ValueListWithFixedValues; }
|
||||||
|
|||||||
@@ -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';
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@capire/bookstore": "*",
|
"@capire/bookstore": "*",
|
||||||
"@sap/cds": ">=5",
|
"@sap/cds": ">=5",
|
||||||
"@sap/cds-odata-v2-adapter-proxy": "^1.9.0",
|
"@cap-js-community/odata-v2-adapter": "^1",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"passport": ">=0.4.1"
|
"passport": ">=0.4.1"
|
||||||
},
|
},
|
||||||
@@ -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"
|
||||||
@@ -29,7 +32,7 @@
|
|||||||
"[development]": {
|
"[development]": {
|
||||||
"kind": "file-based-messaging"
|
"kind": "file-based-messaging"
|
||||||
},
|
},
|
||||||
"[hybrid!]": {
|
"[hybrid]": {
|
||||||
"kind": "enterprise-messaging-shared"
|
"kind": "enterprise-messaging-shared"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// install OData v2 adapter
|
// install OData v2 adapter
|
||||||
const cds = require("@sap/cds")
|
const cds = require("@sap/cds")
|
||||||
const proxy = require('@sap/cds-odata-v2-adapter-proxy')
|
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')
|
||||||
|
|||||||
@@ -12,4 +12,4 @@ Then call the service at: http://localhost:4004/say/hello(to='world')
|
|||||||
Learn more about:
|
Learn more about:
|
||||||
|
|
||||||
- [Hello World!](https://cap.cloud.sap/docs/get-started/hello-world)
|
- [Hello World!](https://cap.cloud.sap/docs/get-started/hello-world)
|
||||||
- [Using TypeScript](https://cap.cloud.sap/docs/get-started/using-typescript)
|
- [Using TypeScript](https://cap.cloud.sap/docs/node.js/typescript)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "*",
|
"@types/jest": "*",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"typescript": "^4.3.5"
|
"typescript": ">=4.3.5"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
|
|||||||
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1775
package-lock.json
generated
1775
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",
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
"./reviews"
|
"./reviews"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@sap/eslint-plugin-cds": "^2.6.1",
|
||||||
"axios": "^1",
|
"axios": "^1",
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
@@ -50,6 +51,6 @@
|
|||||||
"parallel": true,
|
"parallel": true,
|
||||||
"timeout": 6666
|
"timeout": 6666
|
||||||
},
|
},
|
||||||
"license": "SAP SAMPLE CODE LICENSE",
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
||||||
|
|||||||
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 }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Each sub directory essentially is an individual npm package arranged in an [all-
|
|||||||
## [@capire/hello-world](hello)
|
## [@capire/hello-world](hello)
|
||||||
|
|
||||||
- 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).
|
- 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).
|
||||||
- [Typescript support](https://cap.cloud.sap/docs/get-started/using-typescript)
|
- [Typescript support](https://cap.cloud.sap/docs/node.js/typescript)
|
||||||
|
|
||||||
|
|
||||||
## [@capire/bookshop](bookshop)
|
## [@capire/bookshop](bookshop)
|
||||||
|
|||||||
@@ -2,11 +2,10 @@ describe('cds.ql → cqn', () => {
|
|||||||
|
|
||||||
const cds = require('@sap/cds/lib')
|
const cds = require('@sap/cds/lib')
|
||||||
const { expect } = cds.test
|
const { expect } = cds.test
|
||||||
const { cdr } = cds.ql
|
|
||||||
const Foo = { name: 'Foo' }
|
const Foo = { name: 'Foo' }
|
||||||
const Books = { name: 'capire.bookshop.Books' }
|
const Books = { name: 'capire.bookshop.Books' }
|
||||||
|
|
||||||
const STAR = cdr ? '*' : { ref: ['*'] }
|
const STAR = '*'
|
||||||
const skip = {to:{eql:()=>skip}}
|
const skip = {to:{eql:()=>skip}}
|
||||||
const srv = new cds.Service
|
const srv = new cds.Service
|
||||||
let cqn
|
let cqn
|
||||||
@@ -185,7 +184,7 @@ describe('cds.ql → cqn', () => {
|
|||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
|
||||||
if (cdr) expect.plain (cqn)
|
expect.plain (cqn)
|
||||||
.to.eql(SELECT`Foo[ID=${11}]`)
|
.to.eql(SELECT`Foo[ID=${11}]`)
|
||||||
.to.eql(srv.read`Foo[ID=${11}]`)
|
.to.eql(srv.read`Foo[ID=${11}]`)
|
||||||
|
|
||||||
@@ -242,7 +241,7 @@ describe('cds.ql → cqn', () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
cdr && expect.plain(cqn)
|
expect.plain(cqn)
|
||||||
.to.eql(CQL`SELECT *,a,b as c from Foo`)
|
.to.eql(CQL`SELECT *,a,b as c from Foo`)
|
||||||
.to.eql(CQL`SELECT from Foo {*,a,b as c}`)
|
.to.eql(CQL`SELECT from Foo {*,a,b as c}`)
|
||||||
|
|
||||||
@@ -341,7 +340,7 @@ describe('cds.ql → cqn', () => {
|
|||||||
expect(SELECT.from(Foo).where({ x: 1, and: { y: 2, or: { z: 3 } } })).to.eql({
|
expect(SELECT.from(Foo).where({ x: 1, and: { y: 2, or: { z: 3 } } })).to.eql({
|
||||||
SELECT: {
|
SELECT: {
|
||||||
from: { ref: ['Foo'] },
|
from: { ref: ['Foo'] },
|
||||||
where: cdr ? [
|
where: [
|
||||||
{ ref: ['x'] },
|
{ ref: ['x'] },
|
||||||
'=',
|
'=',
|
||||||
{ val: 1 },
|
{ val: 1 },
|
||||||
@@ -357,29 +356,12 @@ describe('cds.ql → cqn', () => {
|
|||||||
{ val: 3 },
|
{ val: 3 },
|
||||||
]},
|
]},
|
||||||
// ')',
|
// ')',
|
||||||
] : [
|
|
||||||
{ ref: ['x'] },
|
|
||||||
'=',
|
|
||||||
{ val: 1 },
|
|
||||||
'and',
|
|
||||||
'(',
|
|
||||||
// {xpr:[
|
|
||||||
{ ref: ['y'] },
|
|
||||||
'=',
|
|
||||||
{ val: 2 },
|
|
||||||
'or',
|
|
||||||
{ ref: ['z'] },
|
|
||||||
'=',
|
|
||||||
{ val: 3 },
|
|
||||||
// ]},
|
|
||||||
')',
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test ("where x='*'", ()=>{
|
test ("where x='*'", ()=>{
|
||||||
if (cdr)
|
|
||||||
expect (SELECT.from(Foo).where({x:'*'}))
|
expect (SELECT.from(Foo).where({x:'*'}))
|
||||||
.to.eql(SELECT.from(Foo).where("x='*'"))
|
.to.eql(SELECT.from(Foo).where("x='*'"))
|
||||||
.to.eql(SELECT.from(Foo).where("x=",'*'))
|
.to.eql(SELECT.from(Foo).where("x=",'*'))
|
||||||
@@ -387,7 +369,6 @@ describe('cds.ql → cqn', () => {
|
|||||||
.to.eql(
|
.to.eql(
|
||||||
CQL`SELECT from Foo where x='*'`
|
CQL`SELECT from Foo where x='*'`
|
||||||
)
|
)
|
||||||
if (cdr)
|
|
||||||
expect (SELECT.from(Foo).where({x:['*',1]}))
|
expect (SELECT.from(Foo).where({x:['*',1]}))
|
||||||
.to.eql(SELECT.from(Foo).where("x in ('*',1)"))
|
.to.eql(SELECT.from(Foo).where("x in ('*',1)"))
|
||||||
.to.eql(SELECT.from(Foo).where("x in",['*',1]))
|
.to.eql(SELECT.from(Foo).where("x in",['*',1]))
|
||||||
@@ -479,19 +460,19 @@ describe('cds.ql → cqn', () => {
|
|||||||
CQL`SELECT from Foo where x=1 and y=2 or z=3`
|
CQL`SELECT from Foo where x=1 and y=2 or z=3`
|
||||||
)
|
)
|
||||||
|
|
||||||
if (cdr) expect (
|
expect (
|
||||||
SELECT.from(Foo).where({x:1}).and({y:2,or:{z:3}})
|
SELECT.from(Foo).where({x:1}).and({y:2,or:{z:3}})
|
||||||
).to.eql (
|
).to.eql (
|
||||||
CQL`SELECT from Foo where x=1 and ( y=2 or z=3 )`
|
CQL`SELECT from Foo where x=1 and ( y=2 or z=3 )`
|
||||||
)
|
)
|
||||||
|
|
||||||
if (cdr) expect (
|
expect (
|
||||||
SELECT.from(Foo).where({1:1}).and({x:1,or:{x:2}}).and({y:2,or:{z:3}})
|
SELECT.from(Foo).where({1:1}).and({x:1,or:{x:2}}).and({y:2,or:{z:3}})
|
||||||
).to.eql (
|
).to.eql (
|
||||||
CQL`SELECT from Foo where 1=1 and ( x=1 or x=2 ) and ( y=2 or z=3 )`
|
CQL`SELECT from Foo where 1=1 and ( x=1 or x=2 ) and ( y=2 or z=3 )`
|
||||||
)
|
)
|
||||||
|
|
||||||
if (cdr) expect (
|
expect (
|
||||||
SELECT.from(Foo).where({x:1,or:{x:2}}).and({y:2,or:{z:3}})
|
SELECT.from(Foo).where({x:1,or:{x:2}}).and({y:2,or:{z:3}})
|
||||||
).to.eql (
|
).to.eql (
|
||||||
CQL`SELECT from Foo where ( x=1 or x=2 ) and ( y=2 or z=3 )`
|
CQL`SELECT from Foo where ( x=1 or x=2 ) and ( y=2 or z=3 )`
|
||||||
@@ -499,7 +480,7 @@ describe('cds.ql → cqn', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('where ({x:[undefined]})', () => {
|
test('where ({x:[undefined]})', () => {
|
||||||
if (cdr) expect (
|
expect (
|
||||||
SELECT.from(Foo).where({x:[undefined]})
|
SELECT.from(Foo).where({x:[undefined]})
|
||||||
).to.eql ({ SELECT: {
|
).to.eql ({ SELECT: {
|
||||||
from: {ref:['Foo']},
|
from: {ref:['Foo']},
|
||||||
@@ -526,7 +507,7 @@ describe('cds.ql → cqn', () => {
|
|||||||
).to.eql({
|
).to.eql({
|
||||||
SELECT: {
|
SELECT: {
|
||||||
from: { ref: ['Foo'] },
|
from: { ref: ['Foo'] },
|
||||||
where: cdr ? [
|
where: [
|
||||||
{ ref: ['ID'] },
|
{ ref: ['ID'] },
|
||||||
'=',
|
'=',
|
||||||
{ val: ID },
|
{ val: ID },
|
||||||
@@ -546,24 +527,6 @@ describe('cds.ql → cqn', () => {
|
|||||||
{ val: 9 },
|
{ val: 9 },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
] : [
|
|
||||||
{ ref: ['ID'] },
|
|
||||||
'=',
|
|
||||||
{ val: ID },
|
|
||||||
'and',
|
|
||||||
{ ref: ['args'] },
|
|
||||||
'in',
|
|
||||||
{ list: args.map(val => ({ val })) },
|
|
||||||
'and',
|
|
||||||
'(',
|
|
||||||
{ ref: ['x'] },
|
|
||||||
'like',
|
|
||||||
{ val: '%x%' },
|
|
||||||
'or',
|
|
||||||
{ ref: ['y'] },
|
|
||||||
'>=',
|
|
||||||
{ val: 9 },
|
|
||||||
')',
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -657,7 +620,6 @@ describe('cds.ql → cqn', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should consistently handle *', () => {
|
it('should consistently handle *', () => {
|
||||||
if (!cdr) return
|
|
||||||
expect({
|
expect({
|
||||||
SELECT: { from: { ref: ['Foo'] }, columns: ['*'] },
|
SELECT: { from: { ref: ['Foo'] }, columns: ['*'] },
|
||||||
})
|
})
|
||||||
@@ -668,7 +630,6 @@ describe('cds.ql → cqn', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should consistently handle lists', () => {
|
it('should consistently handle lists', () => {
|
||||||
if (!cdr) return
|
|
||||||
const ID = 11, args = [{ref:['foo']}, "bar", 3]
|
const ID = 11, args = [{ref:['foo']}, "bar", 3]
|
||||||
const cqn = CQL`SELECT from Foo where ID=11 and x in (foo,'bar',3)`
|
const cqn = CQL`SELECT from Foo where ID=11 and x in (foo,'bar',3)`
|
||||||
expect(SELECT.from(Foo).where`ID=${ID} and x in ${args}`).to.eql(cqn)
|
expect(SELECT.from(Foo).where`ID=${ID} and x in ${args}`).to.eql(cqn)
|
||||||
|
|||||||
@@ -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)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ const cds = require('@sap/cds/lib')
|
|||||||
|
|
||||||
describe('cap/samples - Hierarchical Data', ()=>{
|
describe('cap/samples - Hierarchical Data', ()=>{
|
||||||
|
|
||||||
const model = CDL`
|
const csn = CDL`
|
||||||
entity Categories {
|
entity Categories {
|
||||||
key ID : Integer;
|
key ID : Integer;
|
||||||
name : String;
|
name : String;
|
||||||
@@ -10,11 +10,12 @@ describe('cap/samples - Hierarchical Data', ()=>{
|
|||||||
parent : Association to Categories;
|
parent : Association to Categories;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
const model = cds.compile.for.nodejs(csn)
|
||||||
const {Categories:Cats} = model.definitions
|
const {Categories:Cats} = model.definitions
|
||||||
const {expect} = cds.test
|
const {expect} = cds.test
|
||||||
|
|
||||||
before ('bootstrap sqlite in-memory db...', async()=>{
|
before ('bootstrap sqlite in-memory db...', async()=>{
|
||||||
await cds.deploy (model) .to ('sqlite::memory:')
|
await cds.deploy (csn) .to ('sqlite::memory:') // REVISIT: cds.compile.to.sql should accept cds.compiled.for.nodejs models
|
||||||
expect (cds.db) .to.exist
|
expect (cds.db) .to.exist
|
||||||
expect (cds.db.model) .to.exist
|
expect (cds.db.model) .to.exist
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe('cap/samples - Bookshop APIs', () => {
|
|||||||
const { data } = await GET `/browse/ListOfBooks ${{
|
const { data } = await GET `/browse/ListOfBooks ${{
|
||||||
params: { $search: 'Po', $select: `title,author`, $expand:`genre,currency` },
|
params: { $search: 'Po', $select: `title,author`, $expand:`genre,currency` },
|
||||||
}}`
|
}}`
|
||||||
expect(data.value).to.eql([
|
expect(data.value).to.containSubset([
|
||||||
{ ID: 251, title: 'The Raven', author: 'Edgar Allen Poe', genre:Mystery, currency:USD },
|
{ ID: 251, title: 'The Raven', author: 'Edgar Allen Poe', genre:Mystery, currency:USD },
|
||||||
{ ID: 252, title: 'Eleonora', author: 'Edgar Allen Poe', genre:Romance, currency:USD },
|
{ ID: 252, title: 'Eleonora', author: 'Edgar Allen Poe', genre:Romance, currency:USD },
|
||||||
])
|
])
|
||||||
@@ -32,7 +32,7 @@ describe('cap/samples - Bookshop APIs', () => {
|
|||||||
const { data } = await GET `/browse/Books ${{
|
const { data } = await GET `/browse/Books ${{
|
||||||
params: { $search: 'Po', $select: `title,author` },
|
params: { $search: 'Po', $select: `title,author` },
|
||||||
}}`
|
}}`
|
||||||
expect(data.value).to.eql([
|
expect(data.value).to.containSubset([
|
||||||
{ ID: 201, title: 'Wuthering Heights', author: 'Emily Brontë' },
|
{ ID: 201, title: 'Wuthering Heights', author: 'Emily Brontë' },
|
||||||
{ ID: 207, title: 'Jane Eyre', author: 'Charlotte Brontë' },
|
{ ID: 207, title: 'Jane Eyre', author: 'Charlotte Brontë' },
|
||||||
{ ID: 251, title: 'The Raven', author: 'Edgar Allen Poe' },
|
{ ID: 251, title: 'The Raven', author: 'Edgar Allen Poe' },
|
||||||
@@ -44,7 +44,7 @@ describe('cap/samples - Bookshop APIs', () => {
|
|||||||
const { data } = await GET(`/browse/Books`, {
|
const { data } = await GET(`/browse/Books`, {
|
||||||
params: { $select: `ID,title` },
|
params: { $select: `ID,title` },
|
||||||
})
|
})
|
||||||
expect(data.value).to.eql([
|
expect(data.value).to.containSubset([
|
||||||
{ ID: 201, title: 'Wuthering Heights' },
|
{ ID: 201, title: 'Wuthering Heights' },
|
||||||
{ ID: 207, title: 'Jane Eyre' },
|
{ ID: 207, title: 'Jane Eyre' },
|
||||||
{ ID: 251, title: 'The Raven' },
|
{ ID: 251, title: 'The Raven' },
|
||||||
@@ -75,13 +75,13 @@ describe('cap/samples - Bookshop APIs', () => {
|
|||||||
|
|
||||||
it('supports $top/$skip paging', async () => {
|
it('supports $top/$skip paging', async () => {
|
||||||
const { data: p1 } = await GET`/browse/Books?$select=title&$top=3`
|
const { data: p1 } = await GET`/browse/Books?$select=title&$top=3`
|
||||||
expect(p1.value).to.eql([
|
expect(p1.value).to.containSubset([
|
||||||
{ ID: 201, title: 'Wuthering Heights' },
|
{ ID: 201, title: 'Wuthering Heights' },
|
||||||
{ ID: 207, title: 'Jane Eyre' },
|
{ ID: 207, title: 'Jane Eyre' },
|
||||||
{ ID: 251, title: 'The Raven' },
|
{ ID: 251, title: 'The Raven' },
|
||||||
])
|
])
|
||||||
const { data: p2 } = await GET`/browse/Books?$select=title&$skip=3`
|
const { data: p2 } = await GET`/browse/Books?$select=title&$skip=3`
|
||||||
expect(p2.value).to.eql([
|
expect(p2.value).to.containSubset([
|
||||||
{ ID: 252, title: 'Eleonora' },
|
{ ID: 252, title: 'Eleonora' },
|
||||||
{ ID: 271, title: 'Catweazle' },
|
{ ID: 271, title: 'Catweazle' },
|
||||||
])
|
])
|
||||||
|
|||||||
Reference in New Issue
Block a user