removed RaidLogs

This commit is contained in:
Sarah Faey 2022-12-05 14:28:04 +01:00
parent de58541d0b
commit c96d34fc6a
10 changed files with 701 additions and 198 deletions

View file

@ -16,8 +16,6 @@ namespace Lieb.Models.GuildWars2.Raid
public ICollection<RaidSignUp> SignUps { get; set; } = new HashSet<RaidSignUp>();
public ICollection<RaidLog> RaidLogs { get; set; } = new HashSet<RaidLog>();
public Raid() { }
public Raid(RaidTemplate template) : base(template)

View file

@ -1,75 +0,0 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Lieb.Models.GuildWars2.Raid
{
public class RaidLog
{
public enum LogType
{
Raid = 1,
RaidTemplate = 2,
RaidSignUp = 3
}
public int RaidLogId { get; set; }
public LogType Type {get; set;}
public ulong? UserId {get; set;}
public int? RaidId { get; set; }
public int? RaidTemplateId { get; set; }
public string LogEntry {get; set;} = string.Empty;
public DateTimeOffset Time { get; set; } = DateTimeOffset.UtcNow;
public LiebUser? User {get; set;}
[JsonIgnore(Condition = JsonIgnoreCondition.Always)]
public Raid? Raid { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.Always)]
public RaidTemplate? RaidTemplate { get; set; }
public static RaidLog CreateRaidLog(ulong? userId, Raid raid)
{
return new RaidLog()
{
Type = LogType.Raid,
UserId = userId,
RaidId = raid.RaidId,
LogEntry = JsonSerializer.Serialize(raid),
Time = DateTimeOffset.UtcNow
};
}
public static RaidLog CreateSignUpLog(ulong userId, RaidSignUp signUp, string signedUpUserName)
{
string message = $"changed Status of {signedUpUserName} to: {signUp.SignUpType.ToString()}";
return new RaidLog()
{
Type = LogType.RaidSignUp,
UserId = userId,
RaidId = signUp.RaidId,
LogEntry = message,
Time = DateTimeOffset.UtcNow
};
}
public static RaidLog CreateRaidTemplateLog(ulong userId, RaidTemplate template)
{
return new RaidLog()
{
Type = LogType.RaidTemplate,
UserId = userId,
RaidTemplateId = template.RaidTemplateId,
LogEntry = JsonSerializer.Serialize(template),
Time = DateTimeOffset.UtcNow
};
}
}
}

View file

@ -19,7 +19,5 @@ namespace Lieb.Models.GuildWars2.Raid
public int Interval { get; set; }
public int CreateDaysBefore { get; set; }
public ICollection<RaidLog> TemplateLogs { get; set; } = new HashSet<RaidLog>();
}
}