Skip to content

Commit 9218d80

Browse files
committed
Two-level test entity
1 parent cb9d09d commit 9218d80

File tree

6 files changed

+76
-0
lines changed

6 files changed

+76
-0
lines changed

tests/incidents-app/app/incidents/annotations.cds

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,48 @@ annotate service.Incidents.conversation with @(
172172
Label : '{i18n>Message}',
173173
},]
174174
);
175+
176+
annotate service.Test with @(
177+
UI.SemanticKey : [name],
178+
UI.LineItem : [
179+
{
180+
Value : name,
181+
Label : 'Name',
182+
},
183+
]
184+
);
185+
186+
annotate service.TestDetails with @(
187+
UI.SemanticKey : [description],
188+
UI.LineItem : [
189+
{
190+
Value : description,
191+
Label : 'Description',
192+
},
193+
]
194+
);
195+
196+
annotate service.Test with @(
197+
UI.Facets : [
198+
{
199+
$Type : 'UI.ReferenceFacet',
200+
Label : 'Details',
201+
Target : 'details/@UI.LineItem'
202+
},
203+
{
204+
$Type : 'UI.ReferenceFacet',
205+
Label : 'Attachments',
206+
Target : 'attachments/@UI.LineItem'
207+
}
208+
]
209+
);
210+
211+
annotate service.TestDetails with @(
212+
UI.Facets : [
213+
{
214+
$Type : 'UI.ReferenceFacet',
215+
Label : 'Attachments',
216+
Target : 'attachments/@UI.LineItem'
217+
}
218+
]
219+
);

tests/incidents-app/db/attachments.cds

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,12 @@ extend my.Customers with {
2424

2525
extend my.SampleRootWithComposedEntity with {
2626
attachments: Composition of many Attachments;
27+
}
28+
29+
extend my.Test with {
30+
attachments: Composition of many Attachments;
31+
}
32+
33+
extend my.TestDetails with {
34+
attachments: Composition of many Attachments;
2735
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ID;name
2+
11111111-1111-1111-1111-111111111111;Test Parent 1
3+
22222222-2222-2222-2222-222222222222;Test Parent 2
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ID;test_ID;description
2+
aaaaaaa1-aaaa-aaaa-aaaa-aaaaaaaaaaa1;11111111-1111-1111-1111-111111111111;Detail 1 for Test 1
3+
aaaaaaa2-aaaa-aaaa-aaaa-aaaaaaaaaaa2;11111111-1111-1111-1111-111111111111;Detail 2 for Test 1
4+
bbbbbbb1-bbbb-bbbb-bbbb-bbbbbbbbbbb1;22222222-2222-2222-2222-222222222222;Detail 1 for Test 2

tests/incidents-app/db/schema.cds

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,15 @@ type PhoneNumber : String;
6969
entity SampleRootWithComposedEntity {
7070
key sampleID: String;
7171
key gjahr: Integer;
72+
}
73+
74+
entity Test : cuid, managed {
75+
key ID : String;
76+
name : String;
77+
details : Composition of many TestDetails on details.test = $self;
78+
}
79+
80+
entity TestDetails : cuid, managed {
81+
test : Association to Test;
82+
description : String;
7283
}

tests/incidents-app/srv/services.cds

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ service ProcessorService {
1111

1212
@odata.draft.enabled
1313
entity SampleRootWithComposedEntity as projection on my.SampleRootWithComposedEntity;
14+
15+
@odata.draft.enabled
16+
entity Test as projection on my.Test;
17+
18+
entity TestDetails as projection on my.TestDetails;
1419
}
1520

1621
/**

0 commit comments

Comments
 (0)