Skip to content

Commit e45493b

Browse files
committed
feat: refactor model schema namespace uptade
1 parent 15a0485 commit e45493b

14 files changed

+131
-58
lines changed

.vsls.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "http://json.schemastore.org/vsls",
3+
"gitignore":"none",
4+
"excludeFiles":[
5+
"*.p12",
6+
"*.cer",
7+
"token"
8+
],
9+
"hideFiles": [
10+
"bin",
11+
"obj"
12+
]
13+
}
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
title=Title
2-
appTitle=S1
3-
appDescription=App Description
1+
title=Orders
2+
appTitle=Orders
3+
appDescription=Sample UI5 app for auditlog service

app/orders/webapp/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>orders</title>
77
<script
88
id="sap-ui-bootstrap"
9-
src="resources/sap-ui-core.js"
9+
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
1010
data-sap-ui-theme="sap_fiori_3_dark"
1111
data-sap-ui-resourceroots='{"orders": "./"}'
1212
data-sap-ui-compatVersion="edge"

app/orders/webapp/manifest.json

+9-5
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,32 @@
3535
"deviceTypes": {
3636
"desktop": true,
3737
"tablet": true,
38-
"phone": true
38+
"phone": false
3939
}
4040
},
4141

4242
"sap.ui5": {
4343
"flexEnabled": false,
4444
"rootView": {
45-
"viewName": "orders.view.S1",
45+
"viewName": "orders.view.App",
4646
"type": "XML",
47-
"async": true,
48-
"id": "S1"
47+
"async": false,
48+
"id": "app"
4949
},
5050
"dependencies": {
5151
"minUI5Version": "1.66.0",
5252
"libs": {
5353
"sap.ui.core": {},
5454
"sap.m": {},
55+
"sap.f": {},
5556
"sap.ui.layout": {}
5657
}
5758
},
59+
"config": {
60+
"fullWidth": true
61+
},
5862
"contentDensities": {
59-
"compact": true,
63+
"compact": false,
6064
"cozy": true
6165
},
6266
"models": {

app/orders/webapp/view/App.view.xml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<mvc:View
2+
displayBlock="true"
3+
height="100%"
4+
xmlns="sap.f"
5+
xmlns:mvc="sap.ui.core.mvc">
6+
<FlexibleColumnLayout id="flexibleColumnLayout" backgroundDesign="Solid">
7+
<beginColumnPages>
8+
<mvc:XMLView id="beginView" viewName="orders.view.S1"/>
9+
</beginColumnPages>
10+
</FlexibleColumnLayout>
11+
</mvc:View>

app/orders/webapp/view/S1.view.xml

+68-10
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,72 @@
33
xmlns:mvc="sap.ui.core.mvc"
44
displayBlock="true"
55
xmlns="sap.m"
6-
>
7-
<Shell id="shell">
8-
<App id="app">
9-
<pages>
10-
<Page id="page" title="{i18n>title}">
11-
<content />
12-
</Page>
13-
</pages>
14-
</App>
15-
</Shell>
6+
xmlns:f="sap.f">
7+
8+
<f:DynamicPage id="idDynamicPage">
9+
<f:content>
10+
<VBox fitContainer="true">
11+
<Table id="idOrdersTable"
12+
inset="false"
13+
items="{
14+
path: '/Orders',
15+
sorter: {
16+
path: 'internalID'
17+
}
18+
}">
19+
<headerToolbar>
20+
<OverflowToolbar>
21+
<content>
22+
<Title text="Orders" level="H2"/>
23+
<ToolbarSpacer />
24+
<ToggleButton id="toggleInfoToolbar"
25+
text="Hide/Show"
26+
press="onToggleInfoToolbar" />
27+
</content>
28+
</OverflowToolbar>
29+
</headerToolbar>
30+
<infoToolbar>
31+
<OverflowToolbar>
32+
<Label text="Audit log can present here"/>
33+
</OverflowToolbar>
34+
</infoToolbar>
35+
<columns>
36+
<Column>
37+
<Text text="Order ID" />
38+
</Column>
39+
<Column>
40+
<Text text="Owner" />
41+
</Column>
42+
<Column>
43+
<Text text="Ship to" />
44+
</Column>
45+
<Column>
46+
<Text text="Created by" />
47+
</Column>
48+
<Column>
49+
<Text text="Created at" />
50+
</Column>
51+
</columns>
52+
<items>
53+
<ColumnListItem>
54+
<cells>
55+
<Text
56+
text="{internalID}" />
57+
<ObjectIdentifier
58+
title="{companyName}"
59+
text="{businessPartner_ID}"/>
60+
<Text
61+
text="{shipCountry}"/>
62+
<Text
63+
text="{createdBy}"/>
64+
<Text
65+
text="{createdAt}"/>
66+
67+
</cells>
68+
</ColumnListItem>
69+
</items>
70+
</Table>
71+
</VBox>
72+
</f:content>
73+
</f:DynamicPage>
1674
</mvc:View>

db/data/cap.auditlog.germancourse-Pronouns.csv

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ID;internalID;companyName;orderDate;shipCountry;businessPartner_ID;createdBy;createdAt
2+
33081da9-55a3-412a-a178-9ff0aaca1fd1;100010001;ACME INC;2020-10-10;Turkey;JOHN;admin;2020-10-05
3+
4cdf5e22-0e11-4c43-beba-70249b6d320b;200010001;SAP SE;2020-10-11;Germany;JOHN;murat;2020-10-06

db/data/db-BusinessPartner.csv

-2
This file was deleted.

db/data/db-Items.csv

-4
This file was deleted.

db/data/db-Orders.csv

-2
This file was deleted.

db/data/sap.common.Currencies.csv

-3
This file was deleted.

db/model.cds

+16-22
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
1-
namespace db;
1+
namespace cap.auditlog.germancourse;
22

33
using {
44
cuid,
55
managed,
66
temporal,
7-
Currency
7+
sap,
8+
Country
89
} from '@sap/cds/common';
910

11+
type Pronoun : Association to Pronouns;
1012

11-
entity Orders : cuid, managed {
12-
companyName : String(40);
13-
orderDate : Date;
14-
shipCountry : String;
15-
businessPartner : Association to one BusinessPartner;
16-
items : Composition of many Items
17-
on items.order = $self;
13+
@Core.Description : 'Preferred gender pronoun list'
14+
define entity Pronouns : sap.common.CodeList {
15+
key code : String(2) @(title : 'Pronoun Code');
1816
}
1917

20-
entity Items {
21-
key ID : String(40);
22-
name : String;
23-
price : Decimal;
24-
currency : Currency;
25-
quantity : Integer;
26-
order : Association to Orders;
18+
@Core.Description : 'Student list includes sensitive/personal data'
19+
define entity Students : cuid, managed, temporal {
20+
pronoun : Pronoun;
21+
name : String;
22+
lastname : String;
23+
birthdate : Date;
24+
nationality : Country;
25+
phonenumber : String;
26+
email : String;
2727
}
2828

29-
entity BusinessPartner : managed {
30-
key ID : String(10);
31-
name : String;
32-
surname : String;
33-
34-
}

srv/service.cds

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
using { db } from '../db/model';
1+
using { cap.auditlog.germancourse as db } from '../db/model';
22

3-
service browse {
4-
5-
entity Orders as projection on db.Orders;
6-
entity BusinessPartner as projection on db.BusinessPartner;
3+
service admin @(_requires:'authenticated-user'){
4+
entity Students as projection on db.Students;
5+
}
76

8-
}
7+
service browse {
8+
@readonly entity Students as projection on db.Students excluding { createdBy, modifiedBy };
9+
}

0 commit comments

Comments
 (0)