Refactor .gitignore and enhance transaction handling with encryption support
Signed-off-by: Dmitrii <computer@yawaflua.tech> Took 48 minutes
This commit is contained in:
@@ -2,6 +2,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
using MongoDB.EntityFrameworkCore.Extensions;
|
||||
using SpMega.Backend.Persistent.Models.Transactions;
|
||||
using SpMega.Backend.Persistent.Models.Users;
|
||||
using SpMega.Backend.Services;
|
||||
|
||||
namespace SpMega.Backend.Persistent.Database;
|
||||
|
||||
@@ -20,6 +21,14 @@ public class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(op
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
|
||||
modelBuilder.Entity<User>()
|
||||
.OwnsMany(u => u.Cards, card =>
|
||||
{
|
||||
card.Property(c => c.Token)
|
||||
.HasConversion(
|
||||
v => EncryptionHelper.Encrypt(v),
|
||||
v => EncryptionHelper.Decrypt(v)
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,32 @@ using SPWorldsApi.Types.Interfaces;
|
||||
|
||||
namespace SpMega.Backend.Persistent.Models.DTO;
|
||||
|
||||
public class UserAccountDTO : IUserAccount
|
||||
public class UserAccountDTO
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string username { get; set; }
|
||||
public string minecraftUUID { get; set; }
|
||||
public string status { get; set; }
|
||||
public List<string> roles { get; set; }
|
||||
public ICity city { get; set; }
|
||||
public List<IUserCard> cards { get; set; }
|
||||
public CityDTO city { get; set; }
|
||||
public List<UserCardDTO> cards { get; set; }
|
||||
public DateTime createdAt { get; set; }
|
||||
}
|
||||
|
||||
public class UserCardDTO
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string number { get; set; }
|
||||
public int color { get; set; }
|
||||
}
|
||||
|
||||
public class CityDTO
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string description { get; set; }
|
||||
public int x { get; set; }
|
||||
public int z { get; set; }
|
||||
public bool isMayor { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user