Compare commits

..

5 Commits

Author SHA1 Message Date
Daniel
518429e2a0 . 2022-05-31 15:38:54 +02:00
Daniel
02000f4a94 Merged from main 2022-05-31 14:54:11 +02:00
dependabot[bot]
8f5c33f4f5 Bump @sap/cds from 5.9.5 to 5.9.6
Bumps [@sap/cds](https://cap.cloud.sap/) from 5.9.5 to 5.9.6.

---
updated-dependencies:
- dependency-name: "@sap/cds"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-25 14:20:28 +02:00
Daniel Hutzel
a893184736 Add login to bookshop Vue.js app (#358) 2022-05-19 12:16:11 +02:00
Daniel
9370d0544e trying esm modules 2022-05-12 01:44:09 +02:00
30 changed files with 105 additions and 1532 deletions

View File

@@ -10,7 +10,7 @@ const books = Vue.createApp ({
list: [],
book: undefined,
order: { quantity:1, succeeded:'', failed:'' },
user: {}
user: undefined
}
},
@@ -42,19 +42,25 @@ const books = Vue.createApp ({
}
},
async fetchUserInfo() {
async login() {
try {
const { data } = await axios.get('/user/me')
books.user = data
const { data:user } = await axios.post('/user/login',{})
if (user.id !== 'anonymous') books.user = user
} catch (err) { books.user = { id: err.message } }
}
},
async getUserInfo() {
try {
const { data:user } = await axios.get('/user/me')
if (user.id !== 'anonymous') books.user = user
} catch (err) { books.user = { id: err.message } }
},
}
}).mount("#app")
// initially fill list of books
books.fetch()
books.getUserInfo()
books.fetch() // initially fill list of books
books.fetchUserInfo()
document.addEventListener('keydown', (event) => {
// hide user info on request
if (event.key === 'u') books.user = undefined

View File

@@ -18,11 +18,17 @@
<body class="small-container", style="margin-top: 70px;">
<div id='app'>
<div v-if="user" class="user">
<div>User: {{ user.id || 'anonymous' }}</div>
<div>Locale: {{ user.locale }}</div>
<form class="user" @submit.prevent="login">
<div v-if="user">
<div v-if="user.tenant">Tenant: {{ user.tenant }}</div>
<div> User: {{ user.id }}</div>
<div>Locale: {{ user.locale }}</div>
</div>
<div v-else>
<input type="submit" value="Login" class="muted-button">
<!-- <a href="/user/login()">Login</a> -->
</div>
</form>
<h1> Capire Books </h1>

View File

@@ -4,7 +4,7 @@
* currencies, if not obtained through @capire/common.
*/
module.exports = async (db)=>{
export default async (db)=>{
const has_common = db.model.definitions['sap.common.Currencies'].elements.numcode
if (has_common) return

View File

@@ -1,2 +1,2 @@
const { CatalogService } = require('./srv/cat-service')
module.exports = { CatalogService }
import { CatalogService } from './srv/cat-service.js'
export { CatalogService }

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
"name": "@capire/bookshop",
"version": "1.0.0",
"description": "A simple self-contained bookshop service.",
"type": "module",
"files": [
"app",
"srv",
@@ -10,7 +11,7 @@
"index.js"
],
"dependencies": {
"@sap/cds": "^6.1.1",
"@sap/cds": ">=5.9",
"express": "^4.17.1",
"passport": ">=0.4.1"
},
@@ -22,10 +23,7 @@
"cds": {
"requires": {
"db": {
"kind": "sqlite",
"credentials": {
"database": "sqlite.db"
}
"kind": "sql"
}
}
}

Binary file not shown.

View File

@@ -1,6 +1,6 @@
const cds = require('@sap/cds')
import cds from '@sap/cds'
module.exports = cds.service.impl (function(){
export default cds.service.impl (function(){
this.before ('NEW','Authors', genid)
this.before ('NEW','Books', genid)
})

View File

@@ -1,8 +1,8 @@
const cds = require('@sap/cds')
import cds from '@sap/cds'
class CatalogService extends cds.ApplicationService { init(){
export class CatalogService extends cds.ApplicationService { init(){
const { Books } = cds.entities ('sap.capire.bookshop')
const { Books } = this.entities ('sap.capire.bookshop')
// Reduce stock of ordered books if available stock suffices
this.on ('submitOrder', async req => {
@@ -24,5 +24,3 @@ class CatalogService extends cds.ApplicationService { init(){
return super.init()
}}
module.exports = { CatalogService }

View File

@@ -1,9 +1,7 @@
/**
* Exposes user information
*/
@requires: 'authenticated-user'
service UserService {
/**
* The current user
*/
@@ -13,4 +11,5 @@ service UserService {
tenant : String;
}
action login() returns me;
}

View File

@@ -1,4 +1,10 @@
const cds = require('@sap/cds')
module.exports = cds.service.impl((srv) => {
srv.on('READ', 'me', ({ tenant, user, locale }) => ({ id: user.id, locale, tenant }))
})
import cds from '@sap/cds'
export default class UserService extends cds.Service { init(){
this.on('READ', 'me', ({ tenant, user, locale }) => ({ id: user.id, locale, tenant }))
this.on('login', (req) => {
if (req.user._is_anonymous)
req._.res.set('WWW-Authenticate','Basic realm="Users"').sendStatus(401)
else return this.read('me')
})
}}

View File

@@ -2,19 +2,19 @@
////////////////////////////////////////////////////////////////////////////
//
// Note: this is designed for the PerformanceService being co-located with
// bookshop. It does not work if PerformanceService is run as a separate
// Note: this is designed for the OrdersService being co-located with
// bookshop. It does not work if OrdersService is run as a separate
// process, and is not intended to do so.
//
////////////////////////////////////////////////////////////////////////////
using { PerformanceService } from '../srv/performance-service';
using { OrdersService } from '../srv/orders-service';
@odata.draft.enabled
annotate PerformanceService.Orders with @(
annotate OrdersService.Orders with @(
UI: {
SelectionFields: [ createdAt, createdBy ],
LineItem: [
@@ -68,7 +68,7 @@ annotate PerformanceService.Orders with @(
annotate PerformanceService.Orders.Items with @(
annotate OrdersService.Orders.Items with @(
UI: {
LineItem: [
{Value: product_ID, Label:'Product ID'},

View File

@@ -1,4 +1,4 @@
ID;Header_ID;quantity;product_ID;title;price
58040e66-1dcd-4ffb-ab10-fdce32028b79;7e2f2640-6866-4dcf-8f4d-3027aa831cad;10;201;Wuthering Heights;11.11
64e718c9-ff99-47f1-8ca3-950c850777d4;7e2f2640-6866-4dcf-8f4d-3027aa831cad;501;271;Catweazle;15
e9641166-e050-4261-bfee-d1e797e6cb7f;64e718c9-ff99-47f1-8ca3-950c850777d4;499;252;Eleonora;28
ID;up__ID;quantity;product_ID;title;price
58040e66-1dcd-4ffb-ab10-fdce32028b79;7e2f2640-6866-4dcf-8f4d-3027aa831cad;1;201;Wuthering Heights;11.11
64e718c9-ff99-47f1-8ca3-950c850777d4;7e2f2640-6866-4dcf-8f4d-3027aa831cad;1;271;Catweazle;15
e9641166-e050-4261-bfee-d1e797e6cb7f;64e718c9-ff99-47f1-8ca3-950c850777d4;2;252;Eleonora;28
1 ID Header_ID up__ID quantity product_ID title price
2 58040e66-1dcd-4ffb-ab10-fdce32028b79 7e2f2640-6866-4dcf-8f4d-3027aa831cad 7e2f2640-6866-4dcf-8f4d-3027aa831cad 10 1 201 Wuthering Heights 11.11
3 64e718c9-ff99-47f1-8ca3-950c850777d4 7e2f2640-6866-4dcf-8f4d-3027aa831cad 7e2f2640-6866-4dcf-8f4d-3027aa831cad 501 1 271 Catweazle 15
4 e9641166-e050-4261-bfee-d1e797e6cb7f 64e718c9-ff99-47f1-8ca3-950c850777d4 64e718c9-ff99-47f1-8ca3-950c850777d4 499 2 252 Eleonora 28

24
orders/db/schema.cds Normal file
View File

@@ -0,0 +1,24 @@
using { Currency, User, managed, cuid } from '@sap/cds/common';
namespace sap.capire.orders;
entity Orders : cuid, managed {
OrderNo : String @title:'Order Number'; //> readable key
Items : Composition of many {
key ID : UUID;
product : Association to Products;
quantity : Integer;
title : String; //> intentionally replicated as snapshot from product.title
price : Double; //> materialized calculated field
};
buyer : User;
currency : Currency;
}
/** This is a stand-in for arbitrary ordered Products */
entity Products @(cds.persistence.skip:'always') {
key ID : String;
}
// this is to ensure we have filled-in currencies
using from '@capire/common';

View File

@@ -0,0 +1,5 @@
using { sap.capire.orders as my } from '../db/schema';
service OrdersService {
entity Orders as projection on my.Orders;
}

View File

@@ -5,14 +5,6 @@ class OrdersService extends cds.ApplicationService {
init(){
const { 'Orders.Items':OrderItems } = this.entities
// fill itemCategory at runtime
this.before (['CREATE', 'UPDATE'], async req =>{
if(req.data.quantity > 500) {req.data.itemCategory = 'Large'}
else if (req.data.quantity > 100) {req.data.itemCategory = 'Medium'}
else {req.data.itemCategory = 'Small'}
})
//
this.before ('UPDATE', 'Orders', async function(req) {
const { ID, Items } = req.data
if (Items) for (let { product_ID, quantity } of Items) {

42
package-lock.json generated
View File

@@ -1172,9 +1172,9 @@
}
},
"node_modules/@sap/cds": {
"version": "5.9.5",
"resolved": "https://registry.npmjs.org/@sap/cds/-/cds-5.9.5.tgz",
"integrity": "sha512-H/LIB7WnJ3JKzywnfYd9fOLDKVQokO6/JMUUXbCx+VllYuIQFwClwZ+uYQDgWYSrHePRpuOP5TxLFuMXvhdaag==",
"version": "5.9.6",
"resolved": "https://registry.npmjs.org/@sap/cds/-/cds-5.9.6.tgz",
"integrity": "sha512-zzDoRrgAbRXUQ2n+BrDErtAyylMgcJxgWhsiJvjiZVMxAucJMPp9V+WlRsaGwSm8O6STC6NHcv9PWQ7500y9EQ==",
"dependencies": {
"@sap-cloud-sdk/core": "^1.41",
"@sap-cloud-sdk/util": "^1.41",
@@ -5235,9 +5235,9 @@
}
},
"node_modules/moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
"version": "2.29.3",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz",
"integrity": "sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw==",
"engines": {
"node": "*"
}
@@ -5644,13 +5644,12 @@
}
},
"node_modules/passport": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/passport/-/passport-0.6.0.tgz",
"integrity": "sha512-0fe+p3ZnrWRW74fe8+SvCyf4a3Pb2/h7gFkQ8yTJpAO50gDzlfjZUZTO1k5Eg9kUct22OxHLqDZoKUWRHOh9ug==",
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/passport/-/passport-0.5.2.tgz",
"integrity": "sha512-w9n/Ot5I7orGD4y+7V3EFJCQEznE5RxHamUxcqLT2QoJY0f2JdN8GyHonYFvN0Vz+L6lUJfVhrk2aZz2LbuREw==",
"dependencies": {
"passport-strategy": "1.x.x",
"pause": "0.0.1",
"utils-merge": "^1.0.1"
"pause": "0.0.1"
},
"engines": {
"node": ">= 0.4.0"
@@ -8087,9 +8086,9 @@
}
},
"@sap/cds": {
"version": "5.9.5",
"resolved": "https://registry.npmjs.org/@sap/cds/-/cds-5.9.5.tgz",
"integrity": "sha512-H/LIB7WnJ3JKzywnfYd9fOLDKVQokO6/JMUUXbCx+VllYuIQFwClwZ+uYQDgWYSrHePRpuOP5TxLFuMXvhdaag==",
"version": "5.9.6",
"resolved": "https://registry.npmjs.org/@sap/cds/-/cds-5.9.6.tgz",
"integrity": "sha512-zzDoRrgAbRXUQ2n+BrDErtAyylMgcJxgWhsiJvjiZVMxAucJMPp9V+WlRsaGwSm8O6STC6NHcv9PWQ7500y9EQ==",
"requires": {
"@sap-cloud-sdk/core": "^1.41",
"@sap-cloud-sdk/util": "^1.41",
@@ -11284,9 +11283,9 @@
"dev": true
},
"moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
"version": "2.29.3",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz",
"integrity": "sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw=="
},
"ms": {
"version": "2.1.2",
@@ -11594,13 +11593,12 @@
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
},
"passport": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/passport/-/passport-0.6.0.tgz",
"integrity": "sha512-0fe+p3ZnrWRW74fe8+SvCyf4a3Pb2/h7gFkQ8yTJpAO50gDzlfjZUZTO1k5Eg9kUct22OxHLqDZoKUWRHOh9ug==",
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/passport/-/passport-0.5.2.tgz",
"integrity": "sha512-w9n/Ot5I7orGD4y+7V3EFJCQEznE5RxHamUxcqLT2QoJY0f2JdN8GyHonYFvN0Vz+L6lUJfVhrk2aZz2LbuREw==",
"requires": {
"passport-strategy": "1.x.x",
"pause": "0.0.1",
"utils-merge": "^1.0.1"
"pause": "0.0.1"
}
},
"passport-strategy": {

View File

@@ -1,5 +0,0 @@
ID;name;dateOfBirth;placeOfBirth;dateOfDeath;placeOfDeath
101;Emily Brontë;1818-07-30;Thornton, Yorkshire;1848-12-19;Haworth, Yorkshire
107;Charlotte Brontë;1818-04-21;Thornton, Yorkshire;1855-03-31;Haworth, Yorkshire
150;Edgar Allen Poe;1809-01-19;Boston, Massachusetts;1849-10-07;Baltimore, Maryland
170;Richard Carpenter;1929-08-14;Kings Lynn, Norfolk;2012-02-26;Hertfordshire, England
1 ID name dateOfBirth placeOfBirth dateOfDeath placeOfDeath
2 101 Emily Brontë 1818-07-30 Thornton, Yorkshire 1848-12-19 Haworth, Yorkshire
3 107 Charlotte Brontë 1818-04-21 Thornton, Yorkshire 1855-03-31 Haworth, Yorkshire
4 150 Edgar Allen Poe 1809-01-19 Boston, Massachusetts 1849-10-07 Baltimore, Maryland
5 170 Richard Carpenter 1929-08-14 King’s Lynn, Norfolk 2012-02-26 Hertfordshire, England

View File

@@ -1,6 +0,0 @@
ID;title;descr;author_ID;stock;price;currency_code
201;Wuthering Heights;"Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym ""Ellis Bell"". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850.";101;12;11.11;GBP
207;Jane Eyre;"Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name ""Currer Bell"", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism.";107;11;12.34;GBP
251;The Raven;"""The Raven"" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word ""Nevermore"". The poem makes use of folk, mythological, religious, and classical references.";150;333;13.13;USD
252;Eleonora;"""Eleonora"" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively ""happy"" ending.";150;555;14;USD
271;Catweazle;Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts.;170;22;150;JPY
1 ID title descr author_ID stock price currency_code
2 201 Wuthering Heights Wuthering Heights, Emily Brontë's only novel, was published in 1847 under the pseudonym "Ellis Bell". It was written between October 1845 and June 1846. Wuthering Heights and Anne Brontë's Agnes Grey were accepted by publisher Thomas Newby before the success of their sister Charlotte's novel Jane Eyre. After Emily's death, Charlotte edited the manuscript of Wuthering Heights and arranged for the edited version to be published as a posthumous second edition in 1850. 101 12 11.11 GBP
3 207 Jane Eyre Jane Eyre /ɛər/ (originally published as Jane Eyre: An Autobiography) is a novel by English writer Charlotte Brontë, published under the pen name "Currer Bell", on 16 October 1847, by Smith, Elder & Co. of London. The first American edition was published the following year by Harper & Brothers of New York. Primarily a bildungsroman, Jane Eyre follows the experiences of its eponymous heroine, including her growth to adulthood and her love for Mr. Rochester, the brooding master of Thornfield Hall. The novel revolutionised prose fiction in that the focus on Jane's moral and spiritual development is told through an intimate, first-person narrative, where actions and events are coloured by a psychological intensity. The book contains elements of social criticism, with a strong sense of Christian morality at its core and is considered by many to be ahead of its time because of Jane's individualistic character and how the novel approaches the topics of class, sexuality, religion and feminism. 107 11 12.34 GBP
4 251 The Raven "The Raven" is a narrative poem by American writer Edgar Allan Poe. First published in January 1845, the poem is often noted for its musicality, stylized language, and supernatural atmosphere. It tells of a talking raven's mysterious visit to a distraught lover, tracing the man's slow fall into madness. The lover, often identified as being a student, is lamenting the loss of his love, Lenore. Sitting on a bust of Pallas, the raven seems to further distress the protagonist with its constant repetition of the word "Nevermore". The poem makes use of folk, mythological, religious, and classical references. 150 333 13.13 USD
5 252 Eleonora "Eleonora" is a short story by Edgar Allan Poe, first published in 1842 in Philadelphia in the literary annual The Gift. It is often regarded as somewhat autobiographical and has a relatively "happy" ending. 150 555 14 USD
6 271 Catweazle Catweazle is a British fantasy television series, starring Geoffrey Bayldon in the title role, and created by Richard Carpenter for London Weekend Television. The first series, produced and directed by Quentin Lawrence, was screened in the UK on ITV in 1970. The second series, directed by David Reid and David Lane, was shown in 1971. Each series had thirteen episodes, most but not all written by Carpenter, who also published two books based on the scripts. 170 22 150 JPY

View File

@@ -1,5 +0,0 @@
ID;locale;title;descr
201;de;Sturmhöhe;Sturmhöhe (Originaltitel: Wuthering Heights) ist der einzige Roman der englischen Schriftstellerin Emily Brontë (18181848). Der 1847 unter dem Pseudonym Ellis Bell veröffentlichte Roman wurde vom viktorianischen Publikum weitgehend abgelehnt, heute gilt er als ein Klassiker der britischen Romanliteratur des 19. Jahrhunderts.
201;fr;Les Hauts de Hurlevent;Les Hauts de Hurlevent (titre original : Wuthering Heights), parfois orthographié Les Hauts de Hurle-Vent, est l'unique roman d'Emily Brontë, publié pour la première fois en 1847 sous le pseudonyme dEllis Bell. Loin d'être un récit moralisateur, Emily Brontë achève néanmoins le roman dans une atmosphère sereine, suggérant le triomphe de la paix et du Bien sur la vengeance et le Mal.
207;de;Jane Eyre;Jane Eyre. Eine Autobiographie (Originaltitel: Jane Eyre. An Autobiography), erstmals erschienen im Jahr 1847 unter dem Pseudonym Currer Bell, ist der erste veröffentlichte Roman der britischen Autorin Charlotte Brontë und ein Klassiker der viktorianischen Romanliteratur des 19. Jahrhunderts. Der Roman erzählt in Form einer Ich-Erzählung die Lebensgeschichte von Jane Eyre (ausgesprochen /ˌdʒeɪn ˈɛə/), die nach einer schweren Kindheit eine Stelle als Gouvernante annimmt und sich in ihren Arbeitgeber verliebt, jedoch immer wieder um ihre Freiheit und Selbstbestimmung kämpfen muss. Als klein, dünn, blass, stets schlicht dunkel gekleidet und mit strengem Mittelscheitel beschrieben, gilt die Heldin des Romans Jane Eyre nicht zuletzt aufgrund der Kino- und Fernsehversionen der melodramatischen Romanvorlage als die bekannteste englische Gouvernante der Literaturgeschichte
252;de;Eleonora;“Eleonora” ist eine Erzählung von Edgar Allan Poe. Sie wurde 1841 erstveröffentlicht. In ihr geht es um das Paradox der Treue in der Treulosigkeit.
1 ID locale title descr
2 201 de Sturmhöhe Sturmhöhe (Originaltitel: Wuthering Heights) ist der einzige Roman der englischen Schriftstellerin Emily Brontë (1818–1848). Der 1847 unter dem Pseudonym Ellis Bell veröffentlichte Roman wurde vom viktorianischen Publikum weitgehend abgelehnt, heute gilt er als ein Klassiker der britischen Romanliteratur des 19. Jahrhunderts.
3 201 fr Les Hauts de Hurlevent Les Hauts de Hurlevent (titre original : Wuthering Heights), parfois orthographié Les Hauts de Hurle-Vent, est l'unique roman d'Emily Brontë, publié pour la première fois en 1847 sous le pseudonyme d’Ellis Bell. Loin d'être un récit moralisateur, Emily Brontë achève néanmoins le roman dans une atmosphère sereine, suggérant le triomphe de la paix et du Bien sur la vengeance et le Mal.
4 207 de Jane Eyre Jane Eyre. Eine Autobiographie (Originaltitel: Jane Eyre. An Autobiography), erstmals erschienen im Jahr 1847 unter dem Pseudonym Currer Bell, ist der erste veröffentlichte Roman der britischen Autorin Charlotte Brontë und ein Klassiker der viktorianischen Romanliteratur des 19. Jahrhunderts. Der Roman erzählt in Form einer Ich-Erzählung die Lebensgeschichte von Jane Eyre (ausgesprochen /ˌdʒeɪn ˈɛə/), die nach einer schweren Kindheit eine Stelle als Gouvernante annimmt und sich in ihren Arbeitgeber verliebt, jedoch immer wieder um ihre Freiheit und Selbstbestimmung kämpfen muss. Als klein, dünn, blass, stets schlicht dunkel gekleidet und mit strengem Mittelscheitel beschrieben, gilt die Heldin des Romans Jane Eyre nicht zuletzt aufgrund der Kino- und Fernsehversionen der melodramatischen Romanvorlage als die bekannteste englische Gouvernante der Literaturgeschichte
5 252 de Eleonora “Eleonora” ist eine Erzählung von Edgar Allan Poe. Sie wurde 1841 erstveröffentlicht. In ihr geht es um das Paradox der Treue in der Treulosigkeit.

View File

@@ -1,122 +0,0 @@
using { Currency, cuid, managed } from '@sap/cds/common';
namespace sap.capire.performance;
entity OrdersHeaders : managed {
key ID : UUID;
OrderNo : String @title:'Order Number'; //> readable key
buyer : String;
currency : Currency;
Items : Composition of many OrdersItems on Items.Header = $self;
}
entity OrdersItems {
key ID : UUID;
product : Association to Books;
quantity : Integer;
title : String; //> intentionally replicated as snapshot from product.title
price : Double; //> materialized calculated field
Header : Association to OrdersHeaders;
};
entity Books {
key ID : Integer;
title : localized String(111);
descr : localized String(1111);
author : Association to Authors;
stock : Integer;
price : Decimal;
currency : Currency;
}
entity Authors {
key ID : Integer;
name : String(111);
dateOfBirth : Date;
dateOfDeath : Date;
placeOfBirth : String;
placeOfDeath : String;
books : Association to many Books on books.author = $self;
}
entity Apples : cuid, managed {
description : String;
vendor : association to one Vendor;
appleDetails : appleDetailsType;
}
entity Bananas : cuid, managed {
description : String;
vendor : association to one Vendor;
bananaDetails : bananaDetailsType;
}
entity Cherries : cuid, managed {
description : String;
vendor : association to one Vendor;
cherryDetails : cherryDetailsType;
}
entity Mangos : cuid, managed {
description : String;
vendor : association to one Vendor;
mangoDetails : mangoDetailsType;
}
entity Vendor : cuid, managed {
description : String;
}
type appleDetailsType : String;
type bananaDetailsType : String;
type cherryDetailsType : String;
type mangoDetailsType : String;
entity Fruit : cuid, managed {
type : String enum { apple; banana; cherry; mango };
description : String;
vendor : association to one Vendor;
appleDetails : composition of AppleDetails;
bananaDetails : composition of BananaDetails;
cherryDetails : composition of CherryDetails;
mangoDetails : composition of MangoDetails;
}
entity AppleDetails : cuid {
appleDetails : appleDetailsType;
}
entity BananaDetails : cuid {
bananaDetails : bananaDetailsType;
}
entity CherryDetails : cuid {
cherryDetails : cherryDetailsType;
}
entity MangoDetails : cuid {
mangoDetails : mangoDetailsType;
}
view Banana as select from Fruit
{
type,
description,
vendor,
bananaDetails,
}
where type = 'banana';
aspect apple { appleDetails : appleDetailsType; };
aspect banana { bananaDetails : bananaDetailsType;};
aspect cherry { cherryDetails : cherryDetailsType;};
aspect mango { mangoDetails : mangoDetailsType; };
entity Fruit_2 : apple, banana, cherry, mango, cuid, managed {
type : String enum { apple; banana; cherry; mango };
description : String;
vendor : association to one Vendor;
}

View File

@@ -1,95 +0,0 @@
using { sap.capire.performance as my } from '../db/schema';
service PerformanceService {
entity OrdersHeaders as projection on my.OrdersHeaders;
entity OrdersItems as projection on my.OrdersItems;
entity Books as projection on my.Books;
entity Authors as projection on my.Authors;
// static
view OrdersItemsViewJoin as select
OrdersHeaders.ID as Header_ID,
OrdersHeaders.OrderNo as OrderNo,
OrdersHeaders.buyer as buyer,
OrdersHeaders.currency as currency,
key OrdersItems.ID as Item_ID,
OrdersItems.product as product,
OrdersItems.quantity as quantity,
OrdersItems.title as title,
OrdersItems.price as price
from OrdersHeaders JOIN OrdersItems on OrdersHeaders.ID = OrdersItems.Header.ID;
// dynamic entity
entity OrderItemsViewAssoc as projection on OrdersHeaders;
// sort on right table
view SortedOrdersJoin as select
OrdersHeaders.ID as Header_ID,
OrdersHeaders.OrderNo as OrderNo,
OrdersHeaders.buyer as buyer,
OrdersHeaders.currency as currency,
key OrdersItems.ID as Item_ID,
OrdersItems.product as product,
OrdersItems.quantity as quantity,
OrdersItems.title as title,
OrdersItems.price as price
from OrdersHeaders JOIN OrdersItems on OrdersHeaders.ID = OrdersItems.Header.ID
order by title;
// sort on items and join back to header via assoc
view SortedOrdersAssoc as select
from OrdersItems {*, Header.OrderNo, Header.buyer, Header.currency }
order by OrdersItems.title;
// filter on right table
view FilteredOrdersJoin as select
OrdersHeaders.ID as Header_ID,
OrdersHeaders.OrderNo as OrderNo,
OrdersHeaders.buyer as buyer,
OrdersHeaders.currency as currency,
key OrdersItems.ID as Item_ID,
OrdersItems.product as product,
OrdersItems.quantity as quantity,
OrdersItems.title as title,
OrdersItems.price as price
from OrdersHeaders JOIN OrdersItems on OrdersHeaders.ID = OrdersItems.Header.ID
where price > 100;
// filter on items and join back to header via assoc
view FilteredOrdersAssoc as select
from OrdersItems {*, Header.OrderNo, Header.buyer, Header.currency }
where OrdersItems.price > 100;
// TODO avoid CASE -- Denormalization of expensive complex structures,
// calculate on write instead of read
// CASE -> try to remodel to avoid CASE, if re-modelling is not possible,
// fill redundant fields at write
entity OrdersItemsCaseView as projection on OrdersItems {
*,
case
when quantity > 500 then 'Large'
when quantity > 100 then 'Medium'
else 'Small'
end as category : String
};
extend my.OrdersItems with {
itemCategory: String enum{ Small; Medium; Large;};
// fill itemCategory at runtime in performance-service.js
}
entity OrdersItemsNoCaseView as projection on OrdersItems {
*,
itemCategory as category
};
}