SPMS_API/SPMS.Domain/Interfaces/IDeviceRepository.cs
SEAN 4db27aaf8a improvement: 태그 삭제 시 디바이스 orphan 참조 제거 (#186)
- IDeviceRepository에 GetDevicesByTagIdAsync 메서드 추가
- DeviceRepository에 LIKE 기반 태그 참조 디바이스 조회 구현
- TagService.DeleteAsync에서 트랜잭션으로 원자적 처리:
  디바이스 Tags JSON에서 삭제 대상 tagId 제거 후 태그 삭제
2026-02-26 09:12:41 +09:00

25 lines
1.1 KiB
C#

using SPMS.Domain.Entities;
using SPMS.Domain.Enums;
namespace SPMS.Domain.Interfaces;
public interface IDeviceRepository : IRepository<Device>
{
Task<Device?> GetByServiceAndTokenAsync(long serviceId, string deviceToken);
Task<Device?> GetByIdAndServiceAsync(long id, long serviceId);
Task<int> GetActiveCountByServiceAsync(long serviceId);
Task<IReadOnlyList<Device>> GetByPlatformAsync(long serviceId, Platform platform);
Task<(IReadOnlyList<Device> Items, int TotalCount)> GetPagedAsync(
long? serviceId, int page, int size,
Platform? platform = null, bool? pushAgreed = null,
bool? isActive = null, List<int>? tags = null,
string? keyword = null, bool? marketingAgreed = null);
Task<IReadOnlyList<Device>> GetAllFilteredAsync(
long? serviceId,
Platform? platform = null, bool? pushAgreed = null,
bool? isActive = null, List<int>? tags = null,
string? keyword = null, bool? marketingAgreed = null);
Task<Dictionary<long, int>> GetDeviceCountsByTagIdsAsync(IEnumerable<long> tagIds);
Task<IReadOnlyList<Device>> GetDevicesByTagIdAsync(long tagId);
}