| 12345678910111213141516 |
- using Application.Abstractions.Data;
- using Microsoft.EntityFrameworkCore;
- namespace Application.Helpers;
- /// <summary>
- /// 채팅 제재 검사 — RoomKey NULL(전체) 또는 해당 룸 제재가 만료 전이면 발언 차단.
- /// 읽기(수신/히스토리)는 차단하지 않는다.
- /// </summary>
- public static class ChatBanChecker
- {
- public static async Task<bool> IsBannedAsync(IAppDbContext db, int memberID, string roomKey, DateTime nowUtc, CancellationToken ct)
- {
- return await db.ChatBan.AsNoTracking().AnyAsync(c => c.MemberID == memberID && (c.RoomKey == null || c.RoomKey == roomKey) && (c.ExpiresAt == null || c.ExpiresAt > nowUtc), ct);
- }
- }
|