creating cds model of chinook db
This commit is contained in:
committed by
Daniel Hutzel
parent
dc72442764
commit
e33a455154
BIN
certificates/certificates.db
Normal file
BIN
certificates/certificates.db
Normal file
Binary file not shown.
1
certificates/media-store/.cdsrc.json
Normal file
1
certificates/media-store/.cdsrc.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
24
certificates/media-store/.eslintrc
Normal file
24
certificates/media-store/.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
certificates/media-store/.gitignore
vendored
Normal file
29
certificates/media-store/.gitignore
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# CAP media-store
|
||||
_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
certificates/media-store/.vscode/extensions.json
vendored
Normal file
20
certificates/media-store/.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
certificates/media-store/.vscode/launch.json
vendored
Normal file
15
certificates/media-store/.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
certificates/media-store/.vscode/settings.json
vendored
Normal file
7
certificates/media-store/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files.exclude": {
|
||||
"**/.gitignore": true,
|
||||
"**/.git": true,
|
||||
"**/.vscode": true
|
||||
}
|
||||
}
|
||||
25
certificates/media-store/.vscode/tasks.json
vendored
Normal file
25
certificates/media-store/.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
certificates/media-store/README.md
Normal file
25
certificates/media-store/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/.
|
||||
18
certificates/media-store/package.json
Normal file
18
certificates/media-store/package.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "media-store",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple CAP project.",
|
||||
"repository": "<Add your repository here>",
|
||||
"license": "UNLICENSED",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@sap/cds": "^4",
|
||||
"express": "^4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sqlite3": "^5"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npx cds run"
|
||||
}
|
||||
}
|
||||
1
media-store/.cdsrc.json
Normal file
1
media-store/.cdsrc.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
24
media-store/.eslintrc
Normal file
24
media-store/.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
media-store/.gitignore
vendored
Normal file
29
media-store/.gitignore
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# CAP media-store
|
||||
_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
media-store/.vscode/extensions.json
vendored
Normal file
20
media-store/.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
media-store/.vscode/launch.json
vendored
Normal file
15
media-store/.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
media-store/.vscode/settings.json
vendored
Normal file
7
media-store/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files.exclude": {
|
||||
"**/.gitignore": true,
|
||||
"**/.git": true,
|
||||
"**/.vscode": true
|
||||
}
|
||||
}
|
||||
25
media-store/.vscode/tasks.json
vendored
Normal file
25
media-store/.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
media-store/README.md
Normal file
25
media-store/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/.
|
||||
82
media-store/db/schema.cds
Normal file
82
media-store/db/schema.cds
Normal file
@@ -0,0 +1,82 @@
|
||||
namespace sap.capire.media.store;
|
||||
|
||||
aspect NamedEntityAspect {
|
||||
key ID : Integer;
|
||||
name : String(120);
|
||||
}
|
||||
|
||||
aspect ContactInfoAspect {
|
||||
firstName : String(40);
|
||||
lastName : String(20);
|
||||
city : String(40);
|
||||
state : String(40);
|
||||
adress : String(70);
|
||||
country : String(40);
|
||||
postalCode : String(10);
|
||||
phone : String(24);
|
||||
fax : String(24);
|
||||
email : String(60);
|
||||
}
|
||||
|
||||
entity MediaTypes : NamedEntityAspect {}
|
||||
entity Genres : NamedEntityAspect {}
|
||||
entity Playlists : NamedEntityAspect {}
|
||||
|
||||
entity PlaylistTrack {
|
||||
key playlist : Association to Playlists;
|
||||
key track : Association to Tracks;
|
||||
}
|
||||
|
||||
entity Artists : NamedEntityAspect {}
|
||||
|
||||
entity Albums {
|
||||
key ID : Integer;
|
||||
title : String(120);
|
||||
artist : Association to Artists;
|
||||
}
|
||||
|
||||
entity Employees : ContactInfoAspect {
|
||||
key ID : Integer;
|
||||
reportsTo : Association to Employees;
|
||||
title : String(20);
|
||||
birthDate : DateTime;
|
||||
hireDate : DateTime;
|
||||
}
|
||||
|
||||
entity Customers : ContactInfoAspect {
|
||||
key ID : Integer;
|
||||
company : String(80);
|
||||
supportRepId : Association to Employees;
|
||||
}
|
||||
|
||||
entity Invoices {
|
||||
key ID : Integer;
|
||||
customer : Association to Customers;
|
||||
invoiceDate : DateTime;
|
||||
billingAdress : String(70);
|
||||
billingCity : String(40);
|
||||
billingState : String(40);
|
||||
bilingCountry : String(40);
|
||||
billingPostalCode : String(40);
|
||||
total : Decimal(10, 2);
|
||||
}
|
||||
|
||||
entity InvoiceItems {
|
||||
key ID : Integer;
|
||||
invoice : Association to Invoices;
|
||||
track : Association to Tracks;
|
||||
unitPrice : Decimal(10, 2);
|
||||
quantity : Integer;
|
||||
}
|
||||
|
||||
entity Tracks {
|
||||
key ID : Integer;
|
||||
name : String(200);
|
||||
album : Association to Albums;
|
||||
mediaType : Association to MediaTypes;
|
||||
genre : Association to Genres;
|
||||
composer : String(220);
|
||||
milliseconds : Integer;
|
||||
bytes : Integer;
|
||||
unitPrice : Decimal(10, 2);
|
||||
}
|
||||
28
media-store/package.json
Normal file
28
media-store/package.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "media-store",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple CAP project.",
|
||||
"repository": "<Add your repository here>",
|
||||
"license": "UNLICENSED",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@sap/cds": "^4",
|
||||
"express": "^4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sqlite3": "^5"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npx cds run"
|
||||
},
|
||||
"cds": {
|
||||
"requires": {
|
||||
"db": {
|
||||
"kind": "sqlite",
|
||||
"credentials": {
|
||||
"database": "mychinook.db"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
5
media-store/srv/media-service.cds
Normal file
5
media-store/srv/media-service.cds
Normal file
@@ -0,0 +1,5 @@
|
||||
using {sap.capire.media.store as my} from '../db/schema';
|
||||
|
||||
service MediaService {
|
||||
entity Employees as projection on my.Employees;
|
||||
}
|
||||
Reference in New Issue
Block a user