fix: Public API에서 X-Service-Code 의존성 제거 (#90)
All checks were successful
SPMS_API/pipeline/head This commit looks good
All checks were successful
SPMS_API/pipeline/head This commit looks good
Reviewed-on: https://git.ipstein.myds.me/SPMS/SPMS_API/pulls/91
This commit is contained in:
commit
31df012976
|
|
@ -22,11 +22,7 @@ public class AppConfigController : ControllerBase
|
|||
[SwaggerOperation(Summary = "앱 기본 설정", Description = "앱 기본 설정 정보를 조회합니다.")]
|
||||
public async Task<IActionResult> GetAppSettingsAsync()
|
||||
{
|
||||
var serviceCode = Request.Headers["X-Service-Code"].FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(serviceCode))
|
||||
return BadRequest(ApiResponse.Fail(ErrorCodes.BadRequest, "X-Service-Code 헤더가 필요합니다."));
|
||||
|
||||
var result = await _appConfigService.GetAppSettingsAsync(serviceCode);
|
||||
var result = await _appConfigService.GetAppSettingsAsync();
|
||||
return Ok(ApiResponse<AppSettingsResponseDto>.Success(result));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@ public class AppVersionController : ControllerBase
|
|||
[SwaggerOperation(Summary = "앱 버전 체크", Description = "현재 앱 버전 정보를 확인하고 업데이트 필요 여부를 반환합니다.")]
|
||||
public async Task<IActionResult> CheckVersionAsync([FromBody] AppVersionRequestDto request)
|
||||
{
|
||||
var serviceCode = Request.Headers["X-Service-Code"].FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(serviceCode))
|
||||
return BadRequest(ApiResponse.Fail(ErrorCodes.BadRequest, "X-Service-Code 헤더가 필요합니다."));
|
||||
|
||||
var result = await _appConfigService.GetAppVersionAsync(serviceCode, request);
|
||||
var result = await _appConfigService.GetAppVersionAsync(request);
|
||||
return Ok(ApiResponse<AppVersionResponseDto>.Success(result));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@ public class BannerController : ControllerBase
|
|||
[SwaggerOperation(Summary = "배너 목록", Description = "활성화된 배너 목록을 조회합니다. position으로 필터링 가능.")]
|
||||
public async Task<IActionResult> GetListAsync([FromBody] BannerListRequestDto request)
|
||||
{
|
||||
var serviceCode = Request.Headers["X-Service-Code"].FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(serviceCode))
|
||||
return BadRequest(ApiResponse.Fail(ErrorCodes.BadRequest, "X-Service-Code 헤더가 필요합니다."));
|
||||
|
||||
var result = await _bannerService.GetListAsync(serviceCode, request);
|
||||
var result = await _bannerService.GetListAsync(request);
|
||||
return Ok(ApiResponse<BannerListResponseDto>.Success(result));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@ public class FaqController : ControllerBase
|
|||
[SwaggerOperation(Summary = "FAQ 목록", Description = "활성화된 FAQ 목록을 조회합니다. category로 필터링 가능.")]
|
||||
public async Task<IActionResult> GetListAsync([FromBody] FaqListRequestDto request)
|
||||
{
|
||||
var serviceCode = Request.Headers["X-Service-Code"].FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(serviceCode))
|
||||
return BadRequest(ApiResponse.Fail(ErrorCodes.BadRequest, "X-Service-Code 헤더가 필요합니다."));
|
||||
|
||||
var result = await _faqService.GetListAsync(serviceCode, request);
|
||||
var result = await _faqService.GetListAsync(request);
|
||||
return Ok(ApiResponse<FaqListResponseDto>.Success(result));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@ public class NoticeController : ControllerBase
|
|||
[SwaggerOperation(Summary = "공지사항 목록", Description = "활성화된 공지사항 목록을 페이징으로 조회합니다. 상단 고정 우선 정렬.")]
|
||||
public async Task<IActionResult> GetListAsync([FromBody] NoticeListRequestDto request)
|
||||
{
|
||||
var serviceCode = Request.Headers["X-Service-Code"].FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(serviceCode))
|
||||
return BadRequest(ApiResponse.Fail(ErrorCodes.BadRequest, "X-Service-Code 헤더가 필요합니다."));
|
||||
|
||||
var result = await _noticeService.GetListAsync(serviceCode, request);
|
||||
var result = await _noticeService.GetListAsync(request);
|
||||
return Ok(ApiResponse<NoticeListResponseDto>.Success(result));
|
||||
}
|
||||
|
||||
|
|
@ -34,11 +30,7 @@ public class NoticeController : ControllerBase
|
|||
[SwaggerOperation(Summary = "공지사항 상세", Description = "공지사항 ID로 상세 정보를 조회합니다.")]
|
||||
public async Task<IActionResult> GetInfoAsync([FromBody] NoticeInfoRequestDto request)
|
||||
{
|
||||
var serviceCode = Request.Headers["X-Service-Code"].FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(serviceCode))
|
||||
return BadRequest(ApiResponse.Fail(ErrorCodes.BadRequest, "X-Service-Code 헤더가 필요합니다."));
|
||||
|
||||
var result = await _noticeService.GetInfoAsync(serviceCode, request);
|
||||
var result = await _noticeService.GetInfoAsync(request);
|
||||
return Ok(ApiResponse<NoticeInfoResponseDto>.Success(result));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@ public class TermsController : ControllerBase
|
|||
[SwaggerOperation(Summary = "이용약관", Description = "이용약관 URL을 조회합니다.")]
|
||||
public async Task<IActionResult> GetTermsAsync()
|
||||
{
|
||||
var serviceCode = Request.Headers["X-Service-Code"].FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(serviceCode))
|
||||
return BadRequest(ApiResponse.Fail(ErrorCodes.BadRequest, "X-Service-Code 헤더가 필요합니다."));
|
||||
|
||||
var result = await _appConfigService.GetTermsAsync(serviceCode);
|
||||
var result = await _appConfigService.GetTermsAsync();
|
||||
return Ok(ApiResponse<AppConfigResponseDto>.Success(result));
|
||||
}
|
||||
|
||||
|
|
@ -34,11 +30,7 @@ public class TermsController : ControllerBase
|
|||
[SwaggerOperation(Summary = "개인정보처리방침", Description = "개인정보처리방침 URL을 조회합니다.")]
|
||||
public async Task<IActionResult> GetPrivacyAsync()
|
||||
{
|
||||
var serviceCode = Request.Headers["X-Service-Code"].FirstOrDefault();
|
||||
if (string.IsNullOrWhiteSpace(serviceCode))
|
||||
return BadRequest(ApiResponse.Fail(ErrorCodes.BadRequest, "X-Service-Code 헤더가 필요합니다."));
|
||||
|
||||
var result = await _appConfigService.GetPrivacyAsync(serviceCode);
|
||||
var result = await _appConfigService.GetPrivacyAsync();
|
||||
return Ok(ApiResponse<AppConfigResponseDto>.Success(result));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ namespace SPMS.Application.Interfaces;
|
|||
|
||||
public interface IAppConfigService
|
||||
{
|
||||
Task<AppConfigResponseDto> GetTermsAsync(string serviceCode);
|
||||
Task<AppConfigResponseDto> GetPrivacyAsync(string serviceCode);
|
||||
Task<AppVersionResponseDto> GetAppVersionAsync(string serviceCode, AppVersionRequestDto request);
|
||||
Task<AppSettingsResponseDto> GetAppSettingsAsync(string serviceCode);
|
||||
Task<AppConfigResponseDto> GetTermsAsync();
|
||||
Task<AppConfigResponseDto> GetPrivacyAsync();
|
||||
Task<AppVersionResponseDto> GetAppVersionAsync(AppVersionRequestDto request);
|
||||
Task<AppSettingsResponseDto> GetAppSettingsAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ namespace SPMS.Application.Interfaces;
|
|||
|
||||
public interface IBannerService
|
||||
{
|
||||
Task<BannerListResponseDto> GetListAsync(string serviceCode, BannerListRequestDto request);
|
||||
Task<BannerListResponseDto> GetListAsync(BannerListRequestDto request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ namespace SPMS.Application.Interfaces;
|
|||
|
||||
public interface IFaqService
|
||||
{
|
||||
Task<FaqListResponseDto> GetListAsync(string serviceCode, FaqListRequestDto request);
|
||||
Task<FaqListResponseDto> GetListAsync(FaqListRequestDto request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ namespace SPMS.Application.Interfaces;
|
|||
|
||||
public interface INoticeService
|
||||
{
|
||||
Task<NoticeListResponseDto> GetListAsync(string serviceCode, NoticeListRequestDto request);
|
||||
Task<NoticeInfoResponseDto> GetInfoAsync(string serviceCode, NoticeInfoRequestDto request);
|
||||
Task<NoticeListResponseDto> GetListAsync(NoticeListRequestDto request);
|
||||
Task<NoticeInfoResponseDto> GetInfoAsync(NoticeInfoRequestDto request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
using SPMS.Application.DTOs.AppConfig;
|
||||
using SPMS.Application.Interfaces;
|
||||
using SPMS.Domain.Common;
|
||||
using SPMS.Domain.Exceptions;
|
||||
using SPMS.Domain.Interfaces;
|
||||
|
||||
namespace SPMS.Application.Services;
|
||||
|
|
@ -9,36 +7,32 @@ namespace SPMS.Application.Services;
|
|||
public class AppConfigService : IAppConfigService
|
||||
{
|
||||
private readonly IAppConfigRepository _appConfigRepository;
|
||||
private readonly IServiceRepository _serviceRepository;
|
||||
|
||||
public AppConfigService(IAppConfigRepository appConfigRepository, IServiceRepository serviceRepository)
|
||||
public AppConfigService(IAppConfigRepository appConfigRepository)
|
||||
{
|
||||
_appConfigRepository = appConfigRepository;
|
||||
_serviceRepository = serviceRepository;
|
||||
}
|
||||
|
||||
public async Task<AppConfigResponseDto> GetTermsAsync(string serviceCode)
|
||||
public async Task<AppConfigResponseDto> GetTermsAsync()
|
||||
{
|
||||
return await GetConfigUrlAsync(serviceCode, "terms_url");
|
||||
var config = await _appConfigRepository.GetByKeyAsync("terms_url");
|
||||
return new AppConfigResponseDto { Url = config?.ConfigValue };
|
||||
}
|
||||
|
||||
public async Task<AppConfigResponseDto> GetPrivacyAsync(string serviceCode)
|
||||
public async Task<AppConfigResponseDto> GetPrivacyAsync()
|
||||
{
|
||||
return await GetConfigUrlAsync(serviceCode, "privacy_url");
|
||||
var config = await _appConfigRepository.GetByKeyAsync("privacy_url");
|
||||
return new AppConfigResponseDto { Url = config?.ConfigValue };
|
||||
}
|
||||
|
||||
public async Task<AppVersionResponseDto> GetAppVersionAsync(string serviceCode, AppVersionRequestDto request)
|
||||
public async Task<AppVersionResponseDto> GetAppVersionAsync(AppVersionRequestDto request)
|
||||
{
|
||||
var service = await _serviceRepository.GetByServiceCodeAsync(serviceCode);
|
||||
if (service == null)
|
||||
throw new SpmsException(ErrorCodes.NotFound, "존재하지 않는 서비스입니다.", 404);
|
||||
|
||||
var latestVersion = await _appConfigRepository.GetByKeyAsync(service.Id, "latest_version");
|
||||
var minVersion = await _appConfigRepository.GetByKeyAsync(service.Id, "min_version");
|
||||
var forceUpdate = await _appConfigRepository.GetByKeyAsync(service.Id, "force_update");
|
||||
var latestVersion = await _appConfigRepository.GetByKeyAsync("latest_version");
|
||||
var minVersion = await _appConfigRepository.GetByKeyAsync("min_version");
|
||||
var forceUpdate = await _appConfigRepository.GetByKeyAsync("force_update");
|
||||
|
||||
var updateUrlKey = request.Platform?.ToLowerInvariant() == "ios" ? "update_url_ios" : "update_url_android";
|
||||
var updateUrl = await _appConfigRepository.GetByKeyAsync(service.Id, updateUrlKey);
|
||||
var updateUrl = await _appConfigRepository.GetByKeyAsync(updateUrlKey);
|
||||
|
||||
return new AppVersionResponseDto
|
||||
{
|
||||
|
|
@ -49,13 +43,9 @@ public class AppConfigService : IAppConfigService
|
|||
};
|
||||
}
|
||||
|
||||
public async Task<AppSettingsResponseDto> GetAppSettingsAsync(string serviceCode)
|
||||
public async Task<AppSettingsResponseDto> GetAppSettingsAsync()
|
||||
{
|
||||
var service = await _serviceRepository.GetByServiceCodeAsync(serviceCode);
|
||||
if (service == null)
|
||||
throw new SpmsException(ErrorCodes.NotFound, "존재하지 않는 서비스입니다.", 404);
|
||||
|
||||
var configs = await _appConfigRepository.GetAllByServiceAsync(service.Id);
|
||||
var configs = await _appConfigRepository.GetAllAsync();
|
||||
var configDict = configs.ToDictionary(c => c.ConfigKey, c => c.ConfigValue);
|
||||
|
||||
return new AppSettingsResponseDto
|
||||
|
|
@ -67,18 +57,4 @@ public class AppConfigService : IAppConfigService
|
|||
CsPhone = configDict.GetValueOrDefault("cs_phone")
|
||||
};
|
||||
}
|
||||
|
||||
private async Task<AppConfigResponseDto> GetConfigUrlAsync(string serviceCode, string configKey)
|
||||
{
|
||||
var service = await _serviceRepository.GetByServiceCodeAsync(serviceCode);
|
||||
if (service == null)
|
||||
throw new SpmsException(ErrorCodes.NotFound, "존재하지 않는 서비스입니다.", 404);
|
||||
|
||||
var config = await _appConfigRepository.GetByKeyAsync(service.Id, configKey);
|
||||
|
||||
return new AppConfigResponseDto
|
||||
{
|
||||
Url = config?.ConfigValue
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
using SPMS.Application.DTOs.Banner;
|
||||
using SPMS.Application.Interfaces;
|
||||
using SPMS.Domain.Common;
|
||||
using SPMS.Domain.Exceptions;
|
||||
using SPMS.Domain.Interfaces;
|
||||
|
||||
namespace SPMS.Application.Services;
|
||||
|
|
@ -9,21 +7,15 @@ namespace SPMS.Application.Services;
|
|||
public class BannerService : IBannerService
|
||||
{
|
||||
private readonly IBannerRepository _bannerRepository;
|
||||
private readonly IServiceRepository _serviceRepository;
|
||||
|
||||
public BannerService(IBannerRepository bannerRepository, IServiceRepository serviceRepository)
|
||||
public BannerService(IBannerRepository bannerRepository)
|
||||
{
|
||||
_bannerRepository = bannerRepository;
|
||||
_serviceRepository = serviceRepository;
|
||||
}
|
||||
|
||||
public async Task<BannerListResponseDto> GetListAsync(string serviceCode, BannerListRequestDto request)
|
||||
public async Task<BannerListResponseDto> GetListAsync(BannerListRequestDto request)
|
||||
{
|
||||
var service = await _serviceRepository.GetByServiceCodeAsync(serviceCode);
|
||||
if (service == null)
|
||||
throw new SpmsException(ErrorCodes.NotFound, "존재하지 않는 서비스입니다.", 404);
|
||||
|
||||
var items = await _bannerRepository.GetActiveListAsync(service.Id, request.Position);
|
||||
var items = await _bannerRepository.GetActiveListAsync(request.Position);
|
||||
|
||||
return new BannerListResponseDto
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
using SPMS.Application.DTOs.Faq;
|
||||
using SPMS.Application.Interfaces;
|
||||
using SPMS.Domain.Common;
|
||||
using SPMS.Domain.Exceptions;
|
||||
using SPMS.Domain.Interfaces;
|
||||
|
||||
namespace SPMS.Application.Services;
|
||||
|
|
@ -9,21 +7,15 @@ namespace SPMS.Application.Services;
|
|||
public class FaqService : IFaqService
|
||||
{
|
||||
private readonly IFaqRepository _faqRepository;
|
||||
private readonly IServiceRepository _serviceRepository;
|
||||
|
||||
public FaqService(IFaqRepository faqRepository, IServiceRepository serviceRepository)
|
||||
public FaqService(IFaqRepository faqRepository)
|
||||
{
|
||||
_faqRepository = faqRepository;
|
||||
_serviceRepository = serviceRepository;
|
||||
}
|
||||
|
||||
public async Task<FaqListResponseDto> GetListAsync(string serviceCode, FaqListRequestDto request)
|
||||
public async Task<FaqListResponseDto> GetListAsync(FaqListRequestDto request)
|
||||
{
|
||||
var service = await _serviceRepository.GetByServiceCodeAsync(serviceCode);
|
||||
if (service == null)
|
||||
throw new SpmsException(ErrorCodes.NotFound, "존재하지 않는 서비스입니다.", 404);
|
||||
|
||||
var items = await _faqRepository.GetActiveListAsync(service.Id, request.Category);
|
||||
var items = await _faqRepository.GetActiveListAsync(request.Category);
|
||||
|
||||
return new FaqListResponseDto
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,21 +9,15 @@ namespace SPMS.Application.Services;
|
|||
public class NoticeService : INoticeService
|
||||
{
|
||||
private readonly INoticeRepository _noticeRepository;
|
||||
private readonly IServiceRepository _serviceRepository;
|
||||
|
||||
public NoticeService(INoticeRepository noticeRepository, IServiceRepository serviceRepository)
|
||||
public NoticeService(INoticeRepository noticeRepository)
|
||||
{
|
||||
_noticeRepository = noticeRepository;
|
||||
_serviceRepository = serviceRepository;
|
||||
}
|
||||
|
||||
public async Task<NoticeListResponseDto> GetListAsync(string serviceCode, NoticeListRequestDto request)
|
||||
public async Task<NoticeListResponseDto> GetListAsync(NoticeListRequestDto request)
|
||||
{
|
||||
var service = await _serviceRepository.GetByServiceCodeAsync(serviceCode);
|
||||
if (service == null)
|
||||
throw new SpmsException(ErrorCodes.NotFound, "존재하지 않는 서비스입니다.", 404);
|
||||
|
||||
var (items, totalCount) = await _noticeRepository.GetActivePagedAsync(service.Id, request.Page, request.Size);
|
||||
var (items, totalCount) = await _noticeRepository.GetActivePagedAsync(request.Page, request.Size);
|
||||
|
||||
var totalPages = (int)Math.Ceiling((double)totalCount / request.Size);
|
||||
|
||||
|
|
@ -46,13 +40,9 @@ public class NoticeService : INoticeService
|
|||
};
|
||||
}
|
||||
|
||||
public async Task<NoticeInfoResponseDto> GetInfoAsync(string serviceCode, NoticeInfoRequestDto request)
|
||||
public async Task<NoticeInfoResponseDto> GetInfoAsync(NoticeInfoRequestDto request)
|
||||
{
|
||||
var service = await _serviceRepository.GetByServiceCodeAsync(serviceCode);
|
||||
if (service == null)
|
||||
throw new SpmsException(ErrorCodes.NotFound, "존재하지 않는 서비스입니다.", 404);
|
||||
|
||||
var notice = await _noticeRepository.GetActiveByIdAsync(request.NoticeId, service.Id);
|
||||
var notice = await _noticeRepository.GetActiveByIdAsync(request.NoticeId);
|
||||
if (notice == null)
|
||||
throw new SpmsException(ErrorCodes.NotFound, "존재하지 않는 공지사항입니다.", 404);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,5 @@ namespace SPMS.Domain.Interfaces;
|
|||
|
||||
public interface IAppConfigRepository : IRepository<AppConfig>
|
||||
{
|
||||
Task<AppConfig?> GetByKeyAsync(long serviceId, string configKey);
|
||||
Task<IReadOnlyList<AppConfig>> GetAllByServiceAsync(long serviceId);
|
||||
Task<AppConfig?> GetByKeyAsync(string configKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ namespace SPMS.Domain.Interfaces;
|
|||
|
||||
public interface IBannerRepository : IRepository<Banner>
|
||||
{
|
||||
Task<IReadOnlyList<Banner>> GetActiveListAsync(long serviceId, string? position = null);
|
||||
Task<IReadOnlyList<Banner>> GetActiveListAsync(string? position = null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ namespace SPMS.Domain.Interfaces;
|
|||
|
||||
public interface IFaqRepository : IRepository<Faq>
|
||||
{
|
||||
Task<IReadOnlyList<Faq>> GetActiveListAsync(long serviceId, string? category = null);
|
||||
Task<IReadOnlyList<Faq>> GetActiveListAsync(string? category = null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ namespace SPMS.Domain.Interfaces;
|
|||
|
||||
public interface INoticeRepository : IRepository<Notice>
|
||||
{
|
||||
Task<(IReadOnlyList<Notice> Items, int TotalCount)> GetActivePagedAsync(long serviceId, int page, int size);
|
||||
Task<Notice?> GetActiveByIdAsync(long id, long serviceId);
|
||||
Task<(IReadOnlyList<Notice> Items, int TotalCount)> GetActivePagedAsync(int page, int size);
|
||||
Task<Notice?> GetActiveByIdAsync(long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,8 @@ public class AppConfigRepository : Repository<AppConfig>, IAppConfigRepository
|
|||
{
|
||||
public AppConfigRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<AppConfig?> GetByKeyAsync(long serviceId, string configKey)
|
||||
public async Task<AppConfig?> GetByKeyAsync(string configKey)
|
||||
{
|
||||
return await _dbSet.FirstOrDefaultAsync(c => c.ServiceId == serviceId && c.ConfigKey == configKey);
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<AppConfig>> GetAllByServiceAsync(long serviceId)
|
||||
{
|
||||
return await _dbSet.Where(c => c.ServiceId == serviceId).ToListAsync();
|
||||
return await _dbSet.FirstOrDefaultAsync(c => c.ConfigKey == configKey);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ public class BannerRepository : Repository<Banner>, IBannerRepository
|
|||
{
|
||||
public BannerRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IReadOnlyList<Banner>> GetActiveListAsync(long serviceId, string? position = null)
|
||||
public async Task<IReadOnlyList<Banner>> GetActiveListAsync(string? position = null)
|
||||
{
|
||||
var query = _dbSet.Where(b => b.ServiceId == serviceId && b.IsActive);
|
||||
var query = _dbSet.Where(b => b.IsActive);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(position))
|
||||
query = query.Where(b => b.Position == position);
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ public class FaqRepository : Repository<Faq>, IFaqRepository
|
|||
{
|
||||
public FaqRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IReadOnlyList<Faq>> GetActiveListAsync(long serviceId, string? category = null)
|
||||
public async Task<IReadOnlyList<Faq>> GetActiveListAsync(string? category = null)
|
||||
{
|
||||
var query = _dbSet.Where(f => f.ServiceId == serviceId && f.IsActive);
|
||||
var query = _dbSet.Where(f => f.IsActive);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(category))
|
||||
query = query.Where(f => f.Category == category);
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ public class NoticeRepository : Repository<Notice>, INoticeRepository
|
|||
{
|
||||
public NoticeRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<(IReadOnlyList<Notice> Items, int TotalCount)> GetActivePagedAsync(long serviceId, int page, int size)
|
||||
public async Task<(IReadOnlyList<Notice> Items, int TotalCount)> GetActivePagedAsync(int page, int size)
|
||||
{
|
||||
var query = _dbSet.Where(n => n.ServiceId == serviceId && n.IsActive);
|
||||
var query = _dbSet.Where(n => n.IsActive);
|
||||
|
||||
var totalCount = await query.CountAsync();
|
||||
|
||||
|
|
@ -24,8 +24,8 @@ public class NoticeRepository : Repository<Notice>, INoticeRepository
|
|||
return (items, totalCount);
|
||||
}
|
||||
|
||||
public async Task<Notice?> GetActiveByIdAsync(long id, long serviceId)
|
||||
public async Task<Notice?> GetActiveByIdAsync(long id)
|
||||
{
|
||||
return await _dbSet.FirstOrDefaultAsync(n => n.Id == id && n.ServiceId == serviceId && n.IsActive);
|
||||
return await _dbSet.FirstOrDefaultAsync(n => n.Id == id && n.IsActive);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user