Merge branch 'main' into addCustomRules
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -18,3 +18,5 @@ reviews/msg-box
|
|||||||
reviews/db/test.db
|
reviews/db/test.db
|
||||||
|
|
||||||
*.openapi3.json
|
*.openapi3.json
|
||||||
|
*.sqlite
|
||||||
|
*.db
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ const books = Vue.createApp ({
|
|||||||
} catch (err) { books.user = { id: err.message } }
|
} catch (err) { books.user = { id: err.message } }
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}).mount("#app")
|
}).mount('#app')
|
||||||
|
|
||||||
books.getUserInfo()
|
books.getUserInfo()
|
||||||
books.fetch() // initially fill list of books
|
books.fetch() // initially fill list of books
|
||||||
@@ -65,3 +65,25 @@ document.addEventListener('keydown', (event) => {
|
|||||||
// hide user info on request
|
// hide user info on request
|
||||||
if (event.key === 'u') books.user = undefined
|
if (event.key === 'u') books.user = undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
|
axios.interceptors.request.use(csrfToken)
|
||||||
|
function csrfToken (request) {
|
||||||
|
if (request.method === 'head' || request.method === 'get') return request
|
||||||
|
if ('csrfToken' in document) {
|
||||||
|
request.headers['x-csrf-token'] = document.csrfToken
|
||||||
|
return request
|
||||||
|
}
|
||||||
|
return fetchToken().then(token => {
|
||||||
|
document.csrfToken = token
|
||||||
|
request.headers['x-csrf-token'] = document.csrfToken
|
||||||
|
return request
|
||||||
|
}).catch(_ => {
|
||||||
|
document.csrfToken = null // set mark to not try again
|
||||||
|
return request
|
||||||
|
})
|
||||||
|
|
||||||
|
function fetchToken() {
|
||||||
|
return axios.get('/', { headers: { 'x-csrf-token': 'fetch' } })
|
||||||
|
.then(res => res.headers['x-csrf-token'])
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,5 +2,5 @@ ID;title;descr;author_ID;stock;price;currency_code;genre_ID
|
|||||||
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;11
|
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;11
|
||||||
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;11
|
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;11
|
||||||
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;16
|
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;16
|
||||||
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;16
|
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;15
|
||||||
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;13
|
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;13
|
||||||
|
@@ -2,7 +2,8 @@ const cds = require('@sap/cds')
|
|||||||
|
|
||||||
class CatalogService extends cds.ApplicationService { init(){
|
class CatalogService extends cds.ApplicationService { init(){
|
||||||
|
|
||||||
const { Books } = this.entities ('sap.capire.bookshop')
|
const { Books } = cds.entities ('sap.capire.bookshop')
|
||||||
|
const { ListOfBooks } = this.entities
|
||||||
|
|
||||||
// Reduce stock of ordered books if available stock suffices
|
// Reduce stock of ordered books if available stock suffices
|
||||||
this.on ('submitOrder', async req => {
|
this.on ('submitOrder', async req => {
|
||||||
@@ -18,7 +19,7 @@ class CatalogService extends cds.ApplicationService { init(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Add some discount for overstocked books
|
// Add some discount for overstocked books
|
||||||
this.after ('READ','ListOfBooks', each => {
|
this.after ('READ', ListOfBooks, each => {
|
||||||
if (each.stock > 111) each.title += ` -- 11% discount!`
|
if (each.stock > 111) each.title += ` -- 11% discount!`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ service UserService {
|
|||||||
/**
|
/**
|
||||||
* The current user
|
* The current user
|
||||||
*/
|
*/
|
||||||
@odata.singleton entity me {
|
@odata.singleton entity me @cds.persistence.skip {
|
||||||
id : String; // user id
|
id : String; // user id
|
||||||
locale : String;
|
locale : String;
|
||||||
tenant : String;
|
tenant : String;
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ module.exports = cds.server
|
|||||||
|
|
||||||
// For didactic reasons in capire
|
// For didactic reasons in capire
|
||||||
const { ReviewsService, OrdersService } = cds.requires
|
const { ReviewsService, OrdersService } = cds.requires
|
||||||
if (!ReviewsService.credentials && !OrdersService.credentials) cds.requires.messaging = false
|
if (!ReviewsService?.credentials && !OrdersService?.credentials) cds.requires.messaging = false
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
* Exposes data + entity metadata
|
* Exposes data + entity metadata
|
||||||
*/
|
*/
|
||||||
@requires:'authenticated-user'
|
@requires:'authenticated-user'
|
||||||
service DataService @( path:'-data' ) {
|
@odata service DataService @( path:'-data' ) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Metadata like name and columns/elements
|
* Metadata like name and columns/elements
|
||||||
*/
|
*/
|
||||||
entity Entities {
|
entity Entities @cds.persistence.skip {
|
||||||
key name : String;
|
key name : String;
|
||||||
columns: Composition of many {
|
columns: Composition of many {
|
||||||
name : String;
|
name : String;
|
||||||
@@ -19,7 +19,7 @@ service DataService @( path:'-data' ) {
|
|||||||
/**
|
/**
|
||||||
* The actual data, organized by column name
|
* The actual data, organized by column name
|
||||||
*/
|
*/
|
||||||
entity Data {
|
entity Data @cds.persistence.skip {
|
||||||
record : array of {
|
record : array of {
|
||||||
column : String;
|
column : String;
|
||||||
data : String;
|
data : String;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ annotate CatalogService.Books with @(UI : {
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Books Object Page
|
// Books List Page
|
||||||
//
|
//
|
||||||
annotate CatalogService.Books with @(UI : {
|
annotate CatalogService.Books with @(UI : {
|
||||||
SelectionFields : [
|
SelectionFields : [
|
||||||
|
|||||||
@@ -10,40 +10,31 @@ using { sap.common } from '@capire/common';
|
|||||||
// Books Lists
|
// Books Lists
|
||||||
//
|
//
|
||||||
annotate my.Books with @(
|
annotate my.Books with @(
|
||||||
Common.SemanticKey : [ID],
|
Common.SemanticKey : [ID],
|
||||||
UI : {
|
UI : {
|
||||||
Identification : [{Value : title}],
|
Identification : [{ Value: title }],
|
||||||
SelectionFields : [
|
SelectionFields : [
|
||||||
ID,
|
ID,
|
||||||
author_ID,
|
author_ID,
|
||||||
price,
|
price,
|
||||||
currency_code
|
currency_code
|
||||||
],
|
],
|
||||||
LineItem : [
|
LineItem : [
|
||||||
{
|
{ Value: ID, Label: '{i18n>Title}' },
|
||||||
Value : ID,
|
{ Value: author.ID, Label: '{i18n>Author}' },
|
||||||
Label : '{i18n>Title}'
|
{ Value: genre.name },
|
||||||
},
|
{ Value: stock },
|
||||||
{
|
{ Value: price },
|
||||||
Value : author.ID,
|
{ Value: currency.symbol, Label: ' ' },
|
||||||
Label : '{i18n>Author}'
|
]
|
||||||
},
|
}
|
||||||
{Value : genre.name},
|
|
||||||
{Value : stock},
|
|
||||||
{Value : price},
|
|
||||||
{
|
|
||||||
Value : currency.symbol,
|
|
||||||
Label : ' '
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
ID @Common: {
|
ID @Common: {
|
||||||
SemanticObject : 'Books',
|
SemanticObject : 'Books',
|
||||||
Text: title,
|
Text: title,
|
||||||
TextArrangement : #TextOnly
|
TextArrangement : #TextOnly
|
||||||
};
|
};
|
||||||
author @ValueList.entity : 'Authors';
|
author @ValueList.entity : 'Authors';
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -51,10 +42,10 @@ annotate my.Books with @(
|
|||||||
// Books Details
|
// Books Details
|
||||||
//
|
//
|
||||||
annotate my.Books with @(UI : {HeaderInfo : {
|
annotate my.Books with @(UI : {HeaderInfo : {
|
||||||
TypeName : '{i18n>Book}',
|
TypeName : '{i18n>Book}',
|
||||||
TypeNamePlural : '{i18n>Books}',
|
TypeNamePlural : '{i18n>Books}',
|
||||||
Title : {Value : title},
|
Title : { Value: title },
|
||||||
Description : {Value : author.name}
|
Description : { Value: author.name }
|
||||||
}, });
|
}, });
|
||||||
|
|
||||||
|
|
||||||
@@ -63,19 +54,13 @@ annotate my.Books with @(UI : {HeaderInfo : {
|
|||||||
// Books Elements
|
// Books Elements
|
||||||
//
|
//
|
||||||
annotate my.Books with {
|
annotate my.Books with {
|
||||||
ID @title : '{i18n>ID}';
|
ID @title: '{i18n>ID}';
|
||||||
title @title : '{i18n>Title}';
|
title @title: '{i18n>Title}';
|
||||||
genre @title : '{i18n>Genre}' @Common : {
|
genre @title: '{i18n>Genre}' @Common: { Text: genre.name, TextArrangement: #TextOnly };
|
||||||
Text : genre.name,
|
author @title: '{i18n>Author}' @Common: { Text: author.name, TextArrangement: #TextOnly };
|
||||||
TextArrangement : #TextOnly
|
price @title: '{i18n>Price}' @Measures.ISOCurrency : currency_code;
|
||||||
};
|
stock @title: '{i18n>Stock}';
|
||||||
author @title : '{i18n>Author}' @Common : {
|
descr @UI.MultiLineText;
|
||||||
Text : author.name,
|
|
||||||
TextArrangement : #TextOnly
|
|
||||||
};
|
|
||||||
price @title : '{i18n>Price}' @Measures.ISOCurrency : currency_code;
|
|
||||||
stock @title : '{i18n>Stock}';
|
|
||||||
descr @UI.MultiLineText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -83,17 +68,17 @@ annotate my.Books with {
|
|||||||
// Genres List
|
// Genres List
|
||||||
//
|
//
|
||||||
annotate my.Genres with @(
|
annotate my.Genres with @(
|
||||||
Common.SemanticKey : [name],
|
Common.SemanticKey : [name],
|
||||||
UI : {
|
UI : {
|
||||||
SelectionFields : [name],
|
SelectionFields : [name],
|
||||||
LineItem : [
|
LineItem : [
|
||||||
{Value : name},
|
{ Value: name },
|
||||||
{
|
{
|
||||||
Value : parent.name,
|
Value : parent.name,
|
||||||
Label : 'Main Genre'
|
Label: 'Main Genre'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -101,18 +86,18 @@ annotate my.Genres with @(
|
|||||||
// Genre Details
|
// Genre Details
|
||||||
//
|
//
|
||||||
annotate my.Genres with @(UI : {
|
annotate my.Genres with @(UI : {
|
||||||
Identification : [{Value : name}],
|
Identification : [{ Value: name}],
|
||||||
HeaderInfo : {
|
HeaderInfo : {
|
||||||
TypeName : '{i18n>Genre}',
|
TypeName : '{i18n>Genre}',
|
||||||
TypeNamePlural : '{i18n>Genres}',
|
TypeNamePlural : '{i18n>Genres}',
|
||||||
Title : {Value : name},
|
Title : { Value: name },
|
||||||
Description : {Value : ID}
|
Description : { Value: ID }
|
||||||
},
|
},
|
||||||
Facets : [{
|
Facets : [{
|
||||||
$Type : 'UI.ReferenceFacet',
|
$Type : 'UI.ReferenceFacet',
|
||||||
Label : '{i18n>SubGenres}',
|
Label : '{i18n>SubGenres}',
|
||||||
Target : 'children/@UI.LineItem'
|
Target : 'children/@UI.LineItem'
|
||||||
}, ],
|
}, ],
|
||||||
});
|
});
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -120,8 +105,8 @@ annotate my.Genres with @(UI : {
|
|||||||
// Genres Elements
|
// Genres Elements
|
||||||
//
|
//
|
||||||
annotate my.Genres with {
|
annotate my.Genres with {
|
||||||
ID @title : '{i18n>ID}';
|
ID @title: '{i18n>ID}';
|
||||||
name @title : '{i18n>Genre}';
|
name @title: '{i18n>Genre}';
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -129,24 +114,24 @@ annotate my.Genres with {
|
|||||||
// Authors List
|
// Authors List
|
||||||
//
|
//
|
||||||
annotate my.Authors with @(
|
annotate my.Authors with @(
|
||||||
Common.SemanticKey : [ID],
|
Common.SemanticKey : [ID],
|
||||||
UI : {
|
UI : {
|
||||||
Identification : [{Value : name}],
|
Identification : [{ Value: name}],
|
||||||
SelectionFields : [name],
|
SelectionFields : [name],
|
||||||
LineItem : [
|
LineItem : [
|
||||||
{Value : ID},
|
{ Value: ID },
|
||||||
{Value : dateOfBirth},
|
{ Value: dateOfBirth },
|
||||||
{Value : dateOfDeath},
|
{ Value: dateOfDeath },
|
||||||
{Value : placeOfBirth},
|
{ Value: placeOfBirth },
|
||||||
{Value : placeOfDeath},
|
{ Value: placeOfDeath },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
ID @Common: {
|
ID @Common: {
|
||||||
SemanticObject : 'Authors',
|
SemanticObject : 'Authors',
|
||||||
Text: name,
|
Text: name,
|
||||||
TextArrangement : #TextOnly,
|
TextArrangement : #TextOnly,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -154,16 +139,16 @@ annotate my.Authors with @(
|
|||||||
// Author Details
|
// Author Details
|
||||||
//
|
//
|
||||||
annotate my.Authors with @(UI : {
|
annotate my.Authors with @(UI : {
|
||||||
HeaderInfo : {
|
HeaderInfo : {
|
||||||
TypeName : '{i18n>Author}',
|
TypeName : '{i18n>Author}',
|
||||||
TypeNamePlural : '{i18n>Authors}',
|
TypeNamePlural : '{i18n>Authors}',
|
||||||
Title : {Value : name},
|
Title : { Value: name },
|
||||||
Description : {Value : dateOfBirth}
|
Description : { Value: dateOfBirth }
|
||||||
},
|
},
|
||||||
Facets : [{
|
Facets : [{
|
||||||
$Type : 'UI.ReferenceFacet',
|
$Type : 'UI.ReferenceFacet',
|
||||||
Target : 'books/@UI.LineItem'
|
Target : 'books/@UI.LineItem'
|
||||||
}, ],
|
}, ],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -172,12 +157,12 @@ annotate my.Authors with @(UI : {
|
|||||||
// Authors Elements
|
// Authors Elements
|
||||||
//
|
//
|
||||||
annotate my.Authors with {
|
annotate my.Authors with {
|
||||||
ID @title : '{i18n>ID}';
|
ID @title: '{i18n>ID}';
|
||||||
name @title : '{i18n>Name}';
|
name @title: '{i18n>Name}';
|
||||||
dateOfBirth @title : '{i18n>DateOfBirth}';
|
dateOfBirth @title: '{i18n>DateOfBirth}';
|
||||||
dateOfDeath @title : '{i18n>DateOfDeath}';
|
dateOfDeath @title: '{i18n>DateOfDeath}';
|
||||||
placeOfBirth @title : '{i18n>PlaceOfBirth}';
|
placeOfBirth @title: '{i18n>PlaceOfBirth}';
|
||||||
placeOfDeath @title : '{i18n>PlaceOfDeath}';
|
placeOfDeath @title: '{i18n>PlaceOfDeath}';
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -185,18 +170,18 @@ annotate my.Authors with {
|
|||||||
// Languages List
|
// Languages List
|
||||||
//
|
//
|
||||||
annotate common.Languages with @(
|
annotate common.Languages with @(
|
||||||
Common.SemanticKey : [code],
|
Common.SemanticKey : [code],
|
||||||
Identification : [{Value : code}],
|
Identification : [{ Value: code}],
|
||||||
UI : {
|
UI : {
|
||||||
SelectionFields : [
|
SelectionFields : [
|
||||||
name,
|
name,
|
||||||
descr
|
descr
|
||||||
],
|
],
|
||||||
LineItem : [
|
LineItem : [
|
||||||
{Value : code},
|
{ Value: code },
|
||||||
{Value : name},
|
{ Value: name },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -204,22 +189,22 @@ annotate common.Languages with @(
|
|||||||
// Language Details
|
// Language Details
|
||||||
//
|
//
|
||||||
annotate common.Languages with @(UI : {
|
annotate common.Languages with @(UI : {
|
||||||
HeaderInfo : {
|
HeaderInfo : {
|
||||||
TypeName : '{i18n>Language}',
|
TypeName : '{i18n>Language}',
|
||||||
TypeNamePlural : '{i18n>Languages}',
|
TypeNamePlural : '{i18n>Languages}',
|
||||||
Title : {Value : name},
|
Title : { Value: name },
|
||||||
Description : {Value : descr}
|
Description : { Value: descr }
|
||||||
},
|
},
|
||||||
Facets : [{
|
Facets : [{
|
||||||
$Type : 'UI.ReferenceFacet',
|
$Type : 'UI.ReferenceFacet',
|
||||||
Label : '{i18n>Details}',
|
Label : '{i18n>Details}',
|
||||||
Target : '@UI.FieldGroup#Details'
|
Target : '@UI.FieldGroup#Details'
|
||||||
}, ],
|
}, ],
|
||||||
FieldGroup #Details : {Data : [
|
FieldGroup #Details : {Data : [
|
||||||
{Value : code},
|
{ Value: code },
|
||||||
{Value : name},
|
{ Value: name },
|
||||||
{Value : descr}
|
{ Value: descr }
|
||||||
]},
|
]},
|
||||||
});
|
});
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -227,19 +212,19 @@ annotate common.Languages with @(UI : {
|
|||||||
// Currencies List
|
// Currencies List
|
||||||
//
|
//
|
||||||
annotate common.Currencies with @(
|
annotate common.Currencies with @(
|
||||||
Common.SemanticKey : [code],
|
Common.SemanticKey : [code],
|
||||||
Identification : [{Value : code}],
|
Identification : [{ Value: code}],
|
||||||
UI : {
|
UI : {
|
||||||
SelectionFields : [
|
SelectionFields : [
|
||||||
name,
|
name,
|
||||||
descr
|
descr
|
||||||
],
|
],
|
||||||
LineItem : [
|
LineItem : [
|
||||||
{Value : descr},
|
{ Value: descr },
|
||||||
{Value : symbol},
|
{ Value: symbol },
|
||||||
{Value : code},
|
{ Value: code },
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -247,35 +232,35 @@ annotate common.Currencies with @(
|
|||||||
// Currency Details
|
// Currency Details
|
||||||
//
|
//
|
||||||
annotate common.Currencies with @(UI : {
|
annotate common.Currencies with @(UI : {
|
||||||
HeaderInfo : {
|
HeaderInfo : {
|
||||||
TypeName : '{i18n>Currency}',
|
TypeName : '{i18n>Currency}',
|
||||||
TypeNamePlural : '{i18n>Currencies}',
|
TypeNamePlural : '{i18n>Currencies}',
|
||||||
Title : {Value : descr},
|
Title : { Value: descr },
|
||||||
Description : {Value : code}
|
Description : { Value: code }
|
||||||
|
},
|
||||||
|
Facets : [
|
||||||
|
{
|
||||||
|
$Type : 'UI.ReferenceFacet',
|
||||||
|
Label : '{i18n>Details}',
|
||||||
|
Target : '@UI.FieldGroup#Details'
|
||||||
},
|
},
|
||||||
Facets : [
|
{
|
||||||
{
|
$Type : 'UI.ReferenceFacet',
|
||||||
$Type : 'UI.ReferenceFacet',
|
Label : '{i18n>Extended}',
|
||||||
Label : '{i18n>Details}',
|
Target : '@UI.FieldGroup#Extended'
|
||||||
Target : '@UI.FieldGroup#Details'
|
},
|
||||||
},
|
],
|
||||||
{
|
FieldGroup #Details : {Data : [
|
||||||
$Type : 'UI.ReferenceFacet',
|
{ Value: name },
|
||||||
Label : '{i18n>Extended}',
|
{ Value: symbol },
|
||||||
Target : '@UI.FieldGroup#Extended'
|
{ Value: code },
|
||||||
},
|
{ Value: descr }
|
||||||
],
|
]},
|
||||||
FieldGroup #Details : {Data : [
|
FieldGroup #Extended : {Data : [
|
||||||
{Value : name},
|
{ Value: numcode },
|
||||||
{Value : symbol},
|
{ Value: minor },
|
||||||
{Value : code},
|
{ Value: exponent }
|
||||||
{Value : descr}
|
]},
|
||||||
]},
|
|
||||||
FieldGroup #Extended : {Data : [
|
|
||||||
{Value : numcode},
|
|
||||||
{Value : minor},
|
|
||||||
{Value : exponent}
|
|
||||||
]},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -283,7 +268,7 @@ annotate common.Currencies with @(UI : {
|
|||||||
// Currencies Elements
|
// Currencies Elements
|
||||||
//
|
//
|
||||||
annotate common.Currencies with {
|
annotate common.Currencies with {
|
||||||
numcode @title : '{i18n>NumCode}';
|
numcode @title: '{i18n>NumCode}';
|
||||||
minor @title : '{i18n>MinorUnit}';
|
minor @title: '{i18n>MinorUnit}';
|
||||||
exponent @title : '{i18n>Exponent}';
|
exponent @title: '{i18n>Exponent}';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ using { OrdersService } from '../srv/orders-service';
|
|||||||
@odata.draft.enabled
|
@odata.draft.enabled
|
||||||
annotate OrdersService.Orders with @(
|
annotate OrdersService.Orders with @(
|
||||||
UI: {
|
UI: {
|
||||||
SelectionFields: [ createdAt, createdBy ],
|
SelectionFields: [ createdBy ],
|
||||||
LineItem: [
|
LineItem: [
|
||||||
{Value: OrderNo, Label:'OrderNo'},
|
{Value: OrderNo, Label:'OrderNo'},
|
||||||
{Value: buyer, Label:'Customer'},
|
{Value: buyer, Label:'Customer'},
|
||||||
{Value: createdAt, Label:'Date'}
|
{Value: currency.symbol, Label:'Currency'},
|
||||||
|
{Value: createdAt, Label:'Date'},
|
||||||
],
|
],
|
||||||
HeaderInfo: {
|
HeaderInfo: {
|
||||||
TypeName: 'Order', TypeNamePlural: 'Orders',
|
TypeName: 'Order', TypeNamePlural: 'Orders',
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
applications: {
|
applications: {
|
||||||
"manage-orders": {
|
"manage-orders": {
|
||||||
title: "Manage Orders",
|
title: "Manage Orders",
|
||||||
description: "... testing FE v42",
|
description: "CAP Sample App",
|
||||||
additionalInformation: "SAPUI5.Component=orders",
|
additionalInformation: "SAPUI5.Component=orders",
|
||||||
applicationType : "URL",
|
applicationType : "URL",
|
||||||
url: "/orders/webapp",
|
url: "/orders/webapp",
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
"sap.app": {
|
"sap.app": {
|
||||||
"id": "orders",
|
"id": "orders",
|
||||||
"type": "application",
|
"type": "application",
|
||||||
"title": "Order Books",
|
"title": "Order Management",
|
||||||
"description": "Sample Application",
|
"description": "CAP Sample Application",
|
||||||
"i18n": "i18n/i18n.properties",
|
"i18n": "i18n/i18n.properties",
|
||||||
"dataSources": {
|
"dataSources": {
|
||||||
"OrdersService": {
|
"OrdersService": {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using { Currency, User, managed, cuid } from '@sap/cds/common';
|
|||||||
namespace sap.capire.orders;
|
namespace sap.capire.orders;
|
||||||
|
|
||||||
entity Orders : cuid, managed {
|
entity Orders : cuid, managed {
|
||||||
OrderNo : String @title:'Order Number'; //> readable key
|
OrderNo : String(22) @title:'Order Number'; //> readable key
|
||||||
Items : Composition of many {
|
Items : Composition of many {
|
||||||
key ID : UUID;
|
key ID : UUID;
|
||||||
product : Association to Products;
|
product : Association to Products;
|
||||||
|
|||||||
80
package-lock.json
generated
80
package-lock.json
generated
@@ -58,9 +58,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@mapbox/node-pre-gyp": {
|
"@mapbox/node-pre-gyp": {
|
||||||
"version": "1.0.9",
|
"version": "1.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.9.tgz",
|
"resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.10.tgz",
|
||||||
"integrity": "sha512-aDF3S3rK9Q2gey/WAttUlISduDItz5BU3306M9Eyv6/oS40aMprnopshtlKTykxRNIBEZuRMaZAnbrQ4QtKGyw==",
|
"integrity": "sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"detect-libc": "^2.0.0",
|
"detect-libc": "^2.0.0",
|
||||||
@@ -123,18 +123,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@sap/cds": {
|
"@sap/cds": {
|
||||||
"version": "6.1.3",
|
"version": "6.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@sap/cds/-/cds-6.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@sap/cds/-/cds-6.2.2.tgz",
|
||||||
"integrity": "sha512-yvL9lPonVwUx9Md1eylAtpY0JrlSMyoxZXnCA2q9lNoVNudmjPMynO5CJBfAYEaThZSqd2yMJg/+xyKy/mn3wg==",
|
"integrity": "sha512-l1ps/Ofp+0k/ngSrCHBFNUXQew6n9A4OJhrm3CroxIEq8wQeXB5LBq53YQQYoCj807eQlXbVbzg6hRCm+BgDaQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@sap/cds-compiler": "^3.0.0",
|
"@sap/cds-compiler": "^3.2.0",
|
||||||
"@sap/cds-foss": "^4"
|
"@sap/cds-foss": "^4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@sap/cds-compiler": {
|
"@sap/cds-compiler": {
|
||||||
"version": "3.1.2",
|
"version": "3.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/@sap/cds-compiler/-/cds-compiler-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/@sap/cds-compiler/-/cds-compiler-3.3.2.tgz",
|
||||||
"integrity": "sha512-csH3aEs4aPCzAtc75Jx/Ayym2A06JgAeaDUFLXI867/Vsp2F0g7MJxuCkNhpa+zVZsXcyB0Kxzzv4xU7zuJXsQ==",
|
"integrity": "sha512-jOUEjSMBOVZXmWgx3/mu8H9BbvgP+HVyyKXbHHZWJlk0NMlk+FI/q4KagUaGWJFyRVBskdzF4zBD/QLlrhRnHA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"antlr4": "4.9.3"
|
"antlr4": "4.9.3"
|
||||||
}
|
}
|
||||||
@@ -383,13 +383,14 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"axios": {
|
"axios": {
|
||||||
"version": "0.27.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.1.2.tgz",
|
||||||
"integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==",
|
"integrity": "sha512-bznQyETwElsXl2RK7HLLwb5GPpOLlycxHCtrpDR/4RqqBzjARaOTo3jz4IgtntWUYee7Ne4S8UHd92VCuzPaWA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"follow-redirects": "^1.14.9",
|
"follow-redirects": "^1.15.0",
|
||||||
"form-data": "^4.0.0"
|
"form-data": "^4.0.0",
|
||||||
|
"proxy-from-env": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
@@ -940,9 +941,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"generic-pool": {
|
"generic-pool": {
|
||||||
"version": "3.8.2",
|
"version": "3.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-3.9.0.tgz",
|
||||||
"integrity": "sha512-nGToKy6p3PAbYQ7p1UlWl6vSPwfwU6TMSWK7TTu+WUY4ZjyZQGniGGt2oNVvyNSpyZYSB43zMXVLcBm08MTMkg=="
|
"integrity": "sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g=="
|
||||||
},
|
},
|
||||||
"get-func-name": {
|
"get-func-name": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
@@ -1721,10 +1722,15 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"sax": {
|
||||||
|
"version": "1.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||||
|
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||||
|
},
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "7.3.7",
|
"version": "7.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
|
||||||
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
|
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"lru-cache": "^6.0.0"
|
"lru-cache": "^6.0.0"
|
||||||
@@ -1771,9 +1777,9 @@
|
|||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"socks": {
|
"socks": {
|
||||||
"version": "2.7.0",
|
"version": "2.7.1",
|
||||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
|
||||||
"integrity": "sha512-scnOe9y4VuiNUULJN72GrM26BNOjVsfPXI+j+98PkyEfsIXroa5ofyjT+FzGvn/xHs73U2JtoBYAVx9Hl4quSA==",
|
"integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -1794,9 +1800,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sqlite3": {
|
"sqlite3": {
|
||||||
"version": "5.1.0",
|
"version": "5.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.1.2.tgz",
|
||||||
"integrity": "sha512-/cZl9DfeSQMWR5g9SdluHGt+YL3URetjtvgv1XPQx7rzXOFdZx30EnZj709wCEIznjjzZdo5Lmt5GUeNyGgUbQ==",
|
"integrity": "sha512-D0Reg6pRWAFXFUnZKsszCI67tthFD8fGPewRddDCX6w4cYwz3MbvuwRICbL+YQjBAh9zbw+lJ/V9oC8nG5j6eg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@mapbox/node-pre-gyp": "^1.0.0",
|
"@mapbox/node-pre-gyp": "^1.0.0",
|
||||||
@@ -2001,6 +2007,22 @@
|
|||||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"xml2js": {
|
||||||
|
"version": "0.4.23",
|
||||||
|
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz",
|
||||||
|
"integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==",
|
||||||
|
"requires": {
|
||||||
|
"sax": ">=0.6.0",
|
||||||
|
"xmlbuilder": "~11.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"xmlbuilder": {
|
||||||
|
"version": "11.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
|
||||||
|
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"xmlbuilder": {
|
"xmlbuilder": {
|
||||||
"version": "15.1.1",
|
"version": "15.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz",
|
||||||
@@ -2013,10 +2035,6 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"yaml": {
|
"yaml": {
|
||||||
"version": "2.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.1.1.tgz",
|
|
||||||
"integrity": "sha512-o96x3OPo8GjWeSLF+wOAbrPfhFOGY0W00GNaxCDv+9hkcDJEnev1yh8S7pgHF0ik6zc8sQLuL8hjHjJULZp8bw=="
|
|
||||||
},
|
|
||||||
"yocto-queue": {
|
"yocto-queue": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||||
|
|||||||
12
package.json
12
package.json
@@ -8,10 +8,18 @@
|
|||||||
"@sap/cds": ">=5.5.3"
|
"@sap/cds": ">=5.5.3"
|
||||||
},
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"./*/"
|
"./bookshop",
|
||||||
|
"./bookstore",
|
||||||
|
"./common",
|
||||||
|
"./data-viewer",
|
||||||
|
"./fiori",
|
||||||
|
"./hello",
|
||||||
|
"./media",
|
||||||
|
"./orders",
|
||||||
|
"./reviews"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"axios": "^0",
|
"axios": "^1",
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"chai-subset": "^1.6.0",
|
"chai-subset": "^1.6.0",
|
||||||
|
|||||||
@@ -411,18 +411,67 @@ describe('cds.ql → cqn', () => {
|
|||||||
]
|
]
|
||||||
}})
|
}})
|
||||||
|
|
||||||
expect (
|
const ql_with_groups_fix = !!cds.ql.Query.prototype.flat
|
||||||
SELECT.from(Foo).where({x:1,or:{y:2}})
|
if (ql_with_groups_fix) {
|
||||||
).to.eql (
|
|
||||||
CQL`SELECT from Foo where x=1 or y=2`
|
expect (
|
||||||
).to.eql ({ SELECT: {
|
SELECT.from(Foo).where({x:1}).or({y:2}).and({z:3})
|
||||||
from: {ref:['Foo']},
|
).to.eql ({ SELECT: {
|
||||||
where: [
|
from: {ref:['Foo']},
|
||||||
{ref:['x']}, '=', {val:1},
|
where: [
|
||||||
'or',
|
{ref:['x']}, '=', {val:1},
|
||||||
{ref:['y']}, '=', {val:2}
|
'or',
|
||||||
]
|
{ref:['y']}, '=', {val:2},
|
||||||
}})
|
'and',
|
||||||
|
{ref:['z']}, '=', {val:3},
|
||||||
|
]
|
||||||
|
}})
|
||||||
|
|
||||||
|
expect (
|
||||||
|
SELECT.from(Foo).where({x:1,or:{y:2}}).and({z:3})
|
||||||
|
).to.eql ({ SELECT: {
|
||||||
|
from: {ref:['Foo']},
|
||||||
|
where: [
|
||||||
|
{xpr:[
|
||||||
|
{ref:['x']}, '=', {val:1},
|
||||||
|
'or',
|
||||||
|
{ref:['y']}, '=', {val:2},
|
||||||
|
]},
|
||||||
|
'and',
|
||||||
|
{ref:['z']}, '=', {val:3},
|
||||||
|
]
|
||||||
|
}})
|
||||||
|
|
||||||
|
expect (
|
||||||
|
SELECT.from(Foo).where({a:1}).or({x:1,or:{y:2}}).and({z:3})
|
||||||
|
).to.eql ({ SELECT: {
|
||||||
|
from: {ref:['Foo']},
|
||||||
|
where: [
|
||||||
|
{ref:['a']}, '=', {val:1},
|
||||||
|
'or',
|
||||||
|
{xpr:[
|
||||||
|
{ref:['x']}, '=', {val:1},
|
||||||
|
'or',
|
||||||
|
{ref:['y']}, '=', {val:2},
|
||||||
|
]},
|
||||||
|
'and',
|
||||||
|
{ref:['z']}, '=', {val:3},
|
||||||
|
]
|
||||||
|
}})
|
||||||
|
|
||||||
|
expect (
|
||||||
|
{ SELECT: SELECT.from(Foo).where({x:1,or:{y:2}}).SELECT }
|
||||||
|
).to.eql ({ SELECT: {
|
||||||
|
from: {ref:['Foo']},
|
||||||
|
where: [
|
||||||
|
{ref:['x']}, '=', {val:1},
|
||||||
|
'or',
|
||||||
|
{ref:['y']}, '=', {val:2},
|
||||||
|
]
|
||||||
|
}})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
expect (
|
expect (
|
||||||
SELECT.from(Foo).where({x:1,and:{y:2}}).or({z:3})
|
SELECT.from(Foo).where({x:1,and:{y:2}}).or({z:3})
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ describe('cap/samples - Bookshop APIs', () => {
|
|||||||
"ID": 16,
|
"ID": 16,
|
||||||
"parent_ID": 10
|
"parent_ID": 10
|
||||||
}
|
}
|
||||||
const Fantasy = {
|
const Romance = {
|
||||||
"name": "Fantasy",
|
"name": "Romance",
|
||||||
"descr": null,
|
"descr": null,
|
||||||
"ID": 13,
|
"ID": 15,
|
||||||
"parent_ID": 10
|
"parent_ID": 10
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ describe('cap/samples - Bookshop APIs', () => {
|
|||||||
}}`
|
}}`
|
||||||
expect(data.value).to.eql([
|
expect(data.value).to.eql([
|
||||||
{ ID: 251, title: 'The Raven', author: 'Edgar Allen Poe', genre:Mystery, currency:USD },
|
{ ID: 251, title: 'The Raven', author: 'Edgar Allen Poe', genre:Mystery, currency:USD },
|
||||||
{ ID: 252, title: 'Eleonora', author: 'Edgar Allen Poe', genre:Mystery, currency:USD },
|
{ ID: 252, title: 'Eleonora', author: 'Edgar Allen Poe', genre:Romance, currency:USD },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ describe('cap/samples - Local NPM registry', () => {
|
|||||||
const env = Object.assign(process.env, {PORT:'0'})
|
const env = Object.assign(process.env, {PORT:'0'})
|
||||||
const res = await exec (resolve(cwd, '.registry/server.js'), {cwd, stdio: 'pipe', env})
|
const res = await exec (resolve(cwd, '.registry/server.js'), {cwd, stdio: 'pipe', env})
|
||||||
registry = res.cp
|
registry = res.cp
|
||||||
axios = require('axios').default.create ({ baseURL: res.url, validateStatus: (status)=>status<500 })
|
axios = require('axios').create ({ baseURL: res.url, validateStatus: (status)=>status<500 })
|
||||||
})
|
})
|
||||||
|
|
||||||
after(() => { registry.kill() })
|
after(() => { registry.kill() })
|
||||||
|
|||||||
Reference in New Issue
Block a user