final state of exercise 2

This commit is contained in:
d045778
2019-09-23 13:25:44 +02:00
parent 1e28cb217f
commit fb8f6acac7
8 changed files with 153 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
namespace sap.capire.reviews;
using { User } from '@sap/cds/common';
// Reviewed subjects can be any entity that is uniquely identified
type ReviewedSubject : String(111);
entity Reviews {
key ID : String(36);
subject : ReviewedSubject;
reviewer : User;
rating : Rating;
title : String(111);
text : String(1111);
date : DateTime;
likes : Composition of many Likes on likes.review = $self;
liked : Integer default 0; // counter for likes as helpful review (count of all _likes belonging to this review)
}
type Rating : Integer enum {
Best = 5;
Good = 4;
Avg = 3;
Poor = 2;
Worst = 1;
}
entity Likes {
key review : Association to Reviews;
key user : User;
}