This commit is contained in:
Daniel
2020-03-02 00:08:49 +01:00
parent d9df2930cb
commit 26d7fc767c
71 changed files with 141 additions and 34 deletions

31
reviews/db/schema.cds Normal file
View File

@@ -0,0 +1,31 @@
namespace sap.capire.reviews;
using { User } from '@sap/cds/common';
// Reviewed subjects can be any entity that is uniquely identified
// by a single key element such as a UUID
type ReviewedSubject : String(111);
entity Reviews {
key ID : UUID;
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 : Decimal(3,2) enum {
Best = 5;
Good = 4;
Avg = 3;
Poor = 2;
Worst = 1;
}
entity Likes {
key review : Association to Reviews;
key user : User;
}