From 9931bc74d1c91709d6bddc2fae3f52b28a58a772 Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Fri, 4 Oct 2024 10:24:42 +0530 Subject: [PATCH] Update schema and resolver functions --- packages/backend/src/entity/Project.ts | 9 --------- packages/backend/src/resolvers.ts | 14 ++++++++++---- packages/backend/src/schema.gql | 16 +++++++++++++++- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/packages/backend/src/entity/Project.ts b/packages/backend/src/entity/Project.ts index f7e23402..2aa3cbb4 100644 --- a/packages/backend/src/entity/Project.ts +++ b/packages/backend/src/entity/Project.ts @@ -15,12 +15,6 @@ import { Organization } from './Organization'; import { ProjectMember } from './ProjectMember'; import { Deployment } from './Deployment'; -export interface ApplicationDeploymentAuction { - application: string; - auction: string; - type: string; -} - @Entity() export class Project { @PrimaryGeneratedColumn('uuid') @@ -55,9 +49,6 @@ export class Project { @Column('varchar', { nullable: true }) applicationDeploymentAuctionId?: string | null; - @Column('simple-json', { nullable: true }) - applicationDeploymentAuctionData?: ApplicationDeploymentAuction | null; - @Column('varchar', { nullable: true }) deployerLrn?: string[] | null; diff --git a/packages/backend/src/resolvers.ts b/packages/backend/src/resolvers.ts index 971ee73a..138595ca 100644 --- a/packages/backend/src/resolvers.ts +++ b/packages/backend/src/resolvers.ts @@ -6,7 +6,7 @@ import { Permission } from './entity/ProjectMember'; import { Domain } from './entity/Domain'; import { Project } from './entity/Project'; import { EnvironmentVariable } from './entity/EnvironmentVariable'; -import { AddProjectFromTemplateInput } from './types'; +import { AddProjectFromTemplateInput, AuctionData } from './types'; const log = debug('snowball:resolver'); @@ -203,7 +203,9 @@ export const createResolvers = async (service: Service): Promise => { { organizationSlug, data, - }: { organizationSlug: string; data: AddProjectFromTemplateInput }, + lrn, + auctionData + }: { organizationSlug: string; data: AddProjectFromTemplateInput; lrn: string; auctionData: AuctionData }, context: any, ) => { try { @@ -211,6 +213,8 @@ export const createResolvers = async (service: Service): Promise => { context.user, organizationSlug, data, + lrn, + auctionData ); } catch (err) { log(err); @@ -223,11 +227,13 @@ export const createResolvers = async (service: Service): Promise => { { organizationSlug, data, - }: { organizationSlug: string; data: DeepPartial }, + lrn, + auctionData + }: { organizationSlug: string; data: DeepPartial; lrn: string; auctionData: AuctionData }, context: any, ) => { try { - return await service.addProject(context.user, organizationSlug, data); + return await service.addProject(context.user, organizationSlug, data, lrn, auctionData); } catch (err) { log(err); throw err; diff --git a/packages/backend/src/schema.gql b/packages/backend/src/schema.gql index e7e9d4bd..567fe0d4 100644 --- a/packages/backend/src/schema.gql +++ b/packages/backend/src/schema.gql @@ -65,6 +65,8 @@ type Project { repository: String! prodBranch: String! description: String + lrn: string[] + auctionId: string template: String framework: String webhooks: [String!] @@ -182,6 +184,11 @@ input FilterDomainsInput { status: DomainStatus } +input AuctionData { + maxPrice: string, + numProviders: number, +} + type Query { user: User! organizations: [Organization!] @@ -215,8 +222,15 @@ type Mutation { addProjectFromTemplate( organizationSlug: String! data: AddProjectFromTemplateInput + lrn: string + auctionData: AuctionData + ): Project! + addProject( + organizationSlug: String!, + data: AddProjectInput, + lrn: string, + auctionData: AuctionData ): Project! - addProject(organizationSlug: String!, data: AddProjectInput): Project! updateProject(projectId: String!, data: UpdateProjectInput): Boolean! redeployToProd(deploymentId: String!): Boolean! deleteProject(projectId: String!): Boolean!