Skip to content

Commit

Permalink
Merge branch 'main' into script-tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSchlachter authored Feb 14, 2024
2 parents f87837f + e909e5d commit e973d32
Show file tree
Hide file tree
Showing 31 changed files with 9,049 additions and 7 deletions.
12 changes: 12 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/javascript-node/.devcontainer/base.Dockerfile

# [Choice] Node.js version: 18, 16, 14
ARG VARIANT="18-buster"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

# Install extra tools for CAP development & deployment.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends curl git jq

# Install SAP CAP SDK globally
RUN su node -c "npm install -g @sap/cds-dk"
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "CAP Incident Management Reference App Dev Container",
"build": {
"dockerfile": "Dockerfile",
"args": { "VARIANT": "18" }
},
"customizations": {
"vscode": {
"extensions": [
"mechatroner.rainbow-csv",
"dbaeumer.vscode-eslint",
"sapse.vscode-cds",
"sapse.vsc-extension-odata-csdl-modeler",
"sapse.vscode-wing-cds-editor-vsc",
"saposs.xml-toolkit",
"humao.rest-client"
]
}
},
"forwardPorts": [ 4004 ],
"remoteUser": "node"
}
6 changes: 3 additions & 3 deletions db/data/sap.capire.incidents-Customers.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ID,firstName,lastName,email,phone
8fc8231b-f6d7-43d1-a7e1-725c8e988d18,Daniel,Watts,[email protected],+44-555-123
feb04eac-f84f-4232-bd4f-80a178f24a17,Stormy,Weathers,[email protected],
2b87f6ca-28a2-41d6-8c69-ccf16aa6389d,Sunny,Sunshine,[email protected],+01-555-789
1004155,Daniel,Watts,[email protected],+44-555-123
1004161,Stormy,Weathers,[email protected],
1004100,Sunny,Sunshine,[email protected],+01-555-789
8 changes: 4 additions & 4 deletions db/data/sap.capire.incidents-Incidents.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ID,customer_ID,title,urgency_code,status_code
3b23bb4b-4ac7-4a24-ac02-aa10cabd842c,8fc8231b-f6d7-43d1-a7e1-725c8e988d18,Inverter not functional,H,C
3a4ede72-244a-4f5f-8efa-b17e032d01ee,feb04eac-f84f-4232-bd4f-80a178f24a17,No current on a sunny day,H,N
3ccf474c-3881-44b7-99fb-59a2a4668418,feb04eac-f84f-4232-bd4f-80a178f24a17,Strange noise when switching off Inverter,M,N
3583f982-d7df-4aad-ab26-301d4a157cd7,2b87f6ca-28a2-41d6-8c69-ccf16aa6389d,Solar panel broken,H,I
3b23bb4b-4ac7-4a24-ac02-aa10cabd842c,1004155,Inverter not functional,H,C
3a4ede72-244a-4f5f-8efa-b17e032d01ee,1004161,No current on a sunny day,H,N
3ccf474c-3881-44b7-99fb-59a2a4668418,1004161,Strange noise when switching off Inverter,M,N
3583f982-d7df-4aad-ab26-301d4a157cd7,1004100,Solar panel broken,H,I
1 change: 1 addition & 0 deletions db/schema.cds
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace sap.capire.incidents;
* Customers can create support Incidents.
*/
entity Customers : cuid, managed {
key ID : String;
firstName : String;
lastName : String;
name : String = firstName ||' '|| lastName;
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"add-audit-log": "npm add @cap-js/audit-logging && cp xmpls/data-privacy.cds ./srv",
"reset": "read -p 'This will irreversibly reset your working directory including ALL files in this git repo. Continue?' -n 1 -r && echo && if [[ $REPLY =~ ^[Yy]$ ]]; then git clean -fd && git reset --hard && npm i; fi"
},
"jest": {
"modulePathIgnorePatterns": ["<rootDir>/xmpls/"]
},
"sapux": [
"app/incidents"
],
Expand Down
18 changes: 18 additions & 0 deletions xmpls/messaging/app/incidents/field.cds
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using ProcessorService as service from '../../srv/processor-service';
using from './annotations.cds';
annotate service.Incidents with @(
/*adding email to the object page enables users to view the
changes recieved via Messaging/Eventing*/
UI.FieldGroup #GeneratedGroup1 : {
Data : [...,
{
$Type : 'UI.DataField',
Value : customer.email,
Label : '{i18n>email}'
}
]
});

annotate service.Customers with {
email @readonly
};
3 changes: 3 additions & 0 deletions xmpls/messaging/app/services.cds
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

using from './incidents/annotations';
using from './incidents/field';
91 changes: 91 additions & 0 deletions xmpls/messaging/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"name": "@capire/messaging",
"version": "1.0.0",
"dependencies": {
"@sap-cloud-sdk/connectivity": "^3.6.0",
"@sap-cloud-sdk/http-client": "^3.6.0",
"@sap-cloud-sdk/resilience": "^3.6.0",
"@sap-cloud-sdk/util": "^3.6.0",
"@sap/cds": ">=7",
"@sap/cds-hana": "^2",
"@sap/xssec": "^3",
"express": "^4",
"passport": "^0",
"@sap/xb-msg-amqp-v100": "^0"
},
"devDependencies": {
"@cap-js/sqlite": "^1.0.1",
"@sap/cds-dk": "^7",
"@sap/ux-specification": "^1.108.4",
"axios": "^1.4.0",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"chai-subset": "^1.6.0",
"jest": "^29.5.0",
"rimraf": "^3.0.2"
},
"scripts": {
"watch": "cds watch",
"start": "cds-serve",
"test": "npx jest --silent"
},
"private": true,
"sapux": [
"app/incidents"
],
"cds": {
"requires": {
"incidents-app": {
"model": "@capire/incidents"
},
"[production]": {
"db": {
"kind": "hana-cloud"
},
"auth": {
"kind": "xsuaa"
},
"approuter": {
"kind": "cloudfoundry"
}
},
"[development]": {
"auth": {
"kind": "mocked",
"users": {
"alice": {
"roles": [
"support"
]
},
"bob": {
"roles": [
"support"
]
}
}
}
},
"db": {
"kind": "sql"
},
"API_BUSINESS_PARTNER": {
"kind": "odata-v2",
"model": "srv/external/API_BUSINESS_PARTNER",
"[production]": {
"credentials": {
"destination": "incidents-api-access",
"path": "/sap/opu/odata/sap/API_BUSINESS_PARTNER"
}
}
},
"messaging": {
"kind": "local-messaging",
"[production]": {
"kind": "enterprise-messaging-shared",
"format": "cloudevents"
}
}
}
}
}
21 changes: 21 additions & 0 deletions xmpls/messaging/req.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### Change Email Address

PATCH http://localhost:4004/odata/v4/api-business-partner/A_BusinessPartner('1004155')
Content-Type: application/json

{
"to_BusinessPartnerAddress": [
{
"BusinessPartner": "1004155",
"AddressID": "123",
"to_EmailAddress": [{
"AddressID": "123",
"Person": "Williams",
"OrdinalNumber": "123",
"EmailAddress": "[email protected]"

}
]
}
]
}
Loading

0 comments on commit e973d32

Please sign in to comment.