Compare commits

..

4 Commits

Author SHA1 Message Date
Steffen Weinstock
0a6ddfd9bb empty line at end
Co-authored-by: Patrice Bender <info@patrice.codes>
2022-03-17 14:53:26 +01:00
Steffen Weinstock
ae247d493e add empty line at end
Co-authored-by: Patrice Bender <info@patrice.codes>
2022-03-17 14:53:06 +01:00
Steffen Weinstock
a524e419db use database constraints
... in bookshop, orders, reviews
+ update package.json and package-lock.json as db constraints
  requires latest cds
2021-12-21 10:09:09 +01:00
Daniel
379ddc9fb0 Added npm start script → launching fiori 2021-12-14 10:13:53 +01:00
8 changed files with 1625 additions and 1827 deletions

View File

@@ -8,9 +8,6 @@
"express": "^4.17.1",
"passport": "0.4.1"
},
"devDependencies": {
"@cds/cds-plugin-openapi": "*"
},
"scripts": {
"genres": "cds serve test/genres.cds",
"start": "cds run",
@@ -21,6 +18,9 @@
"db": {
"kind": "sql"
}
},
"features": {
"assert_integrity": "db"
}
}
}

View File

@@ -17,7 +17,7 @@ GET {{server}}/browse/$metadata
### ------------------------------------------------------------------------
# Browse Books as any user
GET {{server}}/browse/Books?
# &$select=title,stock
&$select=title,stock,author
# &$expand=currency
# &sap-language=de
{{me}}
@@ -62,6 +62,22 @@ Authorization: Basic alice:
"currency": { "code": "USD" }
}
### ------------------------------------------------------------------------
# Create book with invalid author ID -> will fail
POST {{server}}/admin/Books
Content-Type: application/json;IEEE754Compatible=true
Authorization: Basic alice:
{
"ID": 34,
"title": "Let constraints do the magic",
"descr": "Database constraints are helpful little things that prevent messing up your data.",
"author": { "ID": 777 },
"genre": { "ID": 14 },
"stock": 4,
"price": "19.99",
"currency": { "code": "USD" }
}
### ------------------------------------------------------------------------
# Put image to books

View File

@@ -1,29 +0,0 @@
/* eslint-disable require-await */
const cds = require('@sap/cds'), { BuildTaskHandler } = cds.build
const cdsdk = require('@sap/cds-dk')
cds.build.register(class OpenApiHandler extends BuildTaskHandler {
static get meta() {
return {
id: 'openapi',
runWith: ['node-cf', 'java-cf'],
config: { src: cds.env.folders.srv.replace(/\/$/, '') }
}
}
async clean() {
return this.remove('openapi-docs')
}
async build() {
const model = await this.model()
const { options } = this.task
// generate openapi files for all services
await Promise.all(cds.linked(model).services.map(service => {
const openApi = cdsdk.compile.to.openapi(model, {
service: service.name,
'openapi:diagram': String(options.diagram) === 'true'
})
this.write(openApi).to(`openapi-docs/${service.name}.openapi3.json`)
}))
}
})

View File

@@ -1,9 +0,0 @@
{
"name": "@sap/cds-plugin-openapi",
"version": "1.0.0",
"description": "OpenAPI service specification build plugin",
"main": "index.js",
"dependencies": {
"@sap/cds-dk": "^4"
}
}

View File

@@ -4,5 +4,10 @@
"dependencies": {
"@capire/common": "*",
"@sap/cds": "^5"
},
"cds": {
"features": {
"assert_integrity": "db"
}
}
}
}

3372
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,14 +13,13 @@
"@capire/media": "./media",
"@capire/orders": "./orders",
"@capire/reviews": "./reviews",
"@sap/cds": "git+https://github.tools.sap/cap/cds#add/customBuildTaskProviders"
"@sap/cds": "^5.7.3"
},
"devDependencies": {
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"chai-subset": "^1.6.0",
"sqlite3": "^5",
"@cds/cds-plugin-openapi": "./cds-plugin-openapi"
"sqlite3": "^5"
},
"scripts": {
"cleanup": "rm -rf node_modules && rm -rf */node_modules && rm -rf */*/node_modules",
@@ -31,6 +30,7 @@
"media": "cds watch media",
"mocha": "npx mocha || echo",
"jest": "npx jest",
"start": "cds watch fiori",
"test": "npm run jest -- --silent",
"test:hello": "cd hello && npm test"
},

View File

@@ -18,6 +18,9 @@
"[production]": { "kind": "enterprise-messaging" }
},
"db": { "kind": "sql" }
},
"features": {
"assert_integrity": "db"
}
}
}
}