public async Task <IActionResult> DeleteHistory([FromRoute] long id, [FromRoute] long?dataId, [FromServices] IPreprocessHistoryRepository preprocessHistoryRepository, [FromServices] IPreprocessLogic preprocessLogic) { if (dataId == null) { return(JsonBadRequest("Data ID is requried.")); } //データの存在チェック var preprocessHistory = await preprocessHistoryRepository.GetPreprocessIncludeDataAndPreprocessAsync(id, dataId.Value); if (preprocessHistory == null) { return(JsonNotFound($"Preprocessing History about Preprocess {id} to Data {dataId} is not found.")); } //出力データを削除できるか、確認 var lockedOutput = preprocessHistoryRepository.GetLockedOutput(preprocessHistory.Id); if (lockedOutput != null) { return(JsonConflict($"Preprocessing History about Preprocess {id} to Data {dataId} can NOT delete. The output data {lockedOutput.Id} is locked.")); } //前処理履歴の削除 bool result = await preprocessLogic.DeleteAsync(preprocessHistory, false); if (result) { return(JsonNoContent()); } else { return(JsonError(HttpStatusCode.ServiceUnavailable, $"Failed to delete Preprocessing History about Preprocess {id} to Data {dataId}. Please contact your server administrator.")); } }
/// <summary> /// コンストラクタ /// </summary> public PreprocessingController( IPreprocessRepository preprocessRepository, IPreprocessHistoryRepository preprocessHistoryRepository, ITenantRepository tenantRepository, IDataRepository dataRepository, IPreprocessLogic preprocessLogic, ITagLogic tagLogic, IGitLogic gitLogic, IStorageLogic storageLogic, IClusterManagementLogic clusterManagementLogic, IUnitOfWork unitOfWork, IHttpContextAccessor accessor) : base(accessor) { this.preprocessRepository = preprocessRepository; this.preprocessHistoryRepository = preprocessHistoryRepository; this.tenantRepository = tenantRepository; this.dataRepository = dataRepository; this.preprocessLogic = preprocessLogic; this.tagLogic = tagLogic; this.gitLogic = gitLogic; this.storageLogic = storageLogic; this.clusterManagementLogic = clusterManagementLogic; this.unitOfWork = unitOfWork; }