mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
user data export and import interfce (WIP)
This commit is contained in:
parent
fb6c935e7e
commit
20af614d0d
146
src/Controllers/Common/ImportExportController.cs
Normal file
146
src/Controllers/Common/ImportExportController.cs
Normal file
@ -0,0 +1,146 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Encodings.Web;
|
||||
using sodoff.Model;
|
||||
|
||||
namespace sodoff.Controllers.Common;
|
||||
public class ExportController : ControllerBase {
|
||||
private readonly DBContext ctx;
|
||||
|
||||
public ExportController(DBContext ctx) {
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("ImportExport.asmx/Export")]
|
||||
public IActionResult Export([FromForm] string username, [FromForm] string password) {
|
||||
// Authenticate user by Username
|
||||
User? user = ctx.Users.FirstOrDefault(e => e.Username == username);
|
||||
if (user is null || new PasswordHasher<object>().VerifyHashedPassword(null, user.Password, password) == PasswordVerificationResult.Failed) {
|
||||
return Unauthorized("Invalid username or password.");
|
||||
}
|
||||
|
||||
// Serialize to JSON
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
ReferenceHandler = ReferenceHandler.IgnoreCycles,
|
||||
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||
WriteIndented = true
|
||||
};
|
||||
string jsonData = JsonSerializer.Serialize(user, options);
|
||||
|
||||
return Ok(jsonData);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("ImportExport.asmx/Import")]
|
||||
public IActionResult Import([FromForm] string username, [FromForm] string password, [FromForm] string vikingName, [FromForm] IFormFile dataFile) {
|
||||
User? user = ctx.Users.FirstOrDefault(e => e.Username == username);
|
||||
if (user is null || new PasswordHasher<object>().VerifyHashedPassword(null, user.Password, password) == PasswordVerificationResult.Failed) {
|
||||
return Unauthorized("Invalid username or password.");
|
||||
}
|
||||
|
||||
User user_data;
|
||||
using (var reader = new StreamReader(dataFile.OpenReadStream())) {
|
||||
user_data = System.Text.Json.JsonSerializer.Deserialize<User>(reader.ReadToEnd());
|
||||
}
|
||||
|
||||
foreach (var v in user_data.Vikings) {
|
||||
if (v.Name == vikingName) {
|
||||
Viking viking = new Viking {
|
||||
Uid = v.Uid, // TODO check for unique or just generate new?
|
||||
Name = v.Name, // TODO check for unique
|
||||
User = user,
|
||||
AvatarSerialized = v.AvatarSerialized,
|
||||
CreationDate = v.CreationDate, // TODO or use now?
|
||||
BirthDate = v.BirthDate,
|
||||
Gender = v.Gender,
|
||||
GameVersion = v.GameVersion
|
||||
};
|
||||
user.Vikings.Add(viking);
|
||||
|
||||
foreach (var x in v.Dragons) {
|
||||
x.Viking = viking;
|
||||
// TODO check EntityId for unique or just generate new?
|
||||
x.Id = 0; // FIXME map old→new value for dragon id to update (stables) xml's
|
||||
ctx.Dragons.Add(x);
|
||||
}
|
||||
foreach (var x in v.Images) {
|
||||
x.Viking = viking;
|
||||
ctx.Images.Add(x);
|
||||
}
|
||||
foreach (var x in v.InventoryItems) {
|
||||
x.Id = 0; // FIXME map old→new value for item id to update xml's and rooms
|
||||
x.Viking = viking;
|
||||
ctx.InventoryItems.Add(x);
|
||||
}
|
||||
foreach (var x in v.Rooms) {
|
||||
x.Viking = viking;
|
||||
ctx.Rooms.Add(x); // FIXME need update room name (if numeric)
|
||||
}
|
||||
foreach (var x in v.MissionStates) {
|
||||
x.Viking = viking;
|
||||
ctx.MissionStates.Add(x);
|
||||
}
|
||||
foreach (var x in v.TaskStatuses) {
|
||||
x.Viking = viking;
|
||||
ctx.TaskStatuses.Add(x);
|
||||
}
|
||||
foreach (var x in v.AchievementTaskStates) {
|
||||
x.Viking = viking;
|
||||
ctx.AchievementTaskState.Add(x);
|
||||
}
|
||||
foreach (var x in v.AchievementPoints) {
|
||||
x.Viking = viking;
|
||||
ctx.AchievementPoints.Add(x);
|
||||
}
|
||||
foreach (var x in v.PairData) {
|
||||
x.Viking = viking;
|
||||
ctx.PairData.Add(x); // FIXME need update PetID in stable XML
|
||||
}
|
||||
foreach (var x in v.ProfileAnswers) {
|
||||
x.Viking = viking;
|
||||
ctx.ProfileAnswers.Add(x);
|
||||
}
|
||||
foreach (var x in v.GameData) {
|
||||
x.Viking = viking;
|
||||
ctx.GameData.Add(x);
|
||||
}
|
||||
foreach (var x in v.SavedData) {
|
||||
x.Viking = viking;
|
||||
ctx.SavedData.Add(x);
|
||||
}
|
||||
foreach (var x in v.Parties) {
|
||||
x.Viking = viking;
|
||||
ctx.Parties.Add(x);
|
||||
}
|
||||
foreach (var x in v.UserMissions) {
|
||||
x.Viking = viking;
|
||||
ctx.UserMissions.Add(x);
|
||||
}
|
||||
foreach (var x in v.UserBadgesCompleted) {
|
||||
x.Viking = viking;
|
||||
ctx.UserBadgesCompleted.Add(x);
|
||||
}
|
||||
if (v.Ratings.Count > 0) {
|
||||
viking.Ratings = new List<Rating>();
|
||||
foreach (var x in v.Ratings) {
|
||||
// TODO (non-SoD) add rating via SetRating(viking, x.Rank.CategoryID, x.Rank.RatedEntityID, x.Rank.RatedUserID, x.Value);
|
||||
}
|
||||
}
|
||||
if (v.Neighborhood != null) {
|
||||
v.Neighborhood.Viking = viking;
|
||||
ctx.Neighborhoods.Add(v.Neighborhood);
|
||||
}
|
||||
// TODO set viking.SelectedDragon
|
||||
|
||||
ctx.SaveChanges();
|
||||
return Ok("OK");
|
||||
}
|
||||
}
|
||||
return Ok("Viking Not Found");
|
||||
}
|
||||
}
|
@ -1,12 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
public class AchievementPoints {
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
|
||||
public int Type { get; set; }
|
||||
|
||||
public int Value { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking? Viking { get; set; }
|
||||
}
|
||||
|
@ -1,15 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
[PrimaryKey(nameof(TaskId), nameof(VikingId))]
|
||||
public class AchievementTaskState {
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
|
||||
public int TaskId { get; set; }
|
||||
|
||||
public int Points { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking? Viking { get; set; }
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ public class DBContext : DbContext {
|
||||
public DbSet<ProfileAnswer> ProfileAnswers { get; set; } = null!;
|
||||
public DbSet<MMORole> MMORoles { get; set; } = null!;
|
||||
public DbSet<Party> Parties { get; set; } = null!;
|
||||
public DbSet<AchievementTaskState> AchievementTaskState { get; set; } = null!;
|
||||
public DbSet<SavedData> SavedData { get; set; } = null!;
|
||||
public DbSet<UserMissionData> UserMissions { get; set; } = null!;
|
||||
public DbSet<Neighborhood> Neighborhoods { get; set; } = null!;
|
||||
// we had a brief debate on whether it's neighborhoods or neighborheed
|
||||
public DbSet<Group> Groups { get; set; } = null!;
|
||||
|
@ -1,22 +1,27 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
public class Dragon {
|
||||
[Key]
|
||||
// [JsonIgnore] used in serialised xml (stables)
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public Guid EntityId { get; set; }
|
||||
|
||||
[Required]
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
|
||||
public string? RaisedPetData { get; set; }
|
||||
|
||||
public int? PetXP { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking Viking { get; set; } = null!;
|
||||
public virtual ICollection<PairData> PairData { get; set; } = null!;
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
public class GameData {
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
|
||||
public int GameId { get; set; }
|
||||
@ -15,6 +18,6 @@ public class GameData {
|
||||
public bool Win { get; set; }
|
||||
public bool Loss { get; set; }
|
||||
public virtual ICollection<GameDataPair> GameDataPairs { get; set; } = null!;
|
||||
[JsonIgnore]
|
||||
public virtual Viking Viking { get; set; } = null!;
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
public class GameDataPair {
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
[JsonIgnore]
|
||||
public int GameDataId { get; set; }
|
||||
public string Name { get; set; } = null!;
|
||||
public int Value { get; set; }
|
||||
[JsonIgnore]
|
||||
public virtual GameData GameData { get; set; } = null!;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace sodoff.Model;
|
||||
@ -12,11 +13,13 @@ public class Image {
|
||||
public int ImageSlot { get; set; }
|
||||
|
||||
[Required]
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
|
||||
public string? ImageData { get; set; }
|
||||
|
||||
public string? TemplateName { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking Viking { get; set; } = null!;
|
||||
}
|
||||
|
@ -1,18 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model {
|
||||
public class InventoryItem {
|
||||
[Key]
|
||||
// [JsonIgnore] used as room id, used in serialised xml (pairs, ...)
|
||||
public int Id { get; set; }
|
||||
|
||||
public int ItemId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
|
||||
public string? StatsSerialized { get; set; }
|
||||
|
||||
public string? AttributesSerialized { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking Viking { get; set; } = null!;
|
||||
|
||||
public int Quantity { get; set; }
|
||||
|
@ -1,15 +1,18 @@
|
||||
using sodoff.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
public class MMORole {
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int VikingId { get; set; }
|
||||
|
||||
public Role Role { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking? Viking { get; set; }
|
||||
}
|
||||
|
@ -1,15 +1,19 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
public class MissionState {
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int MissionId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking? Viking { get; set; }
|
||||
|
||||
public MissionStatus MissionStatus { get; set; }
|
||||
@ -19,4 +23,4 @@ public class MissionState {
|
||||
|
||||
public enum MissionStatus {
|
||||
Upcoming,Active,Completed
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,20 @@
|
||||
using sodoff.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Data;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model
|
||||
{
|
||||
public class Neighborhood
|
||||
{
|
||||
[JsonIgnore]
|
||||
public virtual Viking? Viking { get; set; }
|
||||
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
|
||||
[Required]
|
||||
|
@ -1,18 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
public class Pair {
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Key { get; set; } = null!;
|
||||
|
||||
public string Value { get; set; } = null!;
|
||||
|
||||
[JsonIgnore]
|
||||
public int MasterId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual PairData PairData { get; set; } = null!;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
@ -9,21 +10,28 @@ namespace sodoff.Model;
|
||||
public class PairData {
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int PairId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public Guid? UserId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int? VikingId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int? DragonId { get; set; }
|
||||
|
||||
public virtual ICollection<Pair> Pairs { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual User? User { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking? Viking { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Dragon? Dragon { get; set; }
|
||||
}
|
||||
|
@ -1,18 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model
|
||||
{
|
||||
public class Party
|
||||
{
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
public string Location { get; set; } = null!;
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
public DateTime ExpirationDate { get; set; } = DateTime.UtcNow;
|
||||
public bool? PrivateParty { get; set; }
|
||||
public string LocationIconAsset { get; set; } = null!;
|
||||
public string AssetBundle { get; set; } = null!;
|
||||
[JsonIgnore]
|
||||
public virtual Viking? Viking { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,19 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model
|
||||
{
|
||||
public class ProfileAnswer
|
||||
{
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
public int QuestionID { get; set; }
|
||||
public int AnswerID { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking Viking { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
public class Rating {
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
public int RankId { get; set; }
|
||||
|
||||
public int Value { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking Viking { get; set; }
|
||||
public virtual RatingRank Rank { get; set; }
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
public class RatingRank {
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int CategoryID { get; set; }
|
||||
@ -14,5 +16,6 @@ public class RatingRank {
|
||||
public float RatingAverage { get; set; } // On a scale of 1-5
|
||||
public DateTime UpdateDate { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<Rating> Ratings { get; set; } = null!;
|
||||
}
|
||||
|
@ -1,18 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
|
||||
public class Room {
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
public string RoomId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking? Viking { get; set; }
|
||||
|
||||
public virtual ICollection<RoomItem> Items { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,16 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
public class RoomItem {
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int RoomId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Room Room { get; set; }
|
||||
|
||||
public string RoomItemData { get; set; }
|
||||
|
@ -1,8 +1,12 @@
|
||||
namespace sodoff.Model;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
public class SavedData {
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
public uint SaveId { get; set; }
|
||||
public string? SerializedData { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking Viking { get; set; } = null!;
|
||||
}
|
||||
|
@ -1,14 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model
|
||||
{
|
||||
public class SceneData
|
||||
{
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
public int VikingId { get; set; }
|
||||
public string SceneName { get; set; } = null!;
|
||||
public string XmlData { get; set; } = null!;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking Viking { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,15 @@
|
||||
namespace sodoff.Model {
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model {
|
||||
public class TaskStatus {
|
||||
public int Id { get; set; }
|
||||
|
||||
public int MissionId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking? Viking { get; set; }
|
||||
|
||||
public string? Payload { get; set; }
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model;
|
||||
public class User {
|
||||
@ -14,6 +15,7 @@ public class User {
|
||||
[Required]
|
||||
public string Password { get; set; } = null!;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<Session> Sessions { get; set; } = null!;
|
||||
public virtual ICollection<Viking> Vikings { get; set; } = null!;
|
||||
public virtual ICollection<PairData> PairData { get; set; } = null!;
|
||||
|
@ -1,11 +1,16 @@
|
||||
namespace sodoff.Model
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace sodoff.Model
|
||||
{
|
||||
public class UserBadgeCompleteData
|
||||
{
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
public int BadgeId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking? Viking { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace sodoff.Model
|
||||
@ -6,6 +7,7 @@ namespace sodoff.Model
|
||||
[PrimaryKey(nameof(VikingId), nameof(WorldId), nameof(MissionId))]
|
||||
public class UserMissionData
|
||||
{
|
||||
[JsonIgnore]
|
||||
public int VikingId { get; set; }
|
||||
public int WorldId { get; set; }
|
||||
public int MissionId { get; set; }
|
||||
@ -13,6 +15,7 @@ namespace sodoff.Model
|
||||
public int TaskId { get; set; }
|
||||
public bool IsCompleted { get; set; } = false;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Viking? Viking { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
using sodoff.Schema;
|
||||
|
||||
namespace sodoff.Model;
|
||||
@ -7,6 +8,7 @@ namespace sodoff.Model;
|
||||
[Index(nameof(Uid))]
|
||||
public class Viking {
|
||||
[Key]
|
||||
[JsonIgnore]
|
||||
public int Id { get; set; }
|
||||
|
||||
public Guid Uid { get; set; }
|
||||
@ -15,13 +17,17 @@ public class Viking {
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
[Required]
|
||||
[JsonIgnore]
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
public string? AvatarSerialized { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int? SelectedDragonId { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<Session> Sessions { get; set; } = null!;
|
||||
[JsonIgnore]
|
||||
public virtual User User { get; set; } = null!;
|
||||
public virtual ICollection<Dragon> Dragons { get; set; } = null!;
|
||||
public virtual ICollection<Image> Images { get; set; } = null!;
|
||||
@ -37,8 +43,10 @@ public class Viking {
|
||||
public virtual ICollection<ProfileAnswer> ProfileAnswers { get; set; } = null!;
|
||||
public virtual ICollection<SavedData> SavedData { get; set; } = null!;
|
||||
public virtual ICollection<Party> Parties { get; set; } = null!;
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<MMORole> MMORoles { get; set; } = null!;
|
||||
public virtual Neighborhood? Neighborhood { get; set; } = null!;
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<Group> Groups { get; set; } = null!;
|
||||
public virtual ICollection<Rating> Ratings { get; set; } = null!;
|
||||
public virtual Dragon? SelectedDragon { get; set; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user