@sap/cds-dk 9.2.0 → 9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/bin/bind.js +7 -8
- package/bin/up.js +13 -9
- package/lib/bind/cf.js +4 -0
- package/lib/bind/k8s.js +21 -0
- package/lib/bind/plugin.js +9 -0
- package/lib/bind/shared.js +4 -2
- package/lib/build/buildTaskProviderFactory.js +8 -14
- package/lib/build/constants.js +1 -0
- package/lib/build/index.js +17 -2
- package/lib/build/plugin.js +5 -7
- package/lib/build/provider/hana/index.js +4 -4
- package/lib/compile/to-xsuaa.js +11 -2
- package/lib/deploy/to-hana/hana.js +1 -1
- package/lib/deploy/to-hana/hdiDeployUtil.js +1 -1
- package/lib/env/schemas/cds-rc.js +2 -2
- package/lib/init/constants.js +3 -2
- package/lib/init/projectReader.js +5 -5
- package/lib/init/template/ams/index.js +1 -2
- package/lib/init/template/approuter/files/containerize.yaml.hbs +1 -1
- package/lib/init/template/approuter/index.js +1 -1
- package/lib/init/template/attachments/index.js +1 -1
- package/lib/init/template/audit-logging/index.js +1 -1
- package/lib/init/template/extension/files/.base/index.cds +6 -6
- package/lib/init/template/extension/index.js +5 -5
- package/lib/init/template/github-actions/files/{cf-github-deploy → github-deployment}/action.yaml +7 -5
- package/lib/init/template/github-actions/files/kyma-info/action.yaml +1 -1
- package/lib/init/template/github-actions/files/workflows/cf.yaml.hbs +14 -7
- package/lib/init/template/github-actions/files/workflows/kyma.yaml.hbs +6 -3
- package/lib/init/template/github-actions/files/workflows/test.yaml.hbs +5 -2
- package/lib/init/template/github-actions/index.js +8 -13
- package/lib/init/template/hana/index.js +2 -1
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +5 -1
- package/lib/init/template/html5-repo/files/package.json.hbs +1 -1
- package/lib/init/template/html5-repo/index.js +24 -19
- package/lib/init/template/ias/files/mta.yaml.hbs +4 -3
- package/lib/init/template/ias/files/values.yaml.hbs +41 -40
- package/lib/init/template/lint/index.js +6 -11
- package/lib/init/template/mta/files/package.json +1 -1
- package/lib/init/template/nodejs/files/.vscode/extensions.json +0 -1
- package/lib/init/template/nodejs/files/.vscode/settings.json +2 -2
- package/lib/init/template/nodejs/files/package.json.hbs +3 -9
- package/lib/init/template/notifications/index.js +1 -1
- package/lib/init/template/portal/files/mta.yaml.hbs +5 -1
- package/lib/init/template/portal/index.js +0 -1
- package/lib/init/template/postgres/index.js +1 -1
- package/lib/init/template/sample/files/app/_i18n/i18n.properties +15 -0
- package/lib/init/template/sample/files/app/_i18n/i18n_de.properties +15 -0
- package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +14 -15
- package/lib/init/template/sample/files/app/browse/fiori-service.cds +44 -44
- package/lib/init/template/sample/files/app/common.cds +99 -84
- package/lib/init/template/sample/files/db/schema.cds +22 -17
- package/lib/init/template/sample/files/package.json.hbs +1 -3
- package/lib/init/template/sample/files/srv/admin-service.cds +4 -3
- package/lib/init/template/sample/files/srv/cat-service.cds +28 -11
- package/lib/init/template/tiny-sample/files/nodejs/db/schema.cds +3 -3
- package/lib/init/template/typescript/files/package.json +1 -1
- package/lib/init/template/ui5/index.js +22 -0
- package/lib/init/template/workzone-standard/index.js +1 -1
- package/lib/lint/eslintHelp.json +5 -3
- package/lib/util/cf.js +7 -7
- package/npm-shrinkwrap.json +17 -17
- package/package.json +1 -1
- package/lib/init/template/sample/files/javascript/admin-service.js.hbs +0 -24
- package/lib/init/template/sample/files/javascript/cat-service.js.hbs +0 -43
- package/lib/init/template/sample/files/typescript/admin-service.ts.hbs +0 -16
- package/lib/init/template/sample/files/typescript/cat-service.ts.hbs +0 -38
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
using {
|
|
2
|
-
using { sap.capire.bookshop } from '../../db/schema';
|
|
1
|
+
using {AdminService} from '../../srv/admin-service.cds';
|
|
3
2
|
|
|
4
3
|
////////////////////////////////////////////////////////////////////////////
|
|
5
4
|
//
|
|
@@ -7,13 +6,13 @@ using { sap.capire.bookshop } from '../../db/schema';
|
|
|
7
6
|
//
|
|
8
7
|
|
|
9
8
|
annotate AdminService.Books with @(UI: {
|
|
10
|
-
HeaderInfo
|
|
9
|
+
HeaderInfo : {
|
|
11
10
|
TypeName : '{i18n>Book}',
|
|
12
11
|
TypeNamePlural: '{i18n>Books}',
|
|
13
12
|
Title : {Value: title},
|
|
14
13
|
Description : {Value: author.name}
|
|
15
14
|
},
|
|
16
|
-
Facets: [
|
|
15
|
+
Facets : [
|
|
17
16
|
{
|
|
18
17
|
$Type : 'UI.ReferenceFacet',
|
|
19
18
|
Label : '{i18n>General}',
|
|
@@ -49,7 +48,7 @@ annotate AdminService.Books with @(UI: {
|
|
|
49
48
|
Label: '{i18n>Currency}'
|
|
50
49
|
},
|
|
51
50
|
]},
|
|
52
|
-
FieldGroup #Admin: {Data: [
|
|
51
|
+
FieldGroup #Admin : {Data: [
|
|
53
52
|
{Value: createdBy},
|
|
54
53
|
{Value: createdAt},
|
|
55
54
|
{Value: modifiedBy},
|
|
@@ -67,23 +66,23 @@ annotate sap.capire.bookshop.Books with @fiori.draft.enabled;
|
|
|
67
66
|
annotate AdminService.Books with @odata.draft.enabled;
|
|
68
67
|
|
|
69
68
|
annotate AdminService.Books.texts with @(UI: {
|
|
70
|
-
Identification: [{Value: title}],
|
|
69
|
+
Identification : [{Value: title}],
|
|
71
70
|
SelectionFields: [
|
|
72
71
|
locale,
|
|
73
72
|
title
|
|
74
73
|
],
|
|
75
|
-
LineItem: [
|
|
74
|
+
LineItem : [
|
|
76
75
|
{
|
|
77
76
|
Value: locale,
|
|
78
|
-
Label: 'Locale'
|
|
77
|
+
Label: '{i18n>Locale}'
|
|
79
78
|
},
|
|
80
79
|
{
|
|
81
80
|
Value: title,
|
|
82
|
-
Label: 'Title'
|
|
81
|
+
Label: '{i18n>Title}'
|
|
83
82
|
},
|
|
84
83
|
{
|
|
85
84
|
Value: descr,
|
|
86
|
-
Label: 'Description'
|
|
85
|
+
Label: '{i18n>Description}'
|
|
87
86
|
},
|
|
88
87
|
]
|
|
89
88
|
});
|
|
@@ -105,13 +104,13 @@ annotate AdminService.Books.texts {
|
|
|
105
104
|
using {sap} from '@sap/cds/common';
|
|
106
105
|
|
|
107
106
|
extend service AdminService {
|
|
108
|
-
@readonly
|
|
107
|
+
@readonly
|
|
108
|
+
entity Languages as projection on sap.common.Languages;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
// Workaround for Fiori
|
|
112
|
-
annotate AdminService.
|
|
113
|
-
|
|
114
|
-
}
|
|
111
|
+
// Workaround for Fiori popups for asking user to enter a valid UUID on Create
|
|
112
|
+
annotate AdminService.Authors : ID with @Core.Computed @odata.Type: 'Edm.String';
|
|
113
|
+
annotate AdminService.Books : ID with @Core.Computed @odata.Type: 'Edm.String';
|
|
115
114
|
|
|
116
115
|
// Show Genre as drop down, not a dialog
|
|
117
116
|
annotate AdminService.Books with {
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
using {
|
|
1
|
+
using {CatalogService} from '../../srv/cat-service.cds';
|
|
2
2
|
|
|
3
3
|
////////////////////////////////////////////////////////////////////////////
|
|
4
4
|
//
|
|
5
5
|
// Books Object Page
|
|
6
6
|
//
|
|
7
|
-
annotate CatalogService.Books with @(UI
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
annotate CatalogService.Books with @(UI: {
|
|
8
|
+
HeaderInfo : {
|
|
9
|
+
TypeName : '{i18n>Book}',
|
|
10
|
+
TypeNamePlural: '{i18n>Books}',
|
|
11
|
+
Title : {Value: title},
|
|
12
|
+
Description : {Value: author}
|
|
13
|
+
},
|
|
14
|
+
HeaderFacets : [{
|
|
15
|
+
$Type : 'UI.ReferenceFacet',
|
|
16
|
+
Label : '{i18n>Description}',
|
|
17
|
+
Target: '@UI.FieldGroup#Descr'
|
|
18
|
+
}, ],
|
|
19
|
+
Facets : [{
|
|
20
|
+
$Type : 'UI.ReferenceFacet',
|
|
21
|
+
Label : '{i18n>Details}',
|
|
22
|
+
Target: '@UI.FieldGroup#Price'
|
|
23
|
+
}, ],
|
|
24
|
+
FieldGroup #Descr: {Data: [{Value: descr}, ]},
|
|
25
|
+
FieldGroup #Price: {Data: [
|
|
26
|
+
{Value: price},
|
|
27
|
+
{
|
|
28
|
+
Value: currency.symbol,
|
|
29
|
+
Label: '{i18n>Currency}'
|
|
13
30
|
},
|
|
14
|
-
|
|
15
|
-
$Type : 'UI.ReferenceFacet',
|
|
16
|
-
Label : '{i18n>Description}',
|
|
17
|
-
Target: '@UI.FieldGroup#Descr'
|
|
18
|
-
}, ],
|
|
19
|
-
Facets: [{
|
|
20
|
-
$Type : 'UI.ReferenceFacet',
|
|
21
|
-
Label : '{i18n>Details}',
|
|
22
|
-
Target: '@UI.FieldGroup#Price'
|
|
23
|
-
}, ],
|
|
24
|
-
FieldGroup #Descr: {Data : [{Value : descr}, ]},
|
|
25
|
-
FieldGroup #Price: {Data : [
|
|
26
|
-
{Value: price},
|
|
27
|
-
{
|
|
28
|
-
Value: currency.symbol,
|
|
29
|
-
Label: '{i18n>Currency}'
|
|
30
|
-
},
|
|
31
|
-
]},
|
|
31
|
+
]},
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
////////////////////////////////////////////////////////////////////////////
|
|
35
35
|
//
|
|
36
36
|
// Books List Page
|
|
37
37
|
//
|
|
38
|
-
annotate CatalogService.Books with @(UI
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
annotate CatalogService.Books with @(UI: {
|
|
39
|
+
SelectionFields: [
|
|
40
|
+
ID,
|
|
41
|
+
price,
|
|
42
|
+
currency_code
|
|
43
|
+
],
|
|
44
|
+
LineItem : [
|
|
45
|
+
{
|
|
46
|
+
Value: ID,
|
|
47
|
+
Label: '{i18n>Title}'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
Value: author,
|
|
51
|
+
Label: '{i18n>Author}'
|
|
52
|
+
},
|
|
53
|
+
{Value: genre.name},
|
|
54
|
+
{Value: price},
|
|
55
|
+
{Value: currency.symbol},
|
|
56
|
+
]
|
|
57
57
|
});
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
Common Annotations shared by all apps
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
using {
|
|
6
|
-
using {
|
|
5
|
+
using {sap.capire.bookshop as my} from '../db/schema';
|
|
6
|
+
using {
|
|
7
|
+
sap.common,
|
|
8
|
+
sap.common.Currencies
|
|
9
|
+
} from '@sap/cds/common';
|
|
7
10
|
|
|
8
11
|
////////////////////////////////////////////////////////////////////////////
|
|
9
12
|
//
|
|
@@ -11,27 +14,33 @@ using { sap.common, sap.common.Currencies } from '@sap/cds/common';
|
|
|
11
14
|
//
|
|
12
15
|
annotate my.Books with @(
|
|
13
16
|
Common.SemanticKey: [ID],
|
|
14
|
-
UI: {
|
|
15
|
-
Identification: [{
|
|
17
|
+
UI : {
|
|
18
|
+
Identification : [{Value: title}],
|
|
16
19
|
SelectionFields: [
|
|
17
20
|
ID,
|
|
18
21
|
author_ID,
|
|
19
22
|
price,
|
|
20
23
|
currency_code
|
|
21
24
|
],
|
|
22
|
-
LineItem: [
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
|
|
25
|
+
LineItem : [
|
|
26
|
+
{
|
|
27
|
+
Value: ID,
|
|
28
|
+
Label: '{i18n>Title}'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
Value: author.ID,
|
|
32
|
+
Label: '{i18n>Author}'
|
|
33
|
+
},
|
|
34
|
+
{Value: genre.name},
|
|
35
|
+
{Value: stock},
|
|
36
|
+
{Value: price},
|
|
37
|
+
{Value: currency.symbol},
|
|
29
38
|
]
|
|
30
39
|
}
|
|
31
40
|
) {
|
|
32
|
-
ID
|
|
33
|
-
SemanticObject: 'Books',
|
|
34
|
-
Text: title,
|
|
41
|
+
ID @Common : {
|
|
42
|
+
SemanticObject : 'Books',
|
|
43
|
+
Text : title,
|
|
35
44
|
TextArrangement: #TextOnly
|
|
36
45
|
};
|
|
37
46
|
author @ValueList.entity: 'Authors';
|
|
@@ -47,14 +56,19 @@ annotate Currencies with {
|
|
|
47
56
|
// Books Elements
|
|
48
57
|
//
|
|
49
58
|
annotate my.Books with {
|
|
50
|
-
ID
|
|
51
|
-
title
|
|
52
|
-
genre
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
ID @title: '{i18n>ID}';
|
|
60
|
+
title @title: '{i18n>Title}';
|
|
61
|
+
genre @title: '{i18n>Genre}' @Common : {
|
|
62
|
+
Text : genre.name,
|
|
63
|
+
TextArrangement: #TextOnly
|
|
64
|
+
};
|
|
65
|
+
author @title: '{i18n>Author}' @Common : {
|
|
66
|
+
Text : author.name,
|
|
67
|
+
TextArrangement: #TextOnly
|
|
68
|
+
};
|
|
69
|
+
price @title: '{i18n>Price}' @Measures.ISOCurrency: currency_code;
|
|
70
|
+
stock @title: '{i18n>Stock}';
|
|
71
|
+
descr @title: '{i18n>Description}' @UI.MultiLineText;
|
|
58
72
|
}
|
|
59
73
|
|
|
60
74
|
////////////////////////////////////////////////////////////////////////////
|
|
@@ -63,35 +77,35 @@ annotate my.Books with {
|
|
|
63
77
|
//
|
|
64
78
|
annotate my.Genres with @(
|
|
65
79
|
Common.SemanticKey: [name],
|
|
66
|
-
UI: {
|
|
80
|
+
UI : {
|
|
67
81
|
SelectionFields: [name],
|
|
68
|
-
LineItem: [
|
|
69
|
-
{
|
|
82
|
+
LineItem : [
|
|
83
|
+
{Value: name},
|
|
70
84
|
{
|
|
71
85
|
Value: parent.name,
|
|
72
|
-
Label: '
|
|
86
|
+
Label: '{i18n>MainGenre}'
|
|
73
87
|
},
|
|
74
88
|
],
|
|
75
89
|
}
|
|
76
90
|
);
|
|
77
91
|
|
|
78
92
|
annotate my.Genres with {
|
|
79
|
-
ID @Common.Text
|
|
93
|
+
ID @Common.Text: name @Common.TextArrangement: #TextOnly;
|
|
80
94
|
}
|
|
81
95
|
|
|
82
96
|
////////////////////////////////////////////////////////////////////////////
|
|
83
97
|
//
|
|
84
98
|
// Genre Details
|
|
85
99
|
//
|
|
86
|
-
annotate my.Genres with @(UI
|
|
87
|
-
Identification: [{
|
|
88
|
-
HeaderInfo: {
|
|
100
|
+
annotate my.Genres with @(UI: {
|
|
101
|
+
Identification: [{Value: name}],
|
|
102
|
+
HeaderInfo : {
|
|
89
103
|
TypeName : '{i18n>Genre}',
|
|
90
104
|
TypeNamePlural: '{i18n>Genres}',
|
|
91
|
-
Title : {
|
|
92
|
-
Description : {
|
|
105
|
+
Title : {Value: name},
|
|
106
|
+
Description : {Value: ID}
|
|
93
107
|
},
|
|
94
|
-
Facets: [{
|
|
108
|
+
Facets : [{
|
|
95
109
|
$Type : 'UI.ReferenceFacet',
|
|
96
110
|
Label : '{i18n>SubGenres}',
|
|
97
111
|
Target: 'children/@UI.LineItem'
|
|
@@ -113,21 +127,21 @@ annotate my.Genres with {
|
|
|
113
127
|
//
|
|
114
128
|
annotate my.Authors with @(
|
|
115
129
|
Common.SemanticKey: [ID],
|
|
116
|
-
UI: {
|
|
117
|
-
Identification : [{
|
|
118
|
-
SelectionFields: [
|
|
130
|
+
UI : {
|
|
131
|
+
Identification : [{Value: name}],
|
|
132
|
+
SelectionFields: [name],
|
|
119
133
|
LineItem : [
|
|
120
|
-
{
|
|
121
|
-
{
|
|
122
|
-
{
|
|
123
|
-
{
|
|
124
|
-
{
|
|
134
|
+
{Value: ID},
|
|
135
|
+
{Value: dateOfBirth},
|
|
136
|
+
{Value: dateOfDeath},
|
|
137
|
+
{Value: placeOfBirth},
|
|
138
|
+
{Value: placeOfDeath},
|
|
125
139
|
],
|
|
126
140
|
}
|
|
127
141
|
) {
|
|
128
142
|
ID @Common: {
|
|
129
|
-
SemanticObject: 'Authors',
|
|
130
|
-
Text: name,
|
|
143
|
+
SemanticObject : 'Authors',
|
|
144
|
+
Text : name,
|
|
131
145
|
TextArrangement: #TextOnly,
|
|
132
146
|
};
|
|
133
147
|
};
|
|
@@ -136,14 +150,14 @@ annotate my.Authors with @(
|
|
|
136
150
|
//
|
|
137
151
|
// Author Details
|
|
138
152
|
//
|
|
139
|
-
annotate my.Authors with @(UI
|
|
153
|
+
annotate my.Authors with @(UI: {
|
|
140
154
|
HeaderInfo: {
|
|
141
155
|
TypeName : '{i18n>Author}',
|
|
142
156
|
TypeNamePlural: '{i18n>Authors}',
|
|
143
|
-
Title : {
|
|
144
|
-
Description : {
|
|
157
|
+
Title : {Value: name},
|
|
158
|
+
Description : {Value: dateOfBirth}
|
|
145
159
|
},
|
|
146
|
-
Facets: [{
|
|
160
|
+
Facets : [{
|
|
147
161
|
$Type : 'UI.ReferenceFacet',
|
|
148
162
|
Target: 'books/@UI.LineItem'
|
|
149
163
|
}],
|
|
@@ -169,12 +183,15 @@ annotate my.Authors with {
|
|
|
169
183
|
//
|
|
170
184
|
annotate common.Languages with @(
|
|
171
185
|
Common.SemanticKey: [code],
|
|
172
|
-
Identification: [{
|
|
173
|
-
UI: {
|
|
174
|
-
SelectionFields: [
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
186
|
+
Identification : [{Value: code}],
|
|
187
|
+
UI : {
|
|
188
|
+
SelectionFields: [
|
|
189
|
+
name,
|
|
190
|
+
descr
|
|
191
|
+
],
|
|
192
|
+
LineItem : [
|
|
193
|
+
{Value: code},
|
|
194
|
+
{Value: name},
|
|
178
195
|
],
|
|
179
196
|
}
|
|
180
197
|
);
|
|
@@ -183,22 +200,22 @@ annotate common.Languages with @(
|
|
|
183
200
|
//
|
|
184
201
|
// Language Details
|
|
185
202
|
//
|
|
186
|
-
annotate common.Languages with @(UI
|
|
187
|
-
HeaderInfo: {
|
|
203
|
+
annotate common.Languages with @(UI: {
|
|
204
|
+
HeaderInfo : {
|
|
188
205
|
TypeName : '{i18n>Language}',
|
|
189
206
|
TypeNamePlural: '{i18n>Languages}',
|
|
190
|
-
Title : {
|
|
191
|
-
Description : {
|
|
207
|
+
Title : {Value: name},
|
|
208
|
+
Description : {Value: descr}
|
|
192
209
|
},
|
|
193
|
-
Facets: [{
|
|
210
|
+
Facets : [{
|
|
194
211
|
$Type : 'UI.ReferenceFacet',
|
|
195
212
|
Label : '{i18n>Details}',
|
|
196
213
|
Target: '@UI.FieldGroup#Details'
|
|
197
214
|
}, ],
|
|
198
|
-
FieldGroup #Details: {Data
|
|
199
|
-
{
|
|
200
|
-
{
|
|
201
|
-
{
|
|
215
|
+
FieldGroup #Details: {Data: [
|
|
216
|
+
{Value: code},
|
|
217
|
+
{Value: name},
|
|
218
|
+
{Value: descr}
|
|
202
219
|
]},
|
|
203
220
|
});
|
|
204
221
|
|
|
@@ -208,16 +225,16 @@ annotate common.Languages with @(UI : {
|
|
|
208
225
|
//
|
|
209
226
|
annotate common.Currencies with @(
|
|
210
227
|
Common.SemanticKey: [code],
|
|
211
|
-
Identification: [{
|
|
212
|
-
UI: {
|
|
228
|
+
Identification : [{Value: code}],
|
|
229
|
+
UI : {
|
|
213
230
|
SelectionFields: [
|
|
214
231
|
name,
|
|
215
232
|
descr
|
|
216
233
|
],
|
|
217
|
-
LineItem: [
|
|
218
|
-
{
|
|
219
|
-
{
|
|
220
|
-
{
|
|
234
|
+
LineItem : [
|
|
235
|
+
{Value: descr},
|
|
236
|
+
{Value: symbol},
|
|
237
|
+
{Value: code},
|
|
221
238
|
],
|
|
222
239
|
}
|
|
223
240
|
);
|
|
@@ -226,24 +243,22 @@ annotate common.Currencies with @(
|
|
|
226
243
|
//
|
|
227
244
|
// Currency Details
|
|
228
245
|
//
|
|
229
|
-
annotate common.Currencies with @(UI
|
|
230
|
-
HeaderInfo: {
|
|
246
|
+
annotate common.Currencies with @(UI: {
|
|
247
|
+
HeaderInfo : {
|
|
231
248
|
TypeName : '{i18n>Currency}',
|
|
232
249
|
TypeNamePlural: '{i18n>Currencies}',
|
|
233
|
-
Title : {
|
|
234
|
-
Description : {
|
|
250
|
+
Title : {Value: descr},
|
|
251
|
+
Description : {Value: code}
|
|
235
252
|
},
|
|
236
|
-
Facets: [
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
{
|
|
245
|
-
{
|
|
246
|
-
{ Value: code },
|
|
247
|
-
{ Value: descr }
|
|
253
|
+
Facets : [{
|
|
254
|
+
$Type : 'UI.ReferenceFacet',
|
|
255
|
+
Label : '{i18n>Details}',
|
|
256
|
+
Target: '@UI.FieldGroup#Details'
|
|
257
|
+
}],
|
|
258
|
+
FieldGroup #Details: {Data: [
|
|
259
|
+
{Value: name},
|
|
260
|
+
{Value: symbol},
|
|
261
|
+
{Value: code},
|
|
262
|
+
{Value: descr}
|
|
248
263
|
]}
|
|
249
264
|
});
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
using {
|
|
1
|
+
using {
|
|
2
|
+
Currency,
|
|
3
|
+
managed,
|
|
4
|
+
cuid,
|
|
5
|
+
sap
|
|
6
|
+
} from '@sap/cds/common';
|
|
7
|
+
|
|
2
8
|
namespace sap.capire.bookshop;
|
|
3
9
|
|
|
4
|
-
entity Books : managed {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
price : Decimal;
|
|
10
|
+
entity Books : managed, cuid {
|
|
11
|
+
title : localized String(111) @mandatory;
|
|
12
|
+
descr : localized String(1111);
|
|
13
|
+
author : Association to Authors @mandatory;
|
|
14
|
+
genre : Association to Genres;
|
|
15
|
+
stock : Integer;
|
|
16
|
+
price : Decimal;
|
|
12
17
|
currency : Currency;
|
|
13
|
-
image : LargeBinary @Core.MediaType : 'image/png';
|
|
14
18
|
}
|
|
15
19
|
|
|
16
|
-
entity Authors : managed {
|
|
17
|
-
|
|
18
|
-
@mandatory name : String(111);
|
|
20
|
+
entity Authors : managed, cuid {
|
|
21
|
+
name : String(111) @mandatory;
|
|
19
22
|
dateOfBirth : Date;
|
|
20
23
|
dateOfDeath : Date;
|
|
21
24
|
placeOfBirth : String;
|
|
22
25
|
placeOfDeath : String;
|
|
23
|
-
books
|
|
26
|
+
books : Association to many Books
|
|
27
|
+
on books.author = $self;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
/** Hierarchically organized Code List for Genres */
|
|
27
31
|
entity Genres : sap.common.CodeList {
|
|
28
|
-
key ID
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
key ID : Integer;
|
|
33
|
+
parent : Association to Genres;
|
|
34
|
+
children : Composition of many Genres
|
|
35
|
+
on children.parent = $self;
|
|
31
36
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
using {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
using {sap.capire.bookshop as my} from '../db/schema';
|
|
2
|
+
|
|
3
|
+
service AdminService @(requires: 'admin') {
|
|
4
|
+
entity Books as projection on my.Books;
|
|
4
5
|
entity Authors as projection on my.Authors;
|
|
5
6
|
}
|
|
@@ -1,20 +1,37 @@
|
|
|
1
|
-
using {
|
|
1
|
+
using {sap.capire.bookshop as my} from '../db/schema';
|
|
2
|
+
|
|
2
3
|
service CatalogService {
|
|
3
4
|
|
|
4
5
|
/** For displaying lists of Books */
|
|
5
|
-
@readonly
|
|
6
|
-
|
|
6
|
+
@readonly
|
|
7
|
+
entity ListOfBooks as
|
|
8
|
+
projection on Books
|
|
9
|
+
excluding {
|
|
10
|
+
descr
|
|
11
|
+
};
|
|
7
12
|
|
|
8
13
|
/** For display in details pages */
|
|
9
|
-
@readonly
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
@readonly
|
|
15
|
+
entity Books as
|
|
16
|
+
projection on my.Books {
|
|
17
|
+
*,
|
|
18
|
+
author.name as author
|
|
19
|
+
}
|
|
20
|
+
excluding {
|
|
21
|
+
createdBy,
|
|
22
|
+
modifiedBy
|
|
23
|
+
};
|
|
12
24
|
|
|
13
25
|
@requires: 'authenticated-user'
|
|
14
|
-
action submitOrder
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
26
|
+
action submitOrder(book : Books : ID @mandatory,
|
|
27
|
+
quantity : Integer @mandatory
|
|
28
|
+
) returns {
|
|
29
|
+
stock : Integer
|
|
30
|
+
};
|
|
18
31
|
|
|
19
|
-
event OrderedBook : {
|
|
32
|
+
event OrderedBook : {
|
|
33
|
+
book : Books : ID;
|
|
34
|
+
quantity : Integer;
|
|
35
|
+
buyer : String
|
|
36
|
+
};
|
|
20
37
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const cds = require('../../../cds'), { exists, fs, path } = cds.utils
|
|
2
|
+
const { readProject } = require('../../projectReader')
|
|
3
|
+
const { merge } = require('../../merge')
|
|
4
|
+
|
|
5
|
+
module.exports = class extends require('../../plugin') {
|
|
6
|
+
|
|
7
|
+
static hasInProduction() {
|
|
8
|
+
const startPage = path.join(cds.root, cds.env.folders.app, 'index.html')
|
|
9
|
+
const packageJson = path.join(cds.root, 'package.json')
|
|
10
|
+
return exists(startPage) && fs.readFileSync(startPage).includes('https://sapui5') ||
|
|
11
|
+
exists(packageJson) && fs.readFileSync(packageJson).includes('"sapux":')
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static help() {
|
|
15
|
+
return 'SAP UI5 integration'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async run() {
|
|
19
|
+
const project = readProject()
|
|
20
|
+
await merge({ sapux: project.apps.map(({ app }) => project.appPath + app) }).into('package.json')
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -46,7 +46,7 @@ module.exports = class extends require('../../plugin') {
|
|
|
46
46
|
project.uiApp = p
|
|
47
47
|
const manifestPath = join(appPath, p, 'webapp/manifest.json')
|
|
48
48
|
const manifest = exists(manifestPath) ? await read(manifestPath) : {}
|
|
49
|
-
if (!manifest['sap.app']
|
|
49
|
+
if (!manifest['sap.app']?.crossNavigation?.inbounds) {
|
|
50
50
|
return merge(__dirname, 'files/manifest.json.hbs').into(join(appPath, p, 'webapp/manifest.json'), { project })
|
|
51
51
|
} else {
|
|
52
52
|
return merge({ 'sap.cloud': {
|