forked from SoDOff-Project/sodoff
initial data model work
This commit is contained in:
parent
3222c63fa6
commit
54307d7582
@ -30,6 +30,7 @@ public class DBContext : DbContext {
|
||||
public DbSet<RatingRank> RatingRanks { get; set; } = null!;
|
||||
public DbSet<UserMissionData> UserMissionData { get; set; } = null!;
|
||||
public DbSet<UserBadgeCompleteData> UserBadgesCompleted { get; set; } = null!;
|
||||
public DbSet<UserBan> Bans { get; set; } = null!;
|
||||
|
||||
private readonly IOptions<ApiServerConfig> config;
|
||||
|
||||
@ -156,6 +157,9 @@ public class DBContext : DbContext {
|
||||
builder.Entity<Viking>().HasMany(v => v.UserBadgesCompleted)
|
||||
.WithOne(r => r.Viking);
|
||||
|
||||
builder.Entity<Viking>().HasMany(v => v.UserBans)
|
||||
.WithOne(r => r.Viking);
|
||||
|
||||
// Dragons
|
||||
builder.Entity<Dragon>().HasOne(d => d.Viking)
|
||||
.WithMany(e => e.Dragons)
|
||||
@ -301,5 +305,10 @@ public class DBContext : DbContext {
|
||||
builder.Entity<UserBadgeCompleteData>().HasOne(r => r.Viking)
|
||||
.WithMany(v => v.UserBadgesCompleted)
|
||||
.HasForeignKey(r => r.VikingId);
|
||||
|
||||
// Bans
|
||||
builder.Entity<UserBan>().HasOne(r => r.Viking)
|
||||
.WithMany(e => e.UserBans)
|
||||
.HasForeignKey(e => e.VikingId);
|
||||
}
|
||||
}
|
||||
|
19
src/Model/UserBan.cs
Normal file
19
src/Model/UserBan.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using sodoff.Schema;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
public class UserBan
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int VikingId { get; set; }
|
||||
|
||||
public UserBanType UserBanType { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime? ExpiresOn { get; set; }
|
||||
|
||||
public virtual Viking? Viking { get; set; }
|
||||
}
|
@ -44,6 +44,7 @@ public class Viking {
|
||||
public virtual Dragon? SelectedDragon { get; set; }
|
||||
public virtual ICollection<UserMissionData> UserMissions { get; set; } = null!;
|
||||
public virtual ICollection<UserBadgeCompleteData> UserBadgesCompleted { get; set; } = null!;
|
||||
public virtual ICollection<UserBan> UserBans { get; set; } = null!;
|
||||
|
||||
public DateTime? CreationDate { get; set; }
|
||||
public DateTime? BirthDate { get; set; }
|
||||
|
9
src/Schema/UserBanType.cs
Normal file
9
src/Schema/UserBanType.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace sodoff.Schema;
|
||||
|
||||
public enum UserBanType
|
||||
{
|
||||
IndefiniteOpenChatBan = 1,
|
||||
TemporaryOpenChatBan = 2,
|
||||
IndefiniteAccountBan = 3,
|
||||
TemporaryAccountBan = 4
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user