Update project entity

This commit is contained in:
IshaVenikar 2024-10-11 09:28:44 +05:30 committed by Nabarun
parent e45cc45f38
commit bf75dc8acc
15 changed files with 42 additions and 57 deletions

View File

@ -50,7 +50,7 @@ export class Project {
auctionId!: string | null;
@Column({ type: 'simple-array', nullable: true })
deployerLrn!: string[] | null;
deployerLrns!: string[] | null;
// TODO: Compute template & framework in import repository
@Column('varchar', { nullable: true })

View File

@ -473,7 +473,7 @@ export class Registry {
}
async getAuctionData(auctionId: string): Promise<any> {
return this.registry.getAuctionsByIds([auctionId]);;
return this.registry.getAuctionsByIds([auctionId]);
}
getLrn(appName: string): string {

View File

@ -72,7 +72,7 @@ type Project {
repository: String!
prodBranch: String!
description: String
deployerLrn: [String]
deployerLrns: [String]
auctionId: String
template: String
framework: String

View File

@ -165,7 +165,8 @@ export class Service {
async updateDeploymentsWithRecordData(
records: AppDeploymentRecord[],
): Promise<void> {
// Deployments that are completed, not updated(are in building state and ApplicationDeploymentRecord is present)
// Get deployments for ApplicationDeploymentRecords
// Deployments that are completed but not updated(are in building state and ApplicationDeploymentRecord is present)
const deployments = await this.db.getDeployments({
where: records.map((record) => ({
applicationRecordId: record.attributes.application,
@ -205,10 +206,6 @@ export class Service {
const deploymentUpdatePromises = records.map(async (record) => {
const deployment = recordToDeploymentsMap[record.attributes.request];
if(!deployment) {
log('Deployment does not exist')
}
await this.db.updateDeploymentById(deployment.id, {
applicationDeploymentRecordId: record.id,
applicationDeploymentRecordData: record.attributes,
@ -282,6 +279,7 @@ export class Service {
relations: ['deployments'],
});
// Should only check on the first deployment
const projects = allProjects.filter(project => project.deployments.length === 0);
const auctionIds = projects.map((project) => project.auctionId);
@ -297,7 +295,7 @@ export class Service {
// Update project with deployer LRNs
await this.db.updateProjectById(project.id!, {
deployerLrn: deployerLrns
deployerLrns
})
for (const deployer of deployerLrns) {
@ -696,7 +694,7 @@ export class Service {
// Save deployer lrn only if present
if (lrn) {
newDeployment.project.deployerLrn = [lrn];
newDeployment.project.deployerLrns = [lrn];
}
return newDeployment;
@ -974,7 +972,7 @@ export class Service {
branch,
});
const deployers = project.deployerLrn;
const deployers = project.deployerLrns;
if (!deployers) {
return;
}

View File

@ -75,11 +75,11 @@ export interface Auction {
kind: string;
status: string;
ownerAddress: string;
createTime?: Date;
commitsEndTime?: Date;
revealsEndTime?: Date;
commitFee?: string;
revealFee?: string;
createTime: Date;
commitsEndTime: Date;
revealsEndTime: Date;
commitFee: string;
revealFee: string;
minimumBid?: string;
winnerAddresses: string[];
winnerBids?: string[];

View File

@ -28,8 +28,8 @@ export const AuctionCard = ({ project }: { project: Project }) => {
const result = await client.getAuctionData(project.auctionId);
setAuctionStatus(result.status);
setAuctionDetails(result);
setDeployerLrns(project.deployerLrn);
}, [client, project.auctionId, project.deployerLrn]);
setDeployerLrns(project.deployerLrns);
}, [client, project.auctionId, project.deployerLrns]);
useEffect(() => {
if (auctionStatus !== 'completed') {
@ -74,7 +74,7 @@ export const AuctionCard = ({ project }: { project: Project }) => {
</span>
</div>
{project.deployerLrn && (
{project.deployerLrns && (
<div className="mt-3">
<span className="text-elements-high-em text-sm font-medium tracking-tight">Deployer LRNs</span>
{deployerLrns.map((lrn, index) => (

View File

@ -121,7 +121,7 @@ export const project: Project = {
template: 'Template',
members: [member],
auctionId: '7553538436710373822151221341b43f577e07b0525d083cc9b2de98890138a1',
deployerLrn: ['lrn://deepstack-test4/deployers/webapp-deployer-api.test4.wireitin.com', 'lrn://wireitin/deployers/webapp-deployer-api.wireitin.com'],
deployerLrns: ['lrn://deepstack-test4/deployers/webapp-deployer-api.test4.wireitin.com', 'lrn://wireitin/deployers/webapp-deployer-api.wireitin.com'],
webhooks: ['beepboop'],
icon: 'Icon',
subDomain: 'SubDomain',

View File

@ -24,10 +24,6 @@ declare enum AuctionStatus {
AuctionStatusExpired = "expired",
AuctionStatusCompleted = "completed"
}
type Fee = {
type: string;
quantity: string;
};
type Bid = {
auctionId: string;
bidderAddress: string;
@ -153,7 +149,7 @@ type Project = {
description: string;
template: string;
framework: string;
deployerLrn: string[];
deployerLrns: string[];
auctionId: string;
webhooks: string[];
members: ProjectMember[];
@ -340,4 +336,4 @@ declare class GQLClient {
getAuctionData(auctionId: string): Promise<Auction>;
}
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type Auction, type AuctionData, AuctionStatus, type AuthenticateGitHubResponse, type Bid, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type Fee, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User };
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type Auction, type AuctionData, AuctionStatus, type AuthenticateGitHubResponse, type Bid, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User };

View File

@ -24,10 +24,6 @@ declare enum AuctionStatus {
AuctionStatusExpired = "expired",
AuctionStatusCompleted = "completed"
}
type Fee = {
type: string;
quantity: string;
};
type Bid = {
auctionId: string;
bidderAddress: string;
@ -153,7 +149,7 @@ type Project = {
description: string;
template: string;
framework: string;
deployerLrn: string[];
deployerLrns: string[];
auctionId: string;
webhooks: string[];
members: ProjectMember[];
@ -340,4 +336,4 @@ declare class GQLClient {
getAuctionData(auctionId: string): Promise<Auction>;
}
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type Auction, type AuctionData, AuctionStatus, type AuthenticateGitHubResponse, type Bid, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type Fee, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User };
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type Auction, type AuctionData, AuctionStatus, type AuthenticateGitHubResponse, type Bid, type DeleteDeploymentResponse, type DeleteDomainResponse, type DeleteProjectResponse, type Deployment, DeploymentStatus, type Domain, DomainStatus, Environment, type EnvironmentVariable, type FilterDomainInput, GQLClient, type GetDeploymentsResponse, type GetDomainsResponse, type GetEnvironmentVariablesResponse, type GetOrganizationsResponse, type GetProjectMembersResponse, type GetProjectResponse, type GetProjectsInOrganizationResponse, type GetUserResponse, type GraphQLConfig, type Organization, type OrganizationMember, type OrganizationProject, Permission, type Project, type ProjectMember, type RedeployToProdResponse, type RemoveEnvironmentVariableResponse, type RemoveProjectMemberResponse, Role, type RollbackDeploymentResponse, type SearchProjectsResponse, type UnauthenticateGitHubResponse, type UpdateDeploymentToProdResponse, type UpdateDomainInput, type UpdateDomainResponse, type UpdateEnvironmentVariableInput, type UpdateEnvironmentVariableResponse, type UpdateProjectInput, type UpdateProjectMemberInput, type UpdateProjectMemberResponse, type UpdateProjectResponse, type User };

View File

@ -78,7 +78,7 @@ query ($projectId: String!) {
updatedAt
prodBranch
auctionId
deployerLrn
deployerLrns
framework
repository
webhooks
@ -127,7 +127,7 @@ query ($organizationSlug: String!) {
description
framework
auctionId
deployerLrn
deployerLrns
prodBranch
webhooks
repository
@ -237,7 +237,7 @@ query ($searchText: String!) {
description
framework
auctionId
deployerLrn
deployerLrns
prodBranch
webhooks
updatedAt

File diff suppressed because one or more lines are too long

View File

@ -50,7 +50,7 @@ query ($projectId: String!) {
updatedAt
prodBranch
auctionId
deployerLrn
deployerLrns
framework
repository
webhooks
@ -99,7 +99,7 @@ query ($organizationSlug: String!) {
description
framework
auctionId
deployerLrn
deployerLrns
prodBranch
webhooks
repository
@ -209,7 +209,7 @@ query ($searchText: String!) {
description
framework
auctionId
deployerLrn
deployerLrns
prodBranch
webhooks
updatedAt

File diff suppressed because one or more lines are too long

View File

@ -24,7 +24,7 @@ query ($projectId: String!) {
updatedAt
prodBranch
auctionId
deployerLrn
deployerLrns
framework
repository
webhooks
@ -74,7 +74,7 @@ query ($organizationSlug: String!) {
description
framework
auctionId
deployerLrn
deployerLrns
prodBranch
webhooks
repository
@ -189,7 +189,7 @@ query ($searchText: String!) {
description
framework
auctionId
deployerLrn
deployerLrns
prodBranch
webhooks
updatedAt

View File

@ -32,11 +32,6 @@ export enum AuctionStatus {
AuctionStatusCompleted = "completed",
}
export type Fee = {
type: string;
quantity: string;
}
export type Bid = {
auctionId: string;
bidderAddress: string;
@ -173,7 +168,7 @@ export type Project = {
description: string;
template: string;
framework: string;
deployerLrn: string[];
deployerLrns: string[];
auctionId: string;
webhooks: string[];
members: ProjectMember[];