public CreateFileInfoCommandHandler(
     IFileInfoRepository fileInfoRepository,
     ILogger <CreateFileInfoCommandHandler> logger)
 {
     _fileInfoRepository = fileInfoRepository ?? throw new ArgumentNullException(nameof(fileInfoRepository));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
예제 #2
0
 public FileService(
     IFileInfoRepository fileInfoRepository,
     IFileRepository fileRepository)
 {
     _fileInfoRepository = fileInfoRepository;
     _fileRepository     = fileRepository;
 }
예제 #3
0
 public FileItemService(
     IFileInfoRepository repository,
     ICommandBus commandBus,
     ILogger <FileItemService> logger
     ) : base(repository, commandBus, logger)
 {
 }
예제 #4
0
 public FileService(
     MerchantSettings merchantSettings,
     IFileInfoRepository fileInfoRepository,
     IFileRepository fileRepository)
 {
     _fileRepository     = fileRepository;
     _merchantSettings   = merchantSettings;
     _fileInfoRepository = fileInfoRepository;
 }
예제 #5
0
 public FileInfoStore(
     IFileInfoRepository <FileInfo> fileInfoRepository,
     ILogger <FileInfoStore> logger,
     ICacheManager cacheManager)
 {
     _fileInfoRepository = fileInfoRepository;
     _cacheManager       = cacheManager;
     _logger             = logger;
 }
예제 #6
0
 public FileService(IFileRepository fileRepository,
                    IFileInfoRepository fileInfoRepository,
                    ILogFactory logFactory)
 {
     _fileRepository = fileRepository ??
                       throw new ArgumentNullException(nameof(fileRepository));
     _fileInfoRepository = fileInfoRepository ??
                           throw new ArgumentNullException(nameof(fileInfoRepository));
     _log = logFactory.CreateLog(this);
 }
예제 #7
0
 public StreamingController(
     IFileInfoRepository fileInfoRepository,
     IMediator mediator,
     ILogger <StreamingController> logger,
     IOptionsSnapshot <StreamingSettings> streamingSettings)
 {
     _fileInfoRepository = fileInfoRepository ?? throw new ArgumentNullException(nameof(fileInfoRepository));
     _mediator           = mediator ?? throw new ArgumentNullException(nameof(mediator));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
     _streamingSettings  = streamingSettings ?? throw new ArgumentNullException(nameof(streamingSettings));
 }
예제 #8
0
        /// <summary>
        /// 按类别清理文件
        /// </summary>
        /// <param name="tag">文件类别</param>
        /// <param name="repository"></param>
        /// <returns></returns>
        private async Task CleanFilesWithTagAsync(FileTag tag, IFileInfoRepository repository)
        {
            List <Domain.AggregatesModel.FileInfoAggregate.FileInfo> notUsedFileInfos;

            switch (tag)
            {
            case FileTag.App:
            case FileTag.AppOriginal:
            case FileTag.AppThumbnail:
                notUsedFileInfos = await repository.GetNotUsedAppImagesAsync(tag);

                break;

            case FileTag.AppVideo:
                notUsedFileInfos = await repository.GetNotUsedAppVideosAsync(tag);

                break;

            case FileTag.Chat:
            case FileTag.ChatThumbnail:
            case FileTag.ChatVideo:
                // 删除早于距当前时间超过任务执行间隔的聊天文件
                var oldestTime = DateTime.UtcNow.AddHours(-_chatCleanSettings.IntervalHours);
                notUsedFileInfos = await repository.GetAllChatFileInfosAsync(oldestTime);

                break;

            default:
                return;
            }

            notUsedFileInfos.ForEach(fi =>
            {
                var delResult = false;

                // 由于聊天文件是统一删除,因此如果类别是聊天中的任意一种,则删除所有聊天文件
                // app内文件按传入类别删除
                if (tag == FileTag.Chat || tag == FileTag.ChatThumbnail || tag == FileTag.ChatVideo)
                {
                    delResult = DeleteFile(fi.Name, FileTag.Chat) && DeleteFile(fi.Name, FileTag.ChatThumbnail) && DeleteFile(fi.Name, FileTag.ChatVideo);
                }
                else
                {
                    delResult = DeleteFile(fi.Name, tag);
                }

                // 如果删除文件成功则删除数据库数据
                if (delResult)
                {
                    repository.Remove(fi);
                }
            });
        }
예제 #9
0
        public FileInfoRepositoryTests()
        {
            RepositoryContext = GetNewContext();
            Repository        = new FileInfoRepository(RepositoryContext, null);

            using (var setupContext = new FileInfoContext(ContextOptions))
            {
                setupContext.RemoveRange(setupContext.FilesInfo.ToList());
                setupContext.Add(_sampleList[0]);
                setupContext.SaveChanges();
            }
        }
예제 #10
0
 public ImageController(IImageRepository imageRepository, IMapper mapper, ITagRepository tagRepository, IImageTagRepository imagetagRepository, IUserRepository userRepository, IContentCollectionRepository contentCollectionRepository, IFileInfoRepository fileInfoRepository,
                        IImageColorRepository imageColorRepository,
                        IColorRepository colorRepository)
 {
     _imageRepository             = imageRepository;
     _mapper                      = mapper;
     _tagRepository               = tagRepository;
     _imagetagRepository          = imagetagRepository;
     _userRepository              = userRepository;
     _contentCollectionRepository = contentCollectionRepository;
     _fileInfoRepository          = fileInfoRepository;
     _imageColorRepository        = imageColorRepository;
     _colorRepository             = colorRepository;
 }
예제 #11
0
 public InvoiceService(
     IInvoiceRepository invoiceRepository,
     IFileInfoRepository fileInfoRepository,
     IFileRepository fileRepository,
     ILykkePayServiceClient lykkePayServiceClient,
     ICallbackUrlFormatter callbackUrlFormatter,
     ILog log)
 {
     _invoiceRepository     = invoiceRepository;
     _fileInfoRepository    = fileInfoRepository;
     _fileRepository        = fileRepository;
     _lykkePayServiceClient = lykkePayServiceClient;
     _callbackUrlFormatter  = callbackUrlFormatter;
     _log = log;
 }
예제 #12
0
 public QuestionController(IExpertQuestion expertQuestionService,
                           IFileInfoRepository fileInfoRepositoryService,
                           IExpertQuestionReply expertQuestionReplyService,
                           IExpertPermission expertPermissionService,
                           IUser userService,
                           INotification notificationService,
                           IUser_Role userRoleRelationService
                           )
 {
     _expertQuestionService      = expertQuestionService;
     _fileInfoRepository         = fileInfoRepositoryService;
     _expertQuestionReplyService = expertQuestionReplyService;
     _expertPermissionService    = expertPermissionService;
     _userService             = userService;
     _notificationService     = notificationService;
     _userRoleRelationService = userRoleRelationService;
 }
예제 #13
0
 public VerificationController(IPermissionProvider permissionManage,
                               IRoleVerification roleVerificationRepository,
                               IAdminUser adminUserRepository,
                               IFarmerVerficationInfoRepository farmerVerificationRepository,
                               IOperatorInfoVerifciationRepository machineryOperatorVerificationRepository,
                               IBusinessVerificationRepository businessVerificationRepository,
                               IArea areaRepository,
                               IFileInfoRepository fileInfoRepository,
                               ISys_Dictionary sysDictionaryRespository,
                               ISuppliers_Sarea suppliers_SareaRespository, IUser user)
     : base(permissionManage, adminUserRepository)
 {
     this.suppliers_SareaRespository              = suppliers_SareaRespository;
     this.roleVerificationRepository              = roleVerificationRepository;
     this.adminUserRepository                     = adminUserRepository;
     this.farmerVerificationRepository            = farmerVerificationRepository;
     this.machineryOperatorVerificationRepository = machineryOperatorVerificationRepository;
     this.businessVerificationRepository          = businessVerificationRepository;
     this.areaRepository           = areaRepository;
     this.fileInfoRepository       = fileInfoRepository;
     this.sysDictionaryRespository = sysDictionaryRespository;
 }