Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add quest event group tracking #376

Merged
merged 12 commits into from
Aug 11, 2023
2 changes: 2 additions & 0 deletions DragaliaAPI.Database/ApiContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,6 @@ but EF Core doesn't like this and the client probably stops you anyway?
public DbSet<DbSummonTicket> PlayerSummonTickets { get; set; }

public DbSet<DbEmblem> Emblems { get; set; }

public DbSet<DbQuestEvent> QuestEvents { get; set; }
}
2 changes: 2 additions & 0 deletions DragaliaAPI.Database/Entities/DbPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,6 @@ public class DbPlayer
new List<DbPlayerDmodeServitorPassive>();

public virtual DbPlayerShopInfo? ShopInfo { get; set; }

public virtual ICollection<DbQuestEvent> QuestEvents { get; set; } = new List<DbQuestEvent>();
}
4 changes: 2 additions & 2 deletions DragaliaAPI.Database/Entities/DbQuest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public class DbQuest : IDbHasAccountId

public int WeeklyPlayCount { get; set; } = 0;

public int LastDailyResetTime { get; set; } = 0;
public DateTimeOffset LastDailyResetTime { get; set; } = DateTimeOffset.UnixEpoch;

public int LastWeeklyResetTime { get; set; } = 0;
public DateTimeOffset LastWeeklyResetTime { get; set; } = DateTimeOffset.UnixEpoch;

public bool IsAppear { get; set; } = true;

Expand Down
46 changes: 46 additions & 0 deletions DragaliaAPI.Database/Entities/DbQuestEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace DragaliaAPI.Database.Entities;

[Index(nameof(DeviceAccountId))]
[PrimaryKey(nameof(DeviceAccountId), nameof(QuestEventId))]
public class DbQuestEvent : IDbHasAccountId
{
/// <inheritdoc />
public virtual DbPlayer? Owner { get; set; }

/// <inheritdoc />
[ForeignKey(nameof(Owner))]
public required string DeviceAccountId { get; set; }

[Column("QuestEventId")]
public required int QuestEventId { get; set; }

[Column("DailyPlayCount")]
public int DailyPlayCount { get; set; }

[Column("LastDailyResetTime")]
public DateTimeOffset LastDailyResetTime { get; set; } = DateTimeOffset.UnixEpoch;

[Column("WeeklyPlayCount")]
public int WeeklyPlayCount { get; set; }

[Column("LastWeeklyResetTime")]
public DateTimeOffset LastWeeklyResetTime { get; set; } = DateTimeOffset.UnixEpoch;

[Column("QuestBonusReceiveCount")]
public int QuestBonusReceiveCount { get; set; }

[Column("QuestBonusStackCount")]
public int QuestBonusStackCount { get; set; }

[Column("QuestBonusStackTime")]
public DateTimeOffset QuestBonusStackTime { get; set; } = DateTimeOffset.UnixEpoch;

[Column("QuestBonusReserveCount")]
public int QuestBonusReserveCount { get; set; }

[Column("QuestBonusReserveTime")]
public DateTimeOffset QuestBonusReserveTime { get; set; } = DateTimeOffset.UnixEpoch;
}
Loading
Loading