-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.cds
46 lines (40 loc) · 1.3 KB
/
index.cds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using { managed, cuid } from '@sap/cds/common';
aspect MediaData @(_is_media_data) {
url : String;
content : LargeBinary @title: 'Attachment'; // only for db-based services
mimeType : String @title: 'Media Type' default 'application/octet-stream';
filename : String @title: 'Filename';
status : String @title: 'Scan Status' enum {
Unscanned;
Scanning;
Infected;
Clean;
Failed;
} default 'Unscanned';
}
aspect Attachments : managed, cuid, MediaData {
note : String @title: 'Note';
}
// -- Fiori Annotations ----------------------------------------------------------
annotate MediaData with @UI.MediaResource: { Stream: content } {
content @Core.MediaType: mimeType @odata.draft.skip;
mimeType @Core.IsMediaType;
status @readonly;
}
annotate Attachments with @UI:{
HeaderInfo: {
TypeName: '{i18n>Attachment}',
TypeNamePlural: '{i18n>Attachments}',
},
LineItem: [
{Value: content, @HTML5.CssDefaults: {width: '30%'}},
{Value: status, @HTML5.CssDefaults: {width: '10%'}},
{Value: createdAt, @HTML5.CssDefaults: {width: '20%'}},
{Value: createdBy, @HTML5.CssDefaults: {width: '15%'}},
{Value: note, @HTML5.CssDefaults: {width: '25%'}}
]
} {
content
@Core.ContentDisposition: { Filename: filename, Type: 'inline' }
@Core.Immutable
}