Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cds-feature-attachments/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cds:
data-source:
csv:
paths:
- "./src/main/resources/cds/**"
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@ annotate MediaData with @UI.MediaResource: {Stream: content} {
Core.IsMediaType
);
fileName @(title: '{i18n>attachment_fileName}');
status @(title: '{i18n>attachment_status}');
status @(title: '{i18n>attachment_status}', Common.Text : statusNav.name, Common.TextArrangement : #TextOnly);
contentId @(UI.Hidden: true);
scannedAt @(UI.Hidden: true);
}

annotate Attachments with @UI: {
HeaderInfo: {
$Type : 'UI.HeaderInfoType',
TypeName : '{i18n>attachment}',
TypeNamePlural: '{i18n>attachments}',
},
LineItem : [
{Value: content, @HTML5.CssDefaults: {width: '30%'}},
{Value: status, @HTML5.CssDefaults: {width: '10%'}},
{Value: status, Criticality: statusNav.criticality, @HTML5.CssDefaults: {width: '10%'}},
{Value: createdAt, @HTML5.CssDefaults: {width: '20%'}},
{Value: createdBy, @HTML5.CssDefaults: {width: '15%'}},
{Value: note, @HTML5.CssDefaults: {width: '25%'}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,34 @@ namespace sap.attachments;

using {
cuid,
managed
managed,
sap.common.CodeList
} from '@sap/cds/common';

type StatusCode : String enum {
type StatusCode : String(32) enum {
Unscanned;
Scanning;
Clean;
Infected;
Failed;
}

aspect MediaData @(_is_media_data) {
aspect MediaData @(_is_media_data) {
content : LargeBinary; // stored only for db-based services
mimeType : String;
fileName : String;
contentId : String @readonly; // id of attachment in external storage, if database storage is used, same as id
status : StatusCode @readonly;
status : StatusCode default 'Unscanned' @readonly;
statusNav : Association to one ScanStates on statusNav.code = status;
scannedAt : Timestamp @readonly;
}

entity ScanStates : CodeList {
key code : StatusCode @Common.Text: name @Common.TextArrangement: #TextOnly;
name : localized String(64);
criticality : Integer @UI.Hidden;
}

aspect Attachments : cuid, managed, MediaData {
note : String;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
code;name;descr;criticality
Unscanned;Unscanned;The file is not yet scanned for malware.;2
Scanning;Scanning;The file is currently being scanned for malware.;2
Infected;Infected;The file contains malware! Do not download!;1
Clean;Clean;The file does not contain any malware.;3
Failed;Failed;The file could not be scanned for malware.;1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
locale;code;name;descr
en;Unscanned;Unscanned;The file is not yet scanned for malware.
en;Scanning;Scanning;The file is currently being scanned for malware.
en;Infected;Infected;The file contains malware! Do not download!
en;Clean;Clean;The file does not contain any malware.
en;Failed;Failed;The file could not be scanned for malware.
11 changes: 11 additions & 0 deletions translation_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
]
}
]
},
{
"collectionName": "attachments_data",
"folders": [
{
"startingFolderPath": "cds-feature-attachments/src/main/resources/cds/data",
"targetFolderPath": "cds-feature-attachments/src/main/resources/cds/data",
"oneQFolderPath": "cds-feature-attachments/src/main/resources/cds/data",
"sourceFilters": ["**/*_texts.csv"]
}
]
}
],
"defaultConfiguration": {
Expand Down