Integrate SP auctions for app deployment #2

Merged
nabarun merged 42 commits from ng-integrate-auction into main 2024-10-18 12:37:01 +00:00
Showing only changes of commit e45cc45f38 - Show all commits

View File

@ -1,6 +1,6 @@
import assert from 'assert';
import debug from 'debug';
import { DeepPartial, FindOptionsWhere, IsNull } from 'typeorm';
import { DeepPartial, FindOptionsWhere, IsNull, Not } from 'typeorm';
import { Octokit, RequestError } from 'octokit';
import { OAuthApp } from '@octokit/oauth-app';
@ -275,14 +275,15 @@ export class Service {
* Calls the createDeploymentFromAuction method for deployments with completed auctions
*/
async checkAuctionStatus(): Promise<void> {
const projects = await this.db.getProjects({
const allProjects = await this.db.getProjects({
where: {
deployments: {
applicationDeploymentRequestId: IsNull()
}
auctionId: Not(IsNull()),
},
relations: ['deployments'],
});
const projects = allProjects.filter(project => project.deployments.length === 0);
const auctionIds = projects.map((project) => project.auctionId);
const completedAuctionIds = await this.registry.getCompletedAuctionIds(auctionIds);
@ -298,6 +299,7 @@ export class Service {
await this.db.updateProjectById(project.id!, {
deployerLrn: deployerLrns
})
for (const deployer of deployerLrns) {
await this.createDeploymentFromAuction(project, deployer);
}