public async Task <CreateStepArtifactResponse> Post(CreateStepArtifactRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } if (await stepRepository.DoesStepArtifactExist(request.BatchId, request.StepName, request.ArtifactName)) { throw Err.StepArtifactAlreadyExists(request.ArtifactName); } var stepArtifact = request.ConvertTo <StepArtifact>(); stepArtifact.StepId = step.Id; await stepRepository.CreateStepArtifact(stepArtifact); return(new CreateStepArtifactResponse()); }
public async Task <DeleteStepArtifactOptionResponse> Delete(DeleteStepArtifactOptionRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var existingStepArtifact = await stepRepository.GetStepArtifact(step.Id, request.ArtifactName); if (existingStepArtifact == null) { throw Err.StepArtifactNotFound(request.ArtifactName); } var existingStepArtifactOption = await stepRepository.GetStepArtifactOption(existingStepArtifact.Id, request.OptionName); if (existingStepArtifactOption == null) { throw Err.StepArtifactOptionNotFound(request.OptionName); } await stepRepository.DeleteStepArtifactOption(existingStepArtifactOption.Id); return(new DeleteStepArtifactOptionResponse()); }
public async Task <GetAllStepArtifactOptionResponse> Get(GetAllStepArtifactOptionRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var existingStepArtifact = await stepRepository.GetStepArtifact(step.Id, request.ArtifactName); if (existingStepArtifact == null) { throw Err.StepArtifactNotFound(request.ArtifactName); } var response = new GetAllStepArtifactOptionResponse { Options = existingStepArtifact.Options.ConvertTo <List <DomainModels.Option> >() }; return(response); }
public async Task <DeleteCommandVariableResponse> Delete(DeleteCommandVariableRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var command = await commandRepository.Get(step.Id, request.CommandName); if (command == null) { throw Err.CommandNotFound(request.CommandName); } var existingCommandVariable = await commandRepository.GetCommandVariable(command.Id, request.VariableName); if (existingCommandVariable == null) { throw Err.CommandVariableNotFound(request.VariableName); } await commandRepository.DeleteCommandVariable(existingCommandVariable.Id); return(new DeleteCommandVariableResponse()); }
public async Task <UpdateStepArtifactResponse> Put(UpdateStepArtifactRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var existingStepArtifact = await stepRepository.GetStepArtifact(step.Id, request.ArtifactName); if (existingStepArtifact == null) { throw Err.StepArtifactNotFound(request.ArtifactName); } var stepArtifact = request.ConvertTo <StepArtifact>(); stepArtifact.StepId = step.Id; stepArtifact.Id = existingStepArtifact.Id; await stepRepository.UpdateStepArtifact(stepArtifact); return(new UpdateStepArtifactResponse()); }
public async Task <UpdateCommandResponse> Put(UpdateCommandRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var command = request.ConvertTo <Core.Entities.Command>(); command.StepId = step.Id; var updated = await commandRepository.Update(command); if (!updated) { throw Err.CommandNotFound(request.CommandName); } return(new UpdateCommandResponse()); }
public async Task <UpdateStepVariableResponse> Put(UpdateStepVariableRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var existingStepVariable = await stepRepository.GetStepVariable(step.Id, request.VariableName); if (existingStepVariable == null) { throw Err.StepVariableNotFound(request.VariableName); } var stepVariable = request.ConvertTo <StepVariable>(); stepVariable.Id = existingStepVariable.Id; stepVariable.StepId = step.Id; await stepRepository.CreateOrUpdateStepVariable(stepVariable); return(new UpdateStepVariableResponse()); }
public async Task <CreateCommandVariableResponse> Post(CreateCommandVariableRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var command = await commandRepository.Get(step.Id, request.CommandName); if (command == null) { throw Err.CommandNotFound(request.CommandName); } if (await commandRepository.DoesCommandVariableExist(request.BatchId, request.StepName, request.CommandName, request.VariableName)) { throw Err.CommandVariableAlreadyExists(request.VariableName); } var commandVariable = request.ConvertTo <CommandVariable>(); commandVariable.CommandId = command.Id; await commandRepository.CreateOrUpdateCommandVariable(commandVariable); return(new CreateCommandVariableResponse()); }
public async Task <CreateCommandResponse> Post(CreateCommandRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } if (await commandRepository.DoesCommandExist(request.BatchId, request.StepName, request.CommandName)) { throw Err.CommandAlreadyExists(request.CommandName); } var command = request.ConvertTo <Core.Entities.Command>(); command.StepId = step.Id; await commandRepository.Create(command); return(new CreateCommandResponse()); }
public async Task <UpdateBatchArtifactOptionResponse> Put(UpdateBatchArtifactOptionRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var batchArtifact = await batchRepository.GetBatchArtifact(request.BatchId, request.ArtifactName); if (batchArtifact == null) { throw Err.BatchArtifactNotFound(request.ArtifactName); } var existingBatchArtifactOption = await batchRepository.GetBatchArtifactOption(batchArtifact.Id, request.OptionName); if (existingBatchArtifactOption == null) { throw Err.BatchArtifactOptionNotFound(request.OptionName); } var batchArtifactOption = request.ConvertTo <BatchArtifactOption>(); batchArtifactOption.Id = existingBatchArtifactOption.Id; batchArtifactOption.BatchArtifactId = batchArtifact.Id; await batchRepository.CreateOrUpdateBatchArtifactOption(batchArtifactOption); return(new UpdateBatchArtifactOptionResponse()); }
public async Task <GetCommandVariableResponse> Get(GetCommandVariableRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var command = await commandRepository.Get(step.Id, request.CommandName); if (command == null) { throw Err.CommandNotFound(request.CommandName); } var commandVariable = await commandRepository.GetCommandVariable(command.Id, request.VariableName); if (commandVariable == null) { throw Err.CommandVariableNotFound(request.VariableName); } return(commandVariable.ConvertTo <GetCommandVariableResponse>()); }
public async Task <CreateStepArtifactOptionResponse> Post(CreateStepArtifactOptionRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var existingStepArtifact = await stepRepository.GetStepArtifact(step.Id, request.ArtifactName); if (existingStepArtifact == null) { throw Err.StepArtifactNotFound(request.ArtifactName); } if (await stepRepository.DoesStepArtifactOptionExist(request.BatchId, request.StepName, request.ArtifactName, request.OptionName)) { throw Err.StepArtifactOptionAlreadyExists(request.OptionName); } var stepArtifactOption = request.ConvertTo <StepArtifactOption>(); stepArtifactOption.StepArtifactId = existingStepArtifact.Id; await stepRepository.CreateOrUpdateStepArtifactOption(stepArtifactOption); return(new CreateStepArtifactOptionResponse()); }
public async Task <GetAllCommandVariableResponse> Get(GetAllCommandVariableRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var command = await commandRepository.Get(step.Id, request.CommandName); if (command == null) { throw Err.CommandNotFound(request.CommandName); } var response = new GetAllCommandVariableResponse { Variables = command.Variables.ConvertTo <List <DomainModels.Variable> >() }; return(response); }
public async Task <DeleteBatchResponse> Delete(DeleteBatchRequest request) { var deleted = await batchRepository.Delete(request.BatchId); if (!deleted) { throw Err.BatchNotFound(request.BatchId); } return(new DeleteBatchResponse()); }
public async Task <GetBatchResponse> Get(GetBatchRequest request) { var batch = await batchRepository.Get(request.BatchId); if (batch == null) { throw Err.BatchNotFound(request.BatchId); } return(batch.ConvertTo <GetBatchResponse>()); }
public async Task <UpdateBatchResponse> Put(UpdateBatchRequest request) { var batch = request.ConvertTo <Batch>(); var updated = await batchRepository.Update(batch); if (!updated) { throw Err.BatchNotFound(request.BatchId); } return(new UpdateBatchResponse()); }
public async Task <GetAllStepsResponse> Get(GetAllStepsRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var steps = await stepRepository.GetAll(request.BatchId); return(new GetAllStepsResponse { Steps = steps.ConvertTo <List <DomainModels.Step> >() }); }
public async Task <GetBatchVariableResponse> Get(GetBatchVariableRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var batchVariable = await batchRepository.GetBatchVariable(request.BatchId, request.VariableName); if (batchVariable == null) { throw Err.BatchVariableNotFound(request.VariableName); } return(batchVariable.ConvertTo <GetBatchVariableResponse>()); }
public async Task <GetBatchArtifactResponse> Get(GetBatchArtifactRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var batchArtifact = await batchRepository.GetBatchArtifact(request.BatchId, request.ArtifactName); if (batchArtifact == null) { throw Err.BatchArtifactNotFound(request.ArtifactName); } return(batchArtifact.ConvertTo <GetBatchArtifactResponse>()); }
public async Task <GetStepResponse> Get(GetStepRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } return(step.ConvertTo <GetStepResponse>()); }
public async Task <GetAllBatchOptionResponse> Get(GetAllBatchOptionRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var batchOptions = await batchRepository.GetAllBatchOptions(request.BatchId); var response = new GetAllBatchOptionResponse { Options = batchOptions.ConvertTo <List <DomainModels.Option> >() }; return(response); }
public async Task <GetBatchOptionResponse> Get(GetBatchOptionRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var batchOption = await batchRepository.GetBatchOption(request.BatchId, request.OptionName); if (batchOption == null) { throw Err.BatchOptionNotFound(request.OptionName); } return(batchOption.ConvertTo <GetBatchOptionResponse>()); }
public async Task <CreateBatchArtifactResponse> Post(CreateBatchArtifactRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } if (await batchRepository.DoesBatchArtifactExist(request.BatchId, request.ArtifactName)) { throw Err.BatchArtifactAlreadyExists(request.ArtifactName); } var batchArtifact = request.ConvertTo <BatchArtifact>(); await batchRepository.CreateBatchArtifact(batchArtifact); return(new CreateBatchArtifactResponse()); }
public async Task <CreateStepResponse> Post(CreateStepRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } if (await stepRepository.DoesStepExist(request.BatchId, request.StepName)) { throw Err.StepAlreadyExists(request.StepName); } var step = request.ConvertTo <Step>(); await stepRepository.Create(step); return(new CreateStepResponse()); }
public async Task <UpdateStepResponse> Put(UpdateStepRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = request.ConvertTo <Step>(); var updated = await stepRepository.Update(step); if (!updated) { throw Err.StepNotFound(request.StepName); } return(new UpdateStepResponse()); }
public async Task <DeleteStepResponse> Delete(DeleteStepRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } await stepRepository.Delete(step.Id); return(new DeleteStepResponse()); }
public async Task <CreateBatchVariableResponse> Post(CreateBatchVariableRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } if (await batchRepository.DoesBatchVariableExist(request.BatchId, request.VariableName)) { throw Err.BatchVariableAlreadyExists(request.VariableName); } var batchVariable = request.ConvertTo <BatchVariable>(); await batchRepository.CreateOrUpdateBatchVariable(batchVariable); return(new CreateBatchVariableResponse()); }
public async Task <CreateBatchOptionResponse> Post(CreateBatchOptionRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } if (await batchRepository.DoesBatchOptionExist(request.BatchId, request.OptionName)) { throw Err.BatchOptionAlreadyExists(request.OptionName); } var batchOption = request.ConvertTo <BatchOption>(); await batchRepository.CreateOrUpdateBatchOption(batchOption); return(new CreateBatchOptionResponse()); }
public async Task <DeleteBatchOptionResponse> Delete(DeleteBatchOptionRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var existingBatchOption = await batchRepository.GetBatchOption(request.BatchId, request.OptionName); if (existingBatchOption == null) { throw Err.BatchOptionNotFound(request.OptionName); } await batchRepository.DeleteBatchOption(existingBatchOption.Id); return(new DeleteBatchOptionResponse()); }
public async Task <DeleteBatchVariableResponse> Delete(DeleteBatchVariableRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var existingBatchVariable = await batchRepository.GetBatchVariable(request.BatchId, request.VariableName); if (existingBatchVariable == null) { throw Err.BatchVariableNotFound(request.VariableName); } await batchRepository.DeleteBatchVariable(existingBatchVariable.Id); return(new DeleteBatchVariableResponse()); }