Skip to content

Commit e6e5d0e

Browse files
committed
test: πŸ›‚πŸ›‚ request.http file add
1 parent d2c5550 commit e6e5d0e

File tree

5 files changed

+50
-14
lines changed

5 files changed

+50
-14
lines changed

β€Ždb/model.cds

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,22 @@ using {
1010

1111
type Pronoun : Association to Pronouns;
1212

13-
@Core.Description : 'Preferred gender pronoun list'
13+
@description : 'Preferred gender pronoun list'
1414
define entity Pronouns : sap.common.CodeList {
1515
key code : String(2) @(title : 'Pronoun Code');
1616
}
1717

18-
@Core.Description : 'Student list includes sensitive/personal data'
18+
@description : 'Student list includes sensitive/personal data'
1919
define entity Students : cuid, managed {
2020
pronoun : Pronoun;
2121
internalID : Integer;
22-
name : String;
23-
lastname : String;
22+
name : String not null;
23+
lastname : String not null;
2424
birthdate : Date;
2525
nationality : Country;
2626
phonenumber : String;
27-
email : String;
27+
email : String
28+
@assert.format : '^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$'
29+
not null;
2830
}
2931

β€Žpackage-lock.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žpackage.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"dependencies": {
1717
"@sap/audit-logging": "^3.2.0",
1818
"@sap/cds": "^4",
19-
"@sap/cds-odata-v2-adapter-proxy": "^1.4.48",
19+
"@sap/cds-odata-v2-adapter-proxy": "^1.4.50",
2020
"@sap/xsenv": "^3.0.0",
21-
"@sap/xssec": "^3.0.10",
21+
"@sap/xssec": "^3",
2222
"express": "^4",
2323
"passport": "^0.4.1"
2424
},

β€Žsrv/service.cds

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using { cap.auditlog.germancourse as db } from '../db/model';
22

3-
service admin @(requires:'authenticated-user'){
3+
service admin @(_requires:'authenticated-user'){
44
entity Students as projection on db.Students;
55
}
66

β€Žtest/request.http

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@server = http://localhost:4004
2+
3+
### ------------------------------------------------------------------------
4+
# Get service info
5+
GET {{server}}/browse
6+
7+
### ------------------------------------------------------------------------
8+
# Get $metadata document
9+
GET {{server}}/browse/$metadata
10+
11+
### ------------------------------------------------------------------------
12+
# Browse Students as any user
13+
GET {{server}}/browse/Students?
14+
&$select=name,lastname
15+
&$expand=pronoun
16+
&sap-language=de
17+
18+
### ------------------------------------------------------------------------
19+
# Fetch Students as admin
20+
GET {{server}}/admin/Students?
21+
Authorization: Basic admin:admin
22+
23+
### ------------------------------------------------------------------------
24+
# Create Students
25+
POST {{server}}/admin/Students
26+
Content-Type: application/json;IEEE754Compatible=true
27+
28+
{
29+
"name" : "steven",
30+
"lastname" : "smith",
31+
"email" : "mail@mail.com"
32+
33+
}
34+

0 commit comments

Comments
Β (0)