Update schema and resolver functions

This commit is contained in:
IshaVenikar 2024-10-04 10:24:42 +05:30 committed by Nabarun
parent e5d9278b00
commit c7bc4295ab
3 changed files with 25 additions and 14 deletions

View File

@ -15,12 +15,6 @@ import { Organization } from './Organization';
import { ProjectMember } from './ProjectMember'; import { ProjectMember } from './ProjectMember';
import { Deployment } from './Deployment'; import { Deployment } from './Deployment';
export interface ApplicationDeploymentAuction {
application: string;
auction: string;
type: string;
}
@Entity() @Entity()
export class Project { export class Project {
@PrimaryGeneratedColumn('uuid') @PrimaryGeneratedColumn('uuid')
@ -55,9 +49,6 @@ export class Project {
@Column('varchar', { nullable: true }) @Column('varchar', { nullable: true })
applicationDeploymentAuctionId?: string | null; applicationDeploymentAuctionId?: string | null;
@Column('simple-json', { nullable: true })
applicationDeploymentAuctionData?: ApplicationDeploymentAuction | null;
@Column('varchar', { nullable: true }) @Column('varchar', { nullable: true })
deployerLrn?: string[] | null; deployerLrn?: string[] | null;

View File

@ -6,7 +6,7 @@ import { Permission } from './entity/ProjectMember';
import { Domain } from './entity/Domain'; import { Domain } from './entity/Domain';
import { Project } from './entity/Project'; import { Project } from './entity/Project';
import { EnvironmentVariable } from './entity/EnvironmentVariable'; import { EnvironmentVariable } from './entity/EnvironmentVariable';
import { AddProjectFromTemplateInput } from './types'; import { AddProjectFromTemplateInput, AuctionData } from './types';
const log = debug('snowball:resolver'); const log = debug('snowball:resolver');
@ -203,7 +203,9 @@ export const createResolvers = async (service: Service): Promise<any> => {
{ {
organizationSlug, organizationSlug,
data, data,
}: { organizationSlug: string; data: AddProjectFromTemplateInput }, lrn,
auctionData
}: { organizationSlug: string; data: AddProjectFromTemplateInput; lrn: string; auctionData: AuctionData },
context: any, context: any,
) => { ) => {
try { try {
@ -211,6 +213,8 @@ export const createResolvers = async (service: Service): Promise<any> => {
context.user, context.user,
organizationSlug, organizationSlug,
data, data,
lrn,
auctionData
); );
} catch (err) { } catch (err) {
log(err); log(err);
@ -223,11 +227,13 @@ export const createResolvers = async (service: Service): Promise<any> => {
{ {
organizationSlug, organizationSlug,
data, data,
}: { organizationSlug: string; data: DeepPartial<Project> }, lrn,
auctionData
}: { organizationSlug: string; data: DeepPartial<Project>; lrn: string; auctionData: AuctionData },
context: any, context: any,
) => { ) => {
try { try {
return await service.addProject(context.user, organizationSlug, data); return await service.addProject(context.user, organizationSlug, data, lrn, auctionData);
} catch (err) { } catch (err) {
log(err); log(err);
throw err; throw err;

View File

@ -65,6 +65,8 @@ type Project {
repository: String! repository: String!
prodBranch: String! prodBranch: String!
description: String description: String
lrn: string[]
auctionId: string
template: String template: String
framework: String framework: String
webhooks: [String!] webhooks: [String!]
@ -182,6 +184,11 @@ input FilterDomainsInput {
status: DomainStatus status: DomainStatus
} }
input AuctionData {
maxPrice: string,
numProviders: number,
}
type Query { type Query {
user: User! user: User!
organizations: [Organization!] organizations: [Organization!]
@ -215,8 +222,15 @@ type Mutation {
addProjectFromTemplate( addProjectFromTemplate(
organizationSlug: String! organizationSlug: String!
data: AddProjectFromTemplateInput data: AddProjectFromTemplateInput
lrn: string
auctionData: AuctionData
): Project!
addProject(
organizationSlug: String!,
data: AddProjectInput,
lrn: string,
auctionData: AuctionData
): Project! ): Project!
addProject(organizationSlug: String!, data: AddProjectInput): Project!
updateProject(projectId: String!, data: UpdateProjectInput): Boolean! updateProject(projectId: String!, data: UpdateProjectInput): Boolean!
redeployToProd(deploymentId: String!): Boolean! redeployToProd(deploymentId: String!): Boolean!
deleteProject(projectId: String!): Boolean! deleteProject(projectId: String!): Boolean!