protected override async Task <SFProjectEntity> InsertEntityAsync(SFProjectEntity entity) { entity = await base.InsertEntityAsync(entity); if (entity.TranslateConfig.Enabled) { var project = new Project { Id = entity.Id, SourceLanguageTag = entity.TranslateConfig.SourceInputSystem.Tag, TargetLanguageTag = entity.InputSystem.Tag }; await _engineService.AddProjectAsync(project); } var job = new SyncJobEntity() { Id = entity.ActiveSyncJobRef, ProjectRef = entity.Id, OwnerRef = UserId }; await _syncJobManager.StartAsync(job); return(entity); }
protected override async Task <SyncJobEntity> InsertEntityAsync(SyncJobEntity entity) { SyncJobEntity job = await _syncJobManager.StartAsync(entity); if (job != null) { return(job); } throw new JsonApiException(StatusCodes.Status409Conflict, "There is already an active send/receive job for this project."); }