public async Task <DeployPackageResponse> Handle(string projectId, int packageId, DeployPackageRequest request) { var deployedPackage = await _dbContext.Packages .Include(package => package.Project) .Include(package => package.DeploymentProcess) .FindByIdAndProjectId( packageId: packageId, projectId: projectId ); var deployment = await _deploymentFactory.Create( projectId : projectId, environmentId : request.EnvironmentId, packageId : packageId ); _dbContext.Deployments.Add(deployment); // todo: [rt] think if this double SaveChanges is a good solution await _dbContext.SaveChangesAsync(); // todo: [rt] it looks like the deployment could run asynchronously _runDeployment.Run( project: deployedPackage.Project, package: deployedPackage, deployment: deployment, deploymentProcess: deployedPackage.DeploymentProcess ); await _dbContext.SaveChangesAsync(); return(new DeployPackageResponse { CreatedDeploymentId = deployment.Id }); }
public async Task <DeployPackageResponse> DeployPackage(string projectId, int componentId, int packageId, DeployPackageRequest request) { return(await _deployPackageHandler.Handle(projectId, packageId, request)); }