mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
Removed unneccesary usings and changed owner to viking.
This commit is contained in:
parent
840109ba8d
commit
581ca93e63
@ -1,13 +1,9 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using sodoff.Attributes;
|
||||
using sodoff.Configuration;
|
||||
using sodoff.Model;
|
||||
using sodoff.Schema;
|
||||
using sodoff.Services;
|
||||
using sodoff.Util;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace sodoff.Controllers.Common;
|
||||
|
||||
@ -123,7 +119,7 @@ public class RatingController : Controller
|
||||
bool newRating = rating == null;
|
||||
if (newRating) {
|
||||
rating = new Rating {
|
||||
OwnerId = viking.Id,
|
||||
VikingId = viking.Id,
|
||||
CategoryID = category,
|
||||
RatedEntityID = eID,
|
||||
RatedUserID = uID
|
||||
@ -213,7 +209,7 @@ public class RatingController : Controller
|
||||
.Where(r => r.CategoryID == categoryID && r.RatedEntityID == ratedEntityID && r.RatedUserID == null)
|
||||
.Select(r => new RatingInfo {
|
||||
Id = r.Id,
|
||||
OwnerUid = r.Owner.Uid,
|
||||
OwnerUid = r.Viking.Uid,
|
||||
CategoryID = r.CategoryID,
|
||||
RatedEntityID = r.RatedEntityID,
|
||||
Value = r.Value,
|
||||
|
@ -143,7 +143,7 @@ public class DBContext : DbContext {
|
||||
.WithMany(e => e.Vikings);
|
||||
|
||||
builder.Entity<Viking>().HasMany(v => v.Ratings)
|
||||
.WithOne(r => r.Owner);
|
||||
.WithOne(r => r.Viking);
|
||||
|
||||
// Dragons
|
||||
builder.Entity<Dragon>().HasOne(d => d.Viking)
|
||||
@ -267,9 +267,9 @@ public class DBContext : DbContext {
|
||||
.WithMany(e => e.Groups);
|
||||
|
||||
// Rating
|
||||
builder.Entity<Rating>().HasOne(r => r.Owner)
|
||||
builder.Entity<Rating>().HasOne(r => r.Viking)
|
||||
.WithMany(v => v.Ratings)
|
||||
.HasForeignKey(r => r.OwnerId);
|
||||
.HasForeignKey(r => r.VikingId);
|
||||
|
||||
builder.Entity<Rating>().HasOne(r => r.Rank)
|
||||
.WithMany(rr => rr.Ratings)
|
||||
|
@ -1,5 +1,4 @@
|
||||
using sodoff.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
@ -8,12 +7,11 @@ public class Rating {
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>Viking that controls this data.</summary>
|
||||
public virtual Viking? Owner { get; set; }
|
||||
public virtual Viking? Viking { get; set; }
|
||||
|
||||
public virtual RatingRank? Rank { get; set; }
|
||||
|
||||
/// <summary>VikingId</summary>
|
||||
public int OwnerId { get; set; }
|
||||
public int VikingId { get; set; }
|
||||
|
||||
public int RankId { get; set; } // Done this to prevent it from generating an unnecessary pairs table.
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
using sodoff.Model;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace sodoff.Schema;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
using sodoff.Model;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace sodoff.Schema;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user