using AutoMapper; using LANCommander.Server.Data; using LANCommander.Server.Data.Models; using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using ZiggyCreatures.Caching.Fusion; namespace LANCommander.Server.Services { public sealed class ChatThreadService( ILogger logger, IFusionCache cache, IMapper mapper, IHttpContextAccessor httpContextAccessor, IDbContextFactory context) : BaseDatabaseService(logger, cache, mapper, httpContextAccessor, context) { public override async Task AddAsync(ChatThread entity) { return await base.AddAsync(entity, async context => { await context.UpdateRelationshipAsync(ct => ct.Messages); }); } public override async Task UpdateAsync(ChatThread entity) { return await base.UpdateAsync(entity, async context => { await context.UpdateRelationshipAsync(ct => ct.Participants); await context.UpdateRelationshipAsync(ct => ct.Messages); }); } } }