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
11 changed files with 1630 additions and 1820 deletions

View File

@@ -1,7 +1,7 @@
using { Currency, managed, sap, extensible } from '@sap/cds/common'; using { Currency, managed, sap } from '@sap/cds/common';
namespace sap.capire.bookshop; namespace sap.capire.bookshop;
entity Books : managed, extensible { entity Books : managed {
key ID : Integer; key ID : Integer;
title : localized String(111); title : localized String(111);
descr : localized String(1111); descr : localized String(1111);
@@ -13,7 +13,7 @@ entity Books : managed, extensible {
image : LargeBinary @Core.MediaType : 'image/png'; image : LargeBinary @Core.MediaType : 'image/png';
} }
entity Authors : managed, extensible { entity Authors : managed {
key ID : Integer; key ID : Integer;
name : String(111); name : String(111);
dateOfBirth : Date; dateOfBirth : Date;

View File

@@ -18,6 +18,9 @@
"db": { "db": {
"kind": "sql" "kind": "sql"
} }
},
"features": {
"assert_integrity": "db"
} }
} }
} }

View File

@@ -17,7 +17,7 @@ GET {{server}}/browse/$metadata
### ------------------------------------------------------------------------ ### ------------------------------------------------------------------------
# Browse Books as any user # Browse Books as any user
GET {{server}}/browse/Books? GET {{server}}/browse/Books?
# &$select=title,stock &$select=title,stock,author
# &$expand=currency # &$expand=currency
# &sap-language=de # &sap-language=de
{{me}} {{me}}
@@ -62,6 +62,22 @@ Authorization: Basic alice:
"currency": { "code": "USD" } "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 # Put image to books

View File

@@ -50,10 +50,6 @@
} }
}, },
"sap.ui5": { "sap.ui5": {
"flexEnabled": true,
"config": {
"experimentalCAPScenario": true
},
"dependencies": { "dependencies": {
"minUI5Version": "1.81.0", "minUI5Version": "1.81.0",
"libs": { "libs": {

View File

@@ -22,10 +22,6 @@
} }
}, },
"sap.ui5": { "sap.ui5": {
"flexEnabled": true,
"config": {
"experimentalCAPScenario": true
},
"dependencies": { "dependencies": {
"libs": { "libs": {
"sap.fe.templates": {} "sap.fe.templates": {}

View File

@@ -10,21 +10,7 @@
<script> <script>
window["sap-ushell-config"] = { window["sap-ushell-config"] = {
defaultRenderer: "fiori2", defaultRenderer: "fiori2",
applications: {}, applications: {}
bootstrapPlugins: {
RuntimeAuthoringPlugin: {
component: "sap.ushell.plugins.rta",
config: {
validateAppVersion: false,
},
},
PersonalizePlugin: {
component: "sap.ushell.plugins.rta-personalize",
config: {
validateAppVersion: false,
},
},
}
}; };
</script> </script>
@@ -36,13 +22,8 @@
data-sap-ui-frameOptions="allow" data-sap-ui-frameOptions="allow"
></script> ></script>
<script> <script>
sap.ui.getCore().attachInit(()=> sap.ushell.Container.createRenderer().placeAt("content")); sap.ui.getCore().attachInit(()=> sap.ushell.Container.createRenderer().placeAt("content"))
sap.ui </script>
.getCore()
.getConfiguration()
.setFlexibilityServices([{ connector: "SessionStorageConnector" }]);
sap.ui.getCore().getConfiguration().setLanguage("en");
</script>
</head> </head>
<body class="sapUiBody" id="content"></body> <body class="sapUiBody" id="content"></body>

View File

@@ -13,9 +13,6 @@
}, },
"cds": { "cds": {
"requires": { "requires": {
"extensibility": {
"kind": "uiflex"
},
"auth": { "auth": {
"strategy": "dummy" "strategy": "dummy"
}, },

View File

@@ -4,5 +4,10 @@
"dependencies": { "dependencies": {
"@capire/common": "*", "@capire/common": "*",
"@sap/cds": "^5" "@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,7 +13,7 @@
"@capire/media": "./media", "@capire/media": "./media",
"@capire/orders": "./orders", "@capire/orders": "./orders",
"@capire/reviews": "./reviews", "@capire/reviews": "./reviews",
"@sap/cds": "^5.5.3" "@sap/cds": "^5.7.3"
}, },
"devDependencies": { "devDependencies": {
"chai": "^4.3.4", "chai": "^4.3.4",
@@ -30,6 +30,7 @@
"media": "cds watch media", "media": "cds watch media",
"mocha": "npx mocha || echo", "mocha": "npx mocha || echo",
"jest": "npx jest", "jest": "npx jest",
"start": "cds watch fiori",
"test": "npm run jest -- --silent", "test": "npm run jest -- --silent",
"test:hello": "cd hello && npm test" "test:hello": "cd hello && npm test"
}, },

View File

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