Update schema and resolver functions

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

View File

@ -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;

View File

@ -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<any> => {
{
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<any> => {
context.user,
organizationSlug,
data,
lrn,
auctionData
);
} catch (err) {
log(err);
@ -223,11 +227,13 @@ export const createResolvers = async (service: Service): Promise<any> => {
{
organizationSlug,
data,
}: { organizationSlug: string; data: DeepPartial<Project> },
lrn,
auctionData
}: { organizationSlug: string; data: DeepPartial<Project>; 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;

View File

@ -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!