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)
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user