Skip to content

Commit 0e45154

Browse files
committed
formatting
1 parent 8fd4aad commit 0e45154

File tree

4 files changed

+33
-29
lines changed

4 files changed

+33
-29
lines changed

db/books.cds

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ entity Books : cuid, managed {
2424
}
2525

2626
entity Authors : cuid, managed {
27-
@assert.format : '^\p{Lu}.*' // assert that name starts with a capital letter
27+
@assert.format: '^\p{Lu}.*' // assert that name starts with a capital letter
2828
name : String(111);
2929
dateOfBirth : Date;
3030
dateOfDeath : Date;
@@ -36,20 +36,22 @@ entity Authors : cuid, managed {
3636

3737
// annotations for Data Privacy
3838
annotate Authors with
39-
@PersonalData : { DataSubjectRole : 'Author', EntitySemantics : 'DataSubject' }
40-
{
41-
ID @PersonalData.FieldSemantics : 'DataSubjectID';
42-
name @PersonalData.IsPotentiallySensitive;
39+
@PersonalData: {
40+
DataSubjectRole: 'Author',
41+
EntitySemantics: 'DataSubject'
42+
} {
43+
ID @PersonalData.FieldSemantics: 'DataSubjectID';
44+
name @PersonalData.IsPotentiallySensitive;
4345
}
4446

4547
/**
4648
* Hierarchically organized Code List for Genres
4749
*/
4850
entity Genres {
49-
key ID : Integer;
50-
name : localized String(255);
51-
descr : localized String(1000);
52-
parent : Association to Genres;
53-
children : Composition of many Genres
54-
on children.parent = $self;
51+
key ID : Integer;
52+
name : localized String(255);
53+
descr : localized String(1000);
54+
parent : Association to Genres;
55+
children : Composition of many Genres
56+
on children.parent = $self;
5557
}

db/reviews.cds

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ using my.bookshop.Books from './books';
99

1010
entity Reviews : cuid, managed {
1111
@cds.odata.ValueList
12-
book : Association to Books;
13-
rating : Rating;
14-
title : String(111);
15-
text : String(1111);
12+
book : Association to Books;
13+
rating : Rating;
14+
title : String(111);
15+
text : String(1111);
1616
}
1717

1818
// input validation
1919
annotate Reviews with {
2020
title @mandatory;
2121
rating @assert.range;
22-
book @mandatory @assert.target;
22+
book @mandatory @assert.target;
2323
}
2424

2525
type Rating : Integer enum {

srv/admin-service.cds

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using {sap.common.Languages as CommonLanguages} from '@sap/cds/common';
22
using {my.bookshop as my} from '../db/index';
33
using {sap.changelog as changelog} from 'com.sap.cds/change-tracking';
44
using {my.common.Hierarchy as Hierarchy} from './hierarchy';
5-
using {sap.attachments.Attachments} from`com.sap.cds/cds-feature-attachments`;
5+
using {sap.attachments.Attachments} from 'com.sap.cds/cds-feature-attachments';
66

77
extend my.Orders with changelog.changeTracked;
88

srv/review-service.cds

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
using {my.bookshop as my} from '../db/index';
22

3-
@path : 'review'
3+
@path: 'review'
44
service ReviewService {
55
entity Reviews as projection on my.Reviews;
66

77
@readonly
8-
entity Books as projection on my.Books excluding {
9-
createdBy,
10-
modifiedBy
11-
}
8+
entity Books as
9+
projection on my.Books
10+
excluding {
11+
createdBy,
12+
modifiedBy
13+
}
1214

1315
@readonly
1416
entity Authors as projection on my.Authors;
1517

1618
@readonly
17-
entity Genres as projection on my.Genres;
19+
entity Genres as projection on my.Genres;
1820

1921
// access control restrictions
20-
annotate Reviews with @restrict : [
22+
annotate Reviews with @restrict: [
2123
{
22-
grant : '*',
23-
to : 'authenticated-user',
24-
where : (createdBy=$user)
24+
grant: '*',
25+
to: 'authenticated-user',
26+
where: (createdBy = $user)
2527
},
2628
{
27-
grant : '*',
28-
to : 'admin',
29+
grant: '*',
30+
to: 'admin',
2931
}
3032
];
3133
}

0 commit comments

Comments
 (0)