Update project entity

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -121,7 +121,7 @@ export const project: Project = {
template: 'Template', template: 'Template',
members: [member], members: [member],
auctionId: '7553538436710373822151221341b43f577e07b0525d083cc9b2de98890138a1', 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'], webhooks: ['beepboop'],
icon: 'Icon', icon: 'Icon',
subDomain: 'SubDomain', subDomain: 'SubDomain',

View File

@ -24,10 +24,6 @@ declare enum AuctionStatus {
AuctionStatusExpired = "expired", AuctionStatusExpired = "expired",
AuctionStatusCompleted = "completed" AuctionStatusCompleted = "completed"
} }
type Fee = {
type: string;
quantity: string;
};
type Bid = { type Bid = {
auctionId: string; auctionId: string;
bidderAddress: string; bidderAddress: string;
@ -153,7 +149,7 @@ type Project = {
description: string; description: string;
template: string; template: string;
framework: string; framework: string;
deployerLrn: string[]; deployerLrns: string[];
auctionId: string; auctionId: string;
webhooks: string[]; webhooks: string[];
members: ProjectMember[]; members: ProjectMember[];
@ -340,4 +336,4 @@ declare class GQLClient {
getAuctionData(auctionId: string): Promise<Auction>; 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", AuctionStatusExpired = "expired",
AuctionStatusCompleted = "completed" AuctionStatusCompleted = "completed"
} }
type Fee = {
type: string;
quantity: string;
};
type Bid = { type Bid = {
auctionId: string; auctionId: string;
bidderAddress: string; bidderAddress: string;
@ -153,7 +149,7 @@ type Project = {
description: string; description: string;
template: string; template: string;
framework: string; framework: string;
deployerLrn: string[]; deployerLrns: string[];
auctionId: string; auctionId: string;
webhooks: string[]; webhooks: string[];
members: ProjectMember[]; members: ProjectMember[];
@ -340,4 +336,4 @@ declare class GQLClient {
getAuctionData(auctionId: string): Promise<Auction>; 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 updatedAt
prodBranch prodBranch
auctionId auctionId
deployerLrn deployerLrns
framework framework
repository repository
webhooks webhooks
@ -127,7 +127,7 @@ query ($organizationSlug: String!) {
description description
framework framework
auctionId auctionId
deployerLrn deployerLrns
prodBranch prodBranch
webhooks webhooks
repository repository
@ -237,7 +237,7 @@ query ($searchText: String!) {
description description
framework framework
auctionId auctionId
deployerLrn deployerLrns
prodBranch prodBranch
webhooks webhooks
updatedAt updatedAt

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

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