Skip to content

Commit 31c4cf8

Browse files
committed
updated schema.cds
1 parent c43259d commit 31c4cf8

File tree

1 file changed

+34
-47
lines changed

1 file changed

+34
-47
lines changed

db/schema.cds

Lines changed: 34 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,52 @@
1-
using { cuid, managed, sap.common.CodeList } from '@sap/cds/common';
1+
using { User, cuid, managed, sap.common.CodeList } from '@sap/cds/common';
2+
namespace sap.capire.incidents;
23

3-
namespace sap.capire.incidents;
4+
/**
5+
* Incidents created by Customers.
6+
*/
7+
entity Incidents : cuid, managed {
8+
customer : Association to Customers;
9+
title : String @title : 'Title';
10+
urgency : Association to Urgency default 'M';
11+
status : Association to Status default 'N';
12+
conversation : Composition of many {
13+
key ID : UUID;
14+
timestamp : type of managed:createdAt;
15+
author : type of managed:createdBy;
16+
message : String;
17+
};
18+
}
419

520
/**
6-
* Customers using products sold by our company.
7-
* Customers can create support Incidents.
21+
* Customers entitled to create support Incidents.
822
*/
9-
entity Customers : cuid, managed {
23+
entity Customers : cuid, managed {
1024
firstName : String;
1125
lastName : String;
1226
email : EMailAddress;
1327
phone : PhoneNumber;
14-
creditCardNo : String(16) @assert.format: '^[1-9]\d{15}$';
15-
addresses : Composition of many Addresses on addresses.customer = $self;
1628
incidents : Association to many Incidents on incidents.customer = $self;
1729
}
18-
entity Addresses : cuid, managed {
19-
customer : Association to Customers;
20-
city : String;
21-
postCode : String;
22-
streetAddress : String;
23-
}
24-
25-
26-
/**
27-
* Incidents created by Customers.
28-
*/
29-
entity Incidents : cuid, managed {
30-
customer : Association to Customers;
31-
title : String @title: 'Title';
32-
urgency : Association to Urgency;
33-
status : Association to Status;
34-
conversations : Composition of many Conversations on conversations.incidents = $self;
35-
}
3630

3731
entity Status : CodeList {
38-
key code : String enum {
39-
new = 'N';
40-
assigned = 'A';
41-
in_process = 'I';
42-
on_hold = 'H';
43-
resolved = 'R';
44-
closed = 'C';
45-
};
46-
criticality : Integer;
32+
key code: String enum {
33+
new = 'N';
34+
assigned = 'A';
35+
in_process = 'I';
36+
on_hold = 'H';
37+
resolved = 'R';
38+
closed = 'C';
39+
};
40+
criticality : Integer;
4741
}
4842

4943
entity Urgency : CodeList {
50-
key code : String enum {
51-
high = 'H';
52-
medium = 'M';
53-
low = 'L';
54-
};
55-
}
56-
57-
entity Conversations : cuid, managed {
58-
incidents : Association to Incidents;
59-
timestamp : DateTime @cds.on.insert: $now;
60-
author : String @cds.on.insert: $user;
61-
message : String;
44+
key code: String enum {
45+
high = 'H';
46+
medium = 'M';
47+
low = 'L';
48+
};
6249
}
6350

6451
type EMailAddress : String;
65-
type PhoneNumber : String;
52+
type PhoneNumber : String;

0 commit comments

Comments
 (0)