Add updatetime to rank entries
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
@@ -9,12 +10,20 @@ namespace TOOHUCardAPI.DTO.RankData
|
||||
{
|
||||
[JsonProperty("rank_type")]
|
||||
public string RankType { get; set; }
|
||||
[JsonProperty("steamid")]
|
||||
public long SteamId { get; set; }
|
||||
[JsonProperty("userid")]
|
||||
public long UserId { get; set; }
|
||||
[JsonProperty("username")]
|
||||
public string Username { get; set; }
|
||||
[JsonProperty("version")]
|
||||
public string Version { get; set; }
|
||||
[JsonProperty("wave")]
|
||||
public int Wave { get; set; }
|
||||
[JsonProperty("damage")]
|
||||
public long Damage { get; set; }
|
||||
[JsonProperty("updatetime")]
|
||||
public DateTime UpdateTime { get; set; }
|
||||
[JsonIgnore]
|
||||
public Dictionary<string, string> Cards { get; set; }
|
||||
}
|
||||
@@ -32,6 +41,7 @@ namespace TOOHUCardAPI.DTO.RankData
|
||||
Version = rankEntry.Version,
|
||||
Wave = rankEntry.Wave,
|
||||
Damage = rankEntry.Damage,
|
||||
UpdateTime = rankEntry.UpdateTime,
|
||||
Cards = rankEntry.TowersUsed.Select(tower => KeyValuePair.Create(tower.TowerKey, tower.EncodedData))
|
||||
.ToDictionary(kv => kv.Key, kv => kv.Value)
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
@@ -17,6 +18,7 @@ namespace TOOHUCardAPI.Data.Models
|
||||
public string Version { get; set; }
|
||||
public int Wave { get; set; }
|
||||
public long Damage { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
public List<RankTowerEntry> TowersUsed { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@@ -45,7 +46,8 @@ namespace TOOHUCardAPI.Data.Services
|
||||
Version = entry.Version,
|
||||
Wave = entry.Wave,
|
||||
Damage = entry.Damage,
|
||||
TowersUsed = towersUsed
|
||||
TowersUsed = towersUsed,
|
||||
UpdateTime = DateTime.Now
|
||||
};
|
||||
await _rankRepository.InsertRankEntry(toUpload);
|
||||
_logger.LogInformation("Uploaded a rank entry for {SteamId}", entry.SteamId);
|
||||
|
||||
1117
TOOHUCardAPI/Migrations/20211107044043_updatetime.Designer.cs
generated
Normal file
1117
TOOHUCardAPI/Migrations/20211107044043_updatetime.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
TOOHUCardAPI/Migrations/20211107044043_updatetime.cs
Normal file
25
TOOHUCardAPI/Migrations/20211107044043_updatetime.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace TOOHUCardAPI.Migrations
|
||||
{
|
||||
public partial class updatetime : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "UpdateTime",
|
||||
table: "RankEntries",
|
||||
type: "timestamp without time zone",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdateTime",
|
||||
table: "RankEntries");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -956,6 +956,9 @@ namespace TOOHUCardAPI.Migrations
|
||||
b.Property<int>("RankType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<long?>("UserSteamId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user