Compare commits

..

15 Commits

Author SHA1 Message Date
Christian Georgi
dff5568618 Better clone path 2020-04-20 17:07:02 +02:00
Christian Georgi
20bb8d8c54 Add package-lock.json, fix readme 2020-04-02 16:00:51 +02:00
Christian Georgi
045e65487c Update readme 2020-03-23 17:08:49 +01:00
Christian Georgi
e660e01b77 Initial HANA config 2020-01-24 12:02:33 +00:00
Christian Georgi
06a9ef0f5b Pinning versions 2020-01-24 09:48:54 +00:00
Christian Georgi
8978799491 Remove superfluous files 2020-01-24 09:43:07 +00:00
Lakshmi C Rajeev
6d0194acc0 Merge pull request #12 from LakshmiCR/master
Media-server implementation
2020-01-17 15:02:15 +05:30
Lakshmi C Rajeev
db75a99808 Merge branch 'master' into master 2020-01-17 15:01:59 +05:30
Volker Buzek
a04755efed feat(npm): add .npmrc for @sap-scope
- `npm set @sap...` is unnecessary
- update README.md accordingly
2020-01-14 14:55:36 +01:00
Lakshmi C Rajeev
ba72d7f478 Update package.json 2020-01-03 14:29:53 +05:30
Lakshmi C Rajeev
cd808c76dd Update media-service.js 2020-01-03 14:07:17 +05:30
Lakshmi C Rajeev
630bb2b19c Update package.json 2019-12-19 10:59:57 +05:30
Lakshmi C Rajeev
f9a7aa59de Update media-service.js 2019-12-19 10:43:22 +05:30
Lakshmi C Rajeev
9205e0893a Update media-service.js 2019-12-02 15:27:38 +05:30
Lakshmi C Rajeev
7137bf227e Media-server 2019-11-29 12:30:07 +05:30
8 changed files with 86 additions and 47 deletions

39
.vscode/launch.json vendored
View File

@@ -5,18 +5,45 @@
"version": "0.2.0",
"configurations": [
{
"name": "bookshop", "request": "launch", "type": "node", "runtimeExecutable": "npx", "runtimeArgs": [ "-n" ],
"args": [ "--", "cds", "run", "--in-memory" ],
"name": "bookshop",
"request": "launch",
"type": "node",
"runtimeExecutable": "npx",
"runtimeArgs": [
"-n"
],
"args": [
"--",
"cds",
"run",
"--in-memory"
],
"cwd": "${workspaceFolder}/packages/bookshop",
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"]
"skipFiles": [
"<node_internals>/**"
]
},
{
"name": "cds run ...", "request": "launch", "type": "node", "runtimeExecutable": "npx", "runtimeArgs": [ "-n" ],
"args": [ "--", "cds", "run", "--with-mocks", "--in-memory?" ],
"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>/**"]
"skipFiles": [
"<node_internals>/**"
]
}
],
"inputs": [

View File

@@ -11,7 +11,7 @@ In SAP Business Application Studio, open a terminal.
Then clone the repo with this specific branch:
```sh
git clone https://github.com/sap-samples/cloud-cap-samples projects/cloud-cap-samples -b openSAP-week2-unit3
git clone https://github.com/sap-samples/cloud-cap-samples projects/cloud-cap-samples -b openSAP-week3-unit4
cd projects/cloud-cap-samples
```

View File

@@ -11,7 +11,6 @@ entity Books : managed {
currency : Currency;
}
@cds.autoexpose
entity Authors : managed {
key ID : Integer;
name : String(111);

View File

@@ -1,21 +1,25 @@
{
"name": "@sap/capire-bookshop",
"version": "1.0.0",
"description": "A simple bookshop application, build in a self-contained all-in-one fashion, i.e. w/o reusing other packages.",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/cds": "^3",
"express": "^4"
},
"scripts": {
"start": "cds run --in-memory?",
"watch": "cds watch"
},
"cds": {
"requires": {
"db": {
"kind": "sql"
}
"name": "@sap/capire-bookshop",
"version": "1.0.0",
"description": "A simple bookshop application, build in a self-contained all-in-one fashion, i.e. w/o reusing other packages.",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/cds": "^3",
"express": "^4"
},
"scripts": {
"start": "cds run --in-memory?",
"watch": "cds watch"
},
"cds": {
"requires": {
"db": {
"model": [
"db",
"srv"
],
"kind": "sqlite"
}
}
}
}
}

View File

@@ -1,6 +1,6 @@
using { sap.capire.bookshop as my } from '../db/schema';
service AdminService @(_requires:'authenticated-user',path:'/admin') {
service AdminService @(_requires:'authenticated-user') {
entity Books as projection on my.Books;
entity Authors as projection on my.Authors;
entity Orders as select from my.Orders;
@@ -10,7 +10,7 @@ service AdminService @(_requires:'authenticated-user',path:'/admin') {
annotate AdminService.Orders with @odata.draft.enabled;
// annotate AdminService.Books with @odata.draft.enabled;
// Temporary workaround -> cap/issues#3121
// Temporary workaround -> https://github.wdf.sap.corp/cap/issues/issues/3121
extend service AdminService with {
entity OrderItems as select from my.OrderItems;
}

View File

@@ -3,7 +3,9 @@ using { sap.capire.bookshop as my } from '../db/schema';
@path:'/browse'
service CatalogService {
@readonly entity Books as SELECT from my.Books { * } excluding { createdBy, modifiedBy };
@readonly entity Books as SELECT from my.Books {*,
author.name as author
} excluding { createdBy, modifiedBy };
@requires_: 'authenticated-user'
@insertonly entity Orders as projection on my.Orders;

View File

@@ -1,14 +1,18 @@
### Browse Books
GET http://localhost:4004/browse/Books
### Service Document
GET http://localhost:4004/browse
### Browse Books with expanded Authors
GET http://localhost:4004/browse/Books?$expand=author
### Service $metadata document
GET http://localhost:4004/browse/$metadata
### Try to insert into Books
POST http://localhost:4004/browse/Books
Content-Type: application/json
### Browsing Books
GET http://localhost:4004/browse/Books?
# &$select=title,author
# &$expand=currency
# &sap-language=de
{
"title": "Anna Karenina",
"stock": 10
}
### Browsing Authors
GET http://localhost:4004/admin/Authors?
# &$select=name,dateOfBirth,placeOfBirth
# &$expand=books($select=title;$expand=currency)
# &$filter=ID eq 101
# &sap-language=de

View File

@@ -1,15 +1,18 @@
### List all Orders - deep read
### List Books with their current stocks
GET http://localhost:4004/admin/Books?$select=ID,stock
### List all Orders
GET http://localhost:4004/admin/Orders?
&$expand=Items
### Submit Orders - deep insert
### Submit Orders
POST http://localhost:4004/browse/Orders
Content-Type: application/json
{ "OrderNo":"1234", "Items":[
{ "OrderNo":"2019-09...", "Items":[
{ "book_ID":201, "amount":5 },
{ "book_ID":207, "amount":3 }
]}
### Try to get the Orders
GET http://localhost:4004/browse/Orders
# Sending this three times should result in a 409: 5 exceeds stock for book #201