demo for bhagat
This commit is contained in:
1
demo/.cdsrc.json
Normal file
1
demo/.cdsrc.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
24
demo/.eslintrc
Normal file
24
demo/.eslintrc
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"es6": true,
|
||||||
|
"jest": true
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2017
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"SELECT": true,
|
||||||
|
"INSERT": true,
|
||||||
|
"UPDATE": true,
|
||||||
|
"DELETE": true,
|
||||||
|
"CREATE": true,
|
||||||
|
"DROP": true,
|
||||||
|
"cds": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-console": "off",
|
||||||
|
"require-atomic-updates": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
29
demo/.gitignore
vendored
Normal file
29
demo/.gitignore
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# CAP demo
|
||||||
|
_out
|
||||||
|
*.db
|
||||||
|
connection.properties
|
||||||
|
default-*.json
|
||||||
|
gen/
|
||||||
|
node_modules/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Web IDE, App Studio
|
||||||
|
.che/
|
||||||
|
.gen/
|
||||||
|
|
||||||
|
# MTA
|
||||||
|
*_mta_build_tmp
|
||||||
|
*.mtar
|
||||||
|
mta_archives/
|
||||||
|
|
||||||
|
# Other
|
||||||
|
.DS_Store
|
||||||
|
*.orig
|
||||||
|
*.log
|
||||||
|
|
||||||
|
*.iml
|
||||||
|
*.flattened-pom.xml
|
||||||
|
|
||||||
|
# IDEs
|
||||||
|
# .vscode
|
||||||
|
# .idea
|
||||||
20
demo/.vscode/extensions.json
vendored
Normal file
20
demo/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
|
||||||
|
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
|
||||||
|
|
||||||
|
// List of extensions which should be recommended for users of this workspace.
|
||||||
|
"recommendations": [
|
||||||
|
// >>>>>>>> Add CDS Editor here as soon it is available of vscode marketplace!,
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
|
"mechatroner.rainbow-csv",
|
||||||
|
"humao.rest-client",
|
||||||
|
"alexcvzz.vscode-sqlite",
|
||||||
|
"hbenl.vscode-mocha-test-adapter",
|
||||||
|
"sdras.night-owl"
|
||||||
|
],
|
||||||
|
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
||||||
|
"unwantedRecommendations": [
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
15
demo/.vscode/launch.json
vendored
Normal file
15
demo/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
// 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": [
|
||||||
|
{
|
||||||
|
"command": "cds run --with-mocks --in-memory?",
|
||||||
|
"name": "cds run",
|
||||||
|
"request": "launch",
|
||||||
|
"type": "node-terminal",
|
||||||
|
"skipFiles": [ "<node_internals>/**" ]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
7
demo/.vscode/settings.json
vendored
Normal file
7
demo/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"files.exclude": {
|
||||||
|
"**/.gitignore": true,
|
||||||
|
"**/.git": true,
|
||||||
|
"**/.vscode": true
|
||||||
|
}
|
||||||
|
}
|
||||||
25
demo/.vscode/tasks.json
vendored
Normal file
25
demo/.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "cds watch",
|
||||||
|
"command": "cds",
|
||||||
|
"args": ["watch"],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
},
|
||||||
|
"problemMatcher": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"label": "cds run",
|
||||||
|
"command": "cds",
|
||||||
|
"args": ["run", "--with-mocks", "--in-memory?"],
|
||||||
|
"problemMatcher": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
25
demo/README.md
Normal file
25
demo/README.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Getting Started
|
||||||
|
|
||||||
|
Welcome to your new project.
|
||||||
|
|
||||||
|
It contains these folders and files, following our recommended project layout:
|
||||||
|
|
||||||
|
File or Folder | Purpose
|
||||||
|
---------|----------
|
||||||
|
`app/` | content for UI frontends goes here
|
||||||
|
`db/` | your domain models and data go here
|
||||||
|
`srv/` | your service models and code go here
|
||||||
|
`package.json` | project metadata and configuration
|
||||||
|
`readme.md` | this getting started guide
|
||||||
|
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
- Open a new terminal and run `cds watch`
|
||||||
|
- (in VS Code simply choose _**Terminal** > Run Task > cds watch_)
|
||||||
|
- Start adding content, for example, a [db/schema.cds](db/schema.cds).
|
||||||
|
|
||||||
|
|
||||||
|
## Learn More
|
||||||
|
|
||||||
|
Learn more at https://cap.cloud.sap/docs/get-started/.
|
||||||
0
demo/app/vue/index.html
Normal file
0
demo/app/vue/index.html
Normal file
27
demo/package.json
Normal file
27
demo/package.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "demo",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "A simple CAP project.",
|
||||||
|
"repository": "<Add your repository here>",
|
||||||
|
"license": "UNLICENSED",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@capire/bookshop": "^1.0.0",
|
||||||
|
"@sap/cds": "^4",
|
||||||
|
"express": "^4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"sqlite3": "5.0.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "cds run"
|
||||||
|
},
|
||||||
|
"cds": {
|
||||||
|
"requires": {
|
||||||
|
"API_BUSINESS_PARTNER": {
|
||||||
|
"kind": "odata",
|
||||||
|
"model": "srv/external/API_BUSINESS_PARTNER"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
demo/server.js
Normal file
11
demo/server.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const express = require('express')
|
||||||
|
const cds = require('@sap/cds')
|
||||||
|
|
||||||
|
cds.once('bootstrap',(app)=>{
|
||||||
|
const {dirname} = require('path')
|
||||||
|
// serving the vue.js app imported from @capire/bookshop
|
||||||
|
const vue_app = dirname (require.resolve('@capire/bookshop/app/vue/index.html'))
|
||||||
|
app.use ('/vue', express.static(vue_app))
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = cds.server
|
||||||
2425
demo/srv/external/API_BUSINESS_PARTNER.csn
vendored
Normal file
2425
demo/srv/external/API_BUSINESS_PARTNER.csn
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3261
demo/srv/external/API_BUSINESS_PARTNER.edmx
vendored
Normal file
3261
demo/srv/external/API_BUSINESS_PARTNER.edmx
vendored
Normal file
File diff suppressed because it is too large
Load Diff
0
demo/srv/service.js
Normal file
0
demo/srv/service.js
Normal file
17
demo/srv/services.cds
Normal file
17
demo/srv/services.cds
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using { sap.capire, sap.capire.bookshop.Books } from '@capire/bookshop';
|
||||||
|
using { API_BUSINESS_PARTNER as external } from './external/API_BUSINESS_PARTNER.csn';
|
||||||
|
|
||||||
|
extend Books with {
|
||||||
|
supplier : Association to Suppliers;
|
||||||
|
}
|
||||||
|
|
||||||
|
extend service CatalogService with {
|
||||||
|
entity MySuppliers as projection on Suppliers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@cds.persistence:{table,skip:false}
|
||||||
|
entity Suppliers as projection on external.A_BusinessPartner {
|
||||||
|
BusinessPartner as ID,
|
||||||
|
LastName,
|
||||||
|
AcademicTitle
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user