2024-07-04 11:02:45 +05:00
|
|
|
using AsbCloudApp.Data;
|
2022-09-05 09:13:45 +05:00
|
|
|
using AsbCloudApp.Services;
|
|
|
|
using AsbCloudDb.Model;
|
|
|
|
using AsbCloudInfrastructure.Repository;
|
2022-11-17 16:09:51 +05:00
|
|
|
using Microsoft.Extensions.Caching.Memory;
|
2022-09-05 09:13:45 +05:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
namespace AsbCloudInfrastructure.Services;
|
|
|
|
|
|
|
|
|
|
|
|
public class FileCategoryService : CrudCacheRepositoryBase<FileCategoryDto, FileCategory>, IFileCategoryService
|
2022-09-05 09:13:45 +05:00
|
|
|
{
|
2024-08-19 10:01:07 +05:00
|
|
|
public FileCategoryService(IAsbCloudDbContext context, IMemoryCache memoryCache)
|
|
|
|
: base(context, memoryCache) { }
|
2023-04-18 16:22:53 +05:00
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
//TODO: Перенести в сервис "дело скважины"
|
|
|
|
public async Task<IEnumerable<FileCategoryDto>> GetWellCaseCategoriesAsync(CancellationToken token)
|
2022-09-05 09:13:45 +05:00
|
|
|
{
|
2024-08-19 10:01:07 +05:00
|
|
|
var cache = await GetCacheAsync(token)
|
|
|
|
.ConfigureAwait(false);
|
|
|
|
var dtos = cache
|
|
|
|
.Where(f => f.Id >= 10000)
|
|
|
|
.Where(f => f.Id <= 20000)
|
|
|
|
.Select(Convert);
|
2022-11-16 17:07:47 +05:00
|
|
|
|
2024-08-19 10:01:07 +05:00
|
|
|
return dtos;
|
2022-09-05 09:13:45 +05:00
|
|
|
}
|
|
|
|
}
|