Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorwolf committed Feb 11, 2020
0 parents commit 90636fd
Show file tree
Hide file tree
Showing 43 changed files with 1,645 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -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"
}
}
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# CAP consumer-app-gwsample
_out
*.db
connection.properties
default-*.json
gen/
node_modules/
package-lock.json
target/

# Web IDE, App Studio
.che/
.gen/

# MTA
*_mta_build_tmp
*.mtar
mta_archives/

# Other
.DS_Store
*.orig
*.log
4 changes: 4 additions & 0 deletions .vscode/cds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// used in launch.json to refer to an installed cds via an absolute path

const cds = require('@sap/cds');
cds.exec();
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// 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": "cds run",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/.vscode/cds",
"args": [ "run", "--with-mocks", "--in-memory?" ],
"skipFiles": [ "<node_internals>/**" ],
"internalConsoleOptions": "openOnSessionStart",
"console": "internalConsole",
"autoAttachChildProcesses": true
}
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"files.exclude": {
"**/.gitignore": true,
"**/.git": true,
"**/.vscode": true
}
}
23 changes: 23 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
// 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", "watch"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"type": "shell",
"label": "cds run",
"command": ["cds", "run", "--with-mocks", "--in-memory?"],
"problemMatcher": []
}
]
}
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Getting Started

Welcome to your new project.

It contains these folders and files, following our recommended project layout:

File / Folder | Purpose
---------|----------
`app/` | content for UI frontends go 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 VSCode simply choose _**Terminal** > Run Task > cds watch_ )
- Start adding content, e.g. a [db/schema.cds](db/schema.cds), ...


## Learn more...

Learn more at https://cap.cloud.sap/docs/get-started/
6 changes: 6 additions & 0 deletions db/csv/my.bookshop-Authors.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ID,NAME
42,Douglas Adams
101,Emily Brontë
107,Charlote Brontë
150,Edgar Allen Poe
170,Richard Carpenter
8 changes: 8 additions & 0 deletions db/csv/my.bookshop-Books.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ID,TITLE,AUTHOR_ID,STOCK
421,The Hitch Hiker's Guide To The Galaxy,42,1000
427,"Life, The Universe And Everything",42,95
201,Wuthering Heights,101,12
207,Jane Eyre,107,11
251,The Raven,150,333
252,Eleonora,150,555
271,Catweazle,170,22
3 changes: 3 additions & 0 deletions db/csv/my.bookshop-Orders.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ID,BOOK_ID,QUANTITY,BUSINESSPARTNER
7e2f2640-6866-4dcf-8f4d-3027aa831cad,421,15,1003764
64e718c9-ff99-47f1-8ca3-950c850777d4,271,9,1003765
5 changes: 5 additions & 0 deletions db/extended.cds
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using my.bookshop as my from './schema';

extend my.Orders with {
businessPartner : String(10);
}
21 changes: 21 additions & 0 deletions db/schema.cds
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace my.bookshop;

using cuid from '@sap/cds/common';

entity Books {
key ID : Integer;
title : String;
stock : Integer;
author : Association to Authors;
}

entity Authors {
key ID : Integer;
name : String;
books : Association to many Books on books.author = $self;
}

entity Orders : cuid {
book : Association to Books;
quantity : Integer;
}
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "consumer-app-gwsample",
"version": "1.0.0",
"description": "A simple CAP project.",
"repository": "<Add your repository here>",
"license": "ISC",
"dependencies": {
"@sap/cds": "^3",
"express": "^4"
},
"scripts": {
"start": "npx cds run",
"generate-odata-client": "npx generate-odata-client --inputDir srv/service-specifications --outputDir srv/odata-client --forceOverwrite"
},
"devDependencies": {
"@sap/cloud-sdk-generator": "^1.16.0",
"sqlite3": "^4.1.1"
},
"cds": {
"requires": {
"db": {
"kind": "sqlite",
"model": [
"db/",
"srv/",
"app/"
]
}
}
}
}
94 changes: 94 additions & 0 deletions srv/external/csn/ZEPM_BP_SRV.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"version": {
"csn": "1.0"
},
"definitions": {
"ZEPM_BP_SRV.EPMBusinessPartner": {
"kind": "entity",
"@cds.persistence.skip": true,
"elements": {
"BpId": {
"key": true,
"type": "cds.String",
"length": 10
},
"BpRole": {
"type": "cds.String",
"length": 3
},
"EmailAddress": {
"type": "cds.String",
"length": 255
},
"PhoneNumber": {
"type": "cds.String",
"length": 30
},
"FaxNumber": {
"type": "cds.String",
"length": 30
},
"WebAddress": {
"type": "cds.String",
"length": 255
},
"CompanyName": {
"type": "cds.String",
"length": 80
},
"LegalForm": {
"type": "cds.String",
"length": 10
},
"CurrencyCode": {
"type": "cds.String",
"length": 5
},
"City": {
"type": "cds.String",
"length": 40
},
"PostalCode": {
"type": "cds.String",
"length": 10
},
"Street": {
"type": "cds.String",
"length": 60
},
"Building": {
"type": "cds.String",
"length": 10
},
"Country": {
"type": "cds.String",
"length": 3
},
"AddressType": {
"type": "cds.String",
"length": 2
},
"AddressValStartDate": {
"type": "cds.Timestamp"
},
"AddressValEndDate": {
"type": "cds.Timestamp"
},
"CreatedBy": {
"type": "cds.String",
"length": 10
},
"CreatedAt": {
"type": "cds.Timestamp"
},
"ChangedBy": {
"type": "cds.String",
"length": 10
},
"ChangedAt": {
"type": "cds.Timestamp"
}
}
}
}
}
18 changes: 18 additions & 0 deletions srv/get-epmbp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// get-epmbp.js

const { EpmBusinessPartnerSet } = require('../odata-client/zepm-bp-service');

function getEpmBusinessPartners() {
return EpmBusinessPartnerSet.requestBuilder()
.getAll()
.top(20) // look at the top 10 bp's only
.select(EpmBusinessPartnerSet.BP_ID, EpmBusinessPartnerSet.COMPANY_NAME)
.execute({
url: 'http://localhost:3000/v2'
});
}

module.exports.getEpmBusinessPartners = getEpmBusinessPartners;
getEpmBusinessPartners().then((epmbp) => {
console.log(epmbp);
});
1 change: 1 addition & 0 deletions srv/odata-client/zepm-bp-service/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@sap:registry=https://npm.sap.com
21 changes: 21 additions & 0 deletions srv/odata-client/zepm-bp-service/BatchRequest.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*!
* Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
*/
import { CreateRequestBuilder, DeleteRequestBuilder, GetAllRequestBuilder, GetByKeyRequestBuilder, ODataBatchChangeSet, ODataBatchRequestBuilder, UpdateRequestBuilder } from '@sap/cloud-sdk-core';
import { EpmBusinessPartnerSet } from './index';
/**
* Batch builder for operations supported on the Zepm Bp Service.
* @param requests The requests of the batch
* @returns A request builder for batch.
*/
export declare function batch(...requests: Array<ReadZepmBpServiceRequestBuilder | ODataBatchChangeSet<WriteZepmBpServiceRequestBuilder>>): ODataBatchRequestBuilder;
/**
* Change set constructor consists of write operations supported on the Zepm Bp Service.
* @param requests The requests of the change set
* @returns A change set for batch.
*/
export declare function changeset(...requests: WriteZepmBpServiceRequestBuilder[]): ODataBatchChangeSet<WriteZepmBpServiceRequestBuilder>;
export declare const defaultZepmBpServicePath = "/sap/opu/odata/sap/ZEPM_BP_SRV";
export declare type ReadZepmBpServiceRequestBuilder = GetAllRequestBuilder<EpmBusinessPartnerSet> | GetByKeyRequestBuilder<EpmBusinessPartnerSet>;
export declare type WriteZepmBpServiceRequestBuilder = CreateRequestBuilder<EpmBusinessPartnerSet> | UpdateRequestBuilder<EpmBusinessPartnerSet> | DeleteRequestBuilder<EpmBusinessPartnerSet>;
//# sourceMappingURL=BatchRequest.d.ts.map
1 change: 1 addition & 0 deletions srv/odata-client/zepm-bp-service/BatchRequest.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions srv/odata-client/zepm-bp-service/BatchRequest.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 90636fd

Please sign in to comment.