forked from SoDOff-Project/sodoff

Implements the rating system. Shipwreck Lagoon tracks theoretically work, but there's currently no way of testing them. There is a hack to make the ranked pods section of the blaster party board work. Don't know if that'll cause any issues (but I don't think so). SQLite database schema changes: ```sql CREATE TABLE "RatingRanks" ( "Id" INTEGER NOT NULL, "CategoryID" INTEGER NOT NULL, "RatedEntityID" INTEGER, "RatedUserID" TEXT, "Rank" INTEGER NOT NULL, "RatingAverage" REAL NOT NULL, "UpdateDate" TEXT NOT NULL, CONSTRAINT "PK_RatingRanks" PRIMARY KEY("Id" AUTOINCREMENT) ); CREATE TABLE "Ratings" ( "Id" INTEGER NOT NULL, "VikingId" INTEGER NOT NULL, "RankId" INTEGER NOT NULL, "Value" INTEGER NOT NULL, "Date" TEXT NOT NULL, CONSTRAINT "FK_Ratings_RatingRanks_RankId" FOREIGN KEY("RankId") REFERENCES "RatingRanks"("Id") ON DELETE CASCADE, CONSTRAINT "PK_Ratings" PRIMARY KEY("Id" AUTOINCREMENT), CONSTRAINT "FK_Ratings_Vikings_VikingId" FOREIGN KEY("VikingId") REFERENCES "Vikings"("Id") ON DELETE CASCADE ); ``` --------- Co-authored-by: Robert Paciorek <robert@opcode.eu.org>
18 lines
387 B
C#
18 lines
387 B
C#
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace sodoff.Model;
|
|
|
|
public class Rating {
|
|
[Key]
|
|
public int Id { get; set; }
|
|
|
|
public int VikingId { get; set; }
|
|
public int RankId { get; set; }
|
|
|
|
public int Value { get; set; }
|
|
public DateTime Date { get; set; }
|
|
|
|
public virtual Viking Viking { get; set; }
|
|
public virtual RatingRank Rank { get; set; }
|
|
}
|