@@ -12,91 +12,60 @@ aspect aspect @(
12
12
Target : ' changes/@UI.PresentationVariant '
13
13
}]
14
14
) {
15
- changes : Association to many ChangeView on changes .entityKey = ID ;
15
+ changes : Association to many ChangeLog on changes .entityKey = ID ;
16
16
key ID : UUID ;
17
17
}
18
18
19
19
20
- entity Changes : managed {
21
-
22
- key ID : UUID @ UI . Hidden ;
20
+ type Changes : {
21
+ // TODO: Which of these is the Business meaningful object id?
22
+ entityKey : String @ title : ' {i18n>Changes.entityID} ' ;
23
23
keys : String @ title : ' {i18n>Changes.keys} ' ;
24
24
attribute : String @ title : ' {i18n>Changes.attribute} ' ;
25
25
valueChangedFrom : String @ title : ' {i18n>Changes.valueChangedFrom} ' ;
26
26
valueChangedTo : String @ title : ' {i18n>Changes.valueChangedTo} ' ;
27
-
28
- // Business meaningful object id
29
- entityID : String @ title : ' {i18n>Changes.entityID} ' ;
30
- entity : String @ title : ' {i18n>Changes.entity} ' ;
27
+ entityName : String @ title : ' {i18n>Changes.entity} ' ;
31
28
serviceEntity : String @ title : ' {i18n>Changes.serviceEntity} ' ;
32
29
33
- // Business meaningful parent object id
34
- parentEntityID : String @ title : ' {i18n>Changes.parentEntityID} ' ;
35
- parentKey : UUID @ title : ' {i18n>Changes.parentKey} ' ;
36
- serviceEntityPath : String @ title : ' {i18n>Changes.serviceEntityPath} ' ;
37
-
38
30
@ title : ' {i18n>Changes.modification} '
39
31
modification : String enum {
40
32
create = ' Create' ;
41
33
update = ' Edit' ;
42
34
delete = ' Delete' ;
43
35
};
44
-
45
- valueDataType : String @ title : ' {i18n>Changes.valueDataType} ' ;
46
- changeLog : Association to ChangeLog @ title : ' {i18n>ChangeLog.ID} ' ;
47
36
}
48
37
49
- // REVISIT: Get rid of that
38
+ //TODO: Move Business meaingful key to ChangeLog Table
39
+ @ cds . autoexpose
50
40
entity ChangeLog : managed , cuid {
51
41
entity : String @ title : ' {i18n>ChangeLog.entity} ' ;
52
42
entityKey : UUID @ title : ' {i18n>ChangeLog.entityKey} ' ;
53
43
serviceEntity : String @ title : ' {i18n>ChangeLog.serviceEntity} ' ;
54
- changes : Composition of many Changes on changes .changeLog = $self ;
44
+ @ cds . api . ignore
45
+ changes : many Changes ;
46
+ changeslist : Composition of many changeslist ;
55
47
}
56
48
57
- // REVISIT: Get rid of that
58
- view ChangeView as
59
- select from Changes {
60
- ID as ID @ UI . Hidden ,
61
- attribute as attribute ,
62
- entityID as objectID ,
63
- entity as entity ,
64
- serviceEntity as serviceEntity ,
65
- parentEntityID as parentObjectID ,
66
- parentKey as parentKey ,
67
- valueChangedFrom as valueChangedFrom ,
68
- valueChangedTo as valueChangedTo ,
69
- modification as modification ,
70
- createdBy as createdBy ,
71
- createdAt as createdAt ,
72
- changeLog .entityKey as entityKey ,
73
- serviceEntityPath as serviceEntityPath @ UI . Hidden ,
74
- };
75
-
49
+ @ cds . persistence . skip
50
+ entity changeslist : Changes {};
76
51
77
- annotate ChangeView with @ (UI : {
52
+ annotate ChangeLog with @ (UI : {
78
53
PresentationVariant : {
79
54
Visualizations : [' @UI.LineItem' ],
80
55
RequestAtLeast : [
81
- parentKey ,
82
- serviceEntity ,
83
- serviceEntityPath
56
+ entityKey ,
57
+ entity
84
58
],
85
59
SortOrder : [{
86
60
Property : createdAt ,
87
61
Descending : true
88
62
}],
89
63
},
90
64
LineItem : [
91
- { Value : objectID },
65
+ { Value : entityKey },
92
66
{ Value : entity },
93
- { Value : parentObjectID },
94
- { Value : attribute },
95
- { Value : valueChangedTo },
96
- { Value : valueChangedFrom },
97
67
{ Value : createdBy },
98
- { Value : createdAt },
99
- { Value : modification }
68
+ { Value : createdAt }
100
69
],
101
70
DeleteHidden : true ,
102
71
});
0 commit comments