forked from SAP-samples/cloud-cap-samples-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin-service.cds
42 lines (34 loc) · 1.14 KB
/
admin-service.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
using {sap.common.Languages as CommonLanguages} from '@sap/cds/common';
using {my.bookshop as my} from '../db/index';
@path : 'admin'
service AdminService @(requires : 'admin') {
entity Books as projection on my.Books actions {
action addToOrder(order_ID : UUID, quantity : Integer) returns Orders;
}
entity Authors as projection on my.Authors;
entity Orders as select from my.Orders;
@cds.persistence.skip
entity Upload @odata.singleton {
csv : LargeBinary @Core.MediaType : 'text/csv';
}
}
// Deep Search Items
annotate AdminService.Orders with @cds.search : {
OrderNo,
Items
};
annotate AdminService.OrderItems with @cds.search : {book};
annotate AdminService.Books with @cds.search : {
descr,
title
};
// Enable Fiori Draft for Orders
annotate AdminService.Orders with @odata.draft.enabled;
annotate AdminService.Books with @odata.draft.enabled;
// workaround to enable the value help for languages
// Necessary because auto exposure is currently not working
// for if Languages is only referenced by the generated
// _texts table
extend service AdminService with {
entity Languages as projection on CommonLanguages;
}