Compare commits
40 Commits
CAA265-nod
...
openSAP-we
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b31657f69 | ||
|
|
2f52cbd918 | ||
|
|
71742e1e35 | ||
|
|
25e3d5261c | ||
|
|
edc2fdae91 | ||
|
|
13480ad99e | ||
|
|
8071faa62d | ||
|
|
9ea294586a | ||
|
|
a56a11ff3e | ||
|
|
b4084b45cb | ||
|
|
26e3c0d753 | ||
|
|
6d0194acc0 | ||
|
|
db75a99808 | ||
|
|
a04755efed | ||
|
|
6a9a1bc4d6 | ||
|
|
a0847e603f | ||
|
|
b1270bc0eb | ||
|
|
ba72d7f478 | ||
|
|
cd808c76dd | ||
|
|
3a77707f49 | ||
|
|
583c97a494 | ||
|
|
eb7431afed | ||
|
|
630bb2b19c | ||
|
|
f9a7aa59de | ||
|
|
c0bce5ae5b | ||
|
|
ad05e2b9db | ||
|
|
b7c2eee961 | ||
|
|
9205e0893a | ||
|
|
7137bf227e | ||
|
|
c2d0fba1d8 | ||
|
|
345d7fa37b | ||
|
|
88c1aa0282 | ||
|
|
c4cd02dbe9 | ||
|
|
b9269ad437 | ||
|
|
2783197f1c | ||
|
|
3238b8b045 | ||
|
|
dcac8fe7d2 | ||
|
|
cc3aca29ef | ||
|
|
baaa5ef7d7 | ||
|
|
e657683322 |
@@ -6,7 +6,7 @@
|
|||||||
"jest": true
|
"jest": true
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2017
|
"ecmaVersion": 2018
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"SELECT": true,
|
"SELECT": true,
|
||||||
|
|||||||
37
.vscode/launch.json
vendored
Normal file
37
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "bookshop", "request": "launch", "type": "node", "runtimeExecutable": "npx", "runtimeArgs": [ "-n" ],
|
||||||
|
"args": [ "--", "cds", "run", "--in-memory" ],
|
||||||
|
"cwd": "${workspaceFolder}/packages/bookshop",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"skipFiles": ["<node_internals>/**"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cds run ...", "request": "launch", "type": "node", "runtimeExecutable": "npx", "runtimeArgs": [ "-n" ],
|
||||||
|
"args": [ "--", "cds", "run", "--with-mocks", "--in-memory?" ],
|
||||||
|
"cwd": "${workspaceFolder}/packages/${input:service}",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"skipFiles": ["<node_internals>/**"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"type": "pickString",
|
||||||
|
"id": "service",
|
||||||
|
"description": "Which service do you want to start?",
|
||||||
|
"options": [
|
||||||
|
"bookshop",
|
||||||
|
"bookstore",
|
||||||
|
"media-server",
|
||||||
|
"office-supplies",
|
||||||
|
"reviews-service"
|
||||||
|
],
|
||||||
|
"default": "bookshop"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"files.exclude": {
|
||||||
|
"**/.gitignore": true,
|
||||||
|
"**/.vscode": true
|
||||||
|
}
|
||||||
|
}
|
||||||
17
.vscode/tasks.json
vendored
Normal file
17
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "npm", "script": "watch", "path": "packages/bookshop/",
|
||||||
|
"options": { "env": { "PORT": "4004" }},
|
||||||
|
"presentation": { "group": "A" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm", "script": "watch", "path": "packages/reviews-service/",
|
||||||
|
"options": { "env": { "PORT": "5005" }},
|
||||||
|
"presentation": { "group": "A" }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
68
README.md
68
README.md
@@ -1,58 +1,42 @@
|
|||||||
# cloud-cap-samples
|
# Welcome to SAP Cloud Application Programming model samples
|
||||||
|
|
||||||
This is a monorepository for sample projects on [SAP Cloud Application Programming Model](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/00823f91779d4d42aa29a498e0535cdf.html?q=cloud%20application%20programming%20model).
|
Find here the samples for the openSAP course [Building Applications with the SAP Cloud Application Programming Model](https://open.sap.com/courses/cp7).
|
||||||
|
|
||||||
## Description
|
## Get Access to SAP Business Application Studio
|
||||||
|
The recommended environment for the course is SAP Business Application Studio. Watch [unit 2 of week 1](https://open.sap.com/courses/cp7/items/51pzQUzbXHr2kdbOmVs6jI) for how to get access.
|
||||||
|
|
||||||
This repository provides a list of samples and reusable packages created based on SAP Cloud Application Programming Model.
|
## Setup
|
||||||
The SAP Cloud Application Programming Model enables you to quickly create business applications by allowing you to focus on your domain logic. It offers a consistent end-to-end programming model that includes languages, libraries and APIs tailored for full-stack development on SAP Cloud Platform.
|
|
||||||
|
|
||||||
The samples provided can be run in a local setup on SQLite Database.
|
In SAP Business Application Studio, open a terminal.
|
||||||
|
Then clone the repo with this specific branch:
|
||||||
|
|
||||||
#### Samples:
|
```sh
|
||||||
* [bookstore](./packages/bookstore) - A variant of the bookshop application, built in a modular fashion on top of products-service and common reuse packages.
|
git clone https://github.com/sap-samples/cloud-cap-samples projects/cloud-cap-samples -b openSAP-week3-unit6
|
||||||
* [products-service](./packages/products-service) - A reuse package providing domain models and services to manage product catalogs.
|
cd projects/cloud-cap-samples
|
||||||
|
```
|
||||||
|
|
||||||
## Requirements
|
In the `cloud-cap-samples` folder run:
|
||||||
* [Node.js](https://nodejs.org/en/) v8 or higher
|
```sh
|
||||||
* [Git](https://git-scm.com)
|
npm install
|
||||||
* [SQLite DB](https://www.sqlite.org/download.html) (Windows only; pre-installed on Mac/Linux)
|
```
|
||||||
|
|
||||||
#### Optional (if you want to import the code into an editor)
|
## Run
|
||||||
* [VS Code](https://code.visualstudio.com)
|
|
||||||
* [Add CDS extension to VS](https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/be944d6d51f343f6b3f53c29c44ff00a.html)
|
|
||||||
|
|
||||||
## Download and Installation
|
Now you're ready to run the samples, for example:
|
||||||
|
```sh
|
||||||
|
cd packages/bookshop
|
||||||
|
cds watch
|
||||||
|
```
|
||||||
|
|
||||||
#### Clone and build the application
|
After that, watch out for the little popup in the lower right corner of SAP Business Application Studio that asks you to open the application in your browser.
|
||||||
`git clone https://github.com/SAP-samples/cloud-cap-samples.git`
|
|
||||||
|
|
||||||
`cd samples`
|
|
||||||
|
|
||||||
`npm install`
|
|
||||||
|
|
||||||
#### Run the samples
|
|
||||||
|
|
||||||
`npm run <sample name>`
|
|
||||||
|
|
||||||
|
|
||||||
## Limitations
|
## Get Support
|
||||||
|
|
||||||
None
|
Check out the cap docs at 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).
|
||||||
|
|
||||||
## Known Issues
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## How to obtain support
|
|
||||||
|
|
||||||
In case you find a bug, or you need additional support, please open an issue [here](https://github.wdf.sap.corp/staging-for-SAP-samples-public/cloud-cap-samples/issues) in GitHub.
|
|
||||||
|
|
||||||
## To-Do (upcoming changes)
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under SAP Sample Code License Agreement, except as noted otherwise in the [LICENSE](/LICENSE) file.
|
Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under SAP Sample Code License Agreement, except as noted otherwise in the [LICENSE](/LICENSE) file.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1 @@
|
|||||||
{
|
{"packages":["packages/*"],"version":"1.0.0"}
|
||||||
"packages": [
|
|
||||||
"packages/*",
|
|
||||||
"shared/*"
|
|
||||||
],
|
|
||||||
"version": "0.0.0"
|
|
||||||
}
|
|
||||||
|
|||||||
2064
package-lock.json
generated
Normal file
2064
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@@ -1,16 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "@sap/capire-samples",
|
"name": "@sap/capire-samples",
|
||||||
"description": "The umbrella project for all samples to easily setup for local development and tests.",
|
"description": "The umbrella project for all samples to easily setup for local development and tests.",
|
||||||
"repository": "https://github.wdf.sap.corp/capire/samples.git",
|
"repository": "https://github.com/SAP-samples/cloud-cap-samples.git",
|
||||||
"author": "daniel.hutzel@sap.com",
|
"author": "daniel.hutzel@sap.com",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"install": "(npx --no-install lerna -v || npm i lerna --no-save) && lerna bootstrap --hoist --ignore tests-env --loglevel warn",
|
"lerna": "npx --no-install lerna -v > /dev/null || npm i lerna --no-save",
|
||||||
"reset": "lerna clean -y && rm -fr node_modules",
|
"install": "(npm -s run lerna) && lerna bootstrap --hoist",
|
||||||
"test": "jest",
|
"cleanup": "lerna clean -y && rm -fr node_modules",
|
||||||
"bookstore": "cds run packages/bookstore --in-memory",
|
"bookshop": "cds watch packages/bookshop"
|
||||||
"products-service": "cds run packages/products-service --in-memory",
|
|
||||||
"reviews-service": "cds run packages/reviews-service --in-memory"
|
|
||||||
},
|
},
|
||||||
"license": "ISC"
|
"dependencies": {
|
||||||
|
"@sap/cds": "^3",
|
||||||
|
"express": "^4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"sqlite3": "*"
|
||||||
|
},
|
||||||
|
"--add-these-to-devDependencies-for-tests": {
|
||||||
|
"@types/jest": "*",
|
||||||
|
"jest": "*"
|
||||||
|
},
|
||||||
|
"license": "SAP SAMPLE CODE LICENSE"
|
||||||
}
|
}
|
||||||
|
|||||||
23
packages/bookshop/db/schema.cds
Normal file
23
packages/bookshop/db/schema.cds
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
namespace sap.capire.bookshop;
|
||||||
|
|
||||||
|
@cds.persistence.exists
|
||||||
|
entity Books {
|
||||||
|
key ID: Integer;
|
||||||
|
title : String(111);
|
||||||
|
descr : String(1111);
|
||||||
|
author : String(50);
|
||||||
|
rating : Integer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@cds.persistence.exists
|
||||||
|
entity BooksDescr {
|
||||||
|
key id : Integer;
|
||||||
|
book_descr : String(2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@cds.persistence.exists
|
||||||
|
entity BooksInfo (REQ_RATING : Integer) {
|
||||||
|
key id : Integer;
|
||||||
|
rating : Integer;
|
||||||
|
book_author_info : String;
|
||||||
|
}
|
||||||
10
packages/bookshop/db/src/.hdiconfig
Normal file
10
packages/bookshop/db/src/.hdiconfig
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"file_suffixes": {
|
||||||
|
"hdbtable": { "plugin_name": "com.sap.hana.di.table", "plugin_version": "11.1.0" },
|
||||||
|
"hdbview": { "plugin_name": "com.sap.hana.di.view" },
|
||||||
|
"hdbfunction": { "plugin_name": "com.sap.hana.di.function" },
|
||||||
|
"hdbtabletype": { "plugin_name": "com.sap.hana.di.tabletype", "plugin_version": "11.1.0" },
|
||||||
|
"hdbtabledata": { "plugin_name": "com.sap.hana.di.tabledata", "plugin_version": "11.1.0" },
|
||||||
|
"csv": { "plugin_name" : "com.sap.hana.di.tabledata.source" }
|
||||||
|
}
|
||||||
|
}
|
||||||
4
packages/bookshop/db/src/.hdinamespace
Normal file
4
packages/bookshop/db/src/.hdinamespace
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"subfolder": "ignore"
|
||||||
|
}
|
||||||
4
packages/bookshop/db/src/data/Books.csv
Normal file
4
packages/bookshop/db/src/data/Books.csv
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
ID;TITLE;DESCR;AUTHOR;RATING
|
||||||
|
301;Anna Karenina;"Anna Karenina (Russian: «Анна Каренина», IPA: [ˈanːə kɐˈrʲenʲɪnə])[1] is a novel by the Russian author Leo Tolstoy, first published in book form in 1878. Many writers consider Anna Karenina the greatest work of literature ever,[2] and Tolstoy himself called it his first true novel. It was initially released in serial installments from 1873 to 1877 in the periodical The Russian Messenger.";Leo Tolstoy;4
|
||||||
|
307;The Great Gatsby;"The Great Gatsby is a 1925 novel written by American author F. Scott Fitzgerald that follows a cast of characters living in the fictional towns of West Egg and East Egg on prosperous Long Island in the summer of 1922. The story primarily concerns the young and mysterious millionaire Jay Gatsby and his quixotic passion and obsession with the beautiful former debutante Daisy Buchanan. Considered to be Fitzgerald's magnum opus, The Great Gatsby explores themes of decadence, idealism, resistance to change, social upheaval and excess, creating a portrait of the Roaring Twenties that has been described as a cautionary[a] tale regarding the American Dream.";F. Scott Fitzgerald;4
|
||||||
|
406;Harry Potter;"Harry Potter is a series of fantasy novels written by British author J. K. Rowling. The novels chronicle the lives of a young wizard, Harry Potter, and his friends Hermione Granger and Ron Weasley, all of whom are students at Hogwarts School of Witchcraft and Wizardry. The main story arc concerns Harry's struggle against Lord Voldemort, a dark wizard who intends to become immortal, overthrow the wizard governing body known as the Ministry of Magic and subjugate all wizards and Muggles (non-magical people).";J. K. Rowling;5
|
||||||
|
500 Internal Server Error
Gitea Version: 1.24.4 |