Update methods in gql client

This commit is contained in:
IshaVenikar 2024-10-04 10:36:59 +05:30 committed by Nabarun
parent 9931bc74d1
commit ee9bf2de1c
13 changed files with 88 additions and 40 deletions

View File

@ -47,7 +47,7 @@ export class Project {
description!: string;
@Column('varchar', { nullable: true })
applicationDeploymentAuctionId?: string | null;
auctionId?: string | null;
@Column('varchar', { nullable: true })
deployerLrn?: string[] | null;

View File

@ -65,8 +65,8 @@ type Project {
repository: String!
prodBranch: String!
description: String
lrn: string[]
auctionId: string
deployerLrn: [String]
auctionId: String
template: String
framework: String
webhooks: [String!]
@ -185,8 +185,8 @@ input FilterDomainsInput {
}
input AuctionData {
maxPrice: string,
numProviders: number,
maxPrice: String,
numProviders: Int,
}
type Query {
@ -222,13 +222,13 @@ type Mutation {
addProjectFromTemplate(
organizationSlug: String!
data: AddProjectFromTemplateInput
lrn: string
lrn: [String]
auctionData: AuctionData
): Project!
addProject(
organizationSlug: String!,
data: AddProjectInput,
lrn: string,
organizationSlug: String!
data: AddProjectInput
lrn: [String]
auctionData: AuctionData
): Project!
updateProject(projectId: String!, data: UpdateProjectInput): Boolean!

View File

@ -785,6 +785,7 @@ export class Service {
user: User,
organizationSlug: string,
data: AddProjectFromTemplateInput,
lrn?: string,
auctionData?: AuctionData
): Promise<Project | undefined> {
try {
@ -816,7 +817,7 @@ export class Service {
repository: gitRepo.data.full_name,
// TODO: Set selected template
template: 'webapp',
}, '', auctionData);
}, lrn, auctionData);
if (!project || !project.id) {
throw new Error('Failed to create project from template');

View File

@ -255,6 +255,10 @@ type AuthenticateGitHubResponse = {
type UnauthenticateGitHubResponse = {
unauthenticateGitHub: boolean;
};
type AuctionData = {
maxPrice: string;
numProviders: number;
};
interface GraphQLConfig {
gqlEndpoint: string;
@ -277,8 +281,8 @@ declare class GQLClient {
updateEnvironmentVariable(environmentVariableId: string, data: UpdateEnvironmentVariableInput): Promise<UpdateEnvironmentVariableResponse>;
removeEnvironmentVariable(environmentVariableId: string): Promise<RemoveEnvironmentVariableResponse>;
updateDeploymentToProd(deploymentId: string): Promise<UpdateDeploymentToProdResponse>;
addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput): Promise<AddProjectFromTemplateResponse>;
addProject(organizationSlug: string, data: AddProjectInput): Promise<AddProjectResponse>;
addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectFromTemplateResponse>;
addProject(organizationSlug: string, data: AddProjectInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectResponse>;
updateProject(projectId: string, data: UpdateProjectInput): Promise<UpdateProjectResponse>;
updateDomain(domainId: string, data: UpdateDomainInput): Promise<UpdateDomainResponse>;
redeployToProd(deploymentId: string): Promise<RedeployToProdResponse>;
@ -292,4 +296,4 @@ declare class GQLClient {
unauthenticateGithub(): Promise<UnauthenticateGitHubResponse>;
}
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type AuthenticateGitHubResponse, 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 };
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type AuctionData, type AuthenticateGitHubResponse, 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

@ -255,6 +255,10 @@ type AuthenticateGitHubResponse = {
type UnauthenticateGitHubResponse = {
unauthenticateGitHub: boolean;
};
type AuctionData = {
maxPrice: string;
numProviders: number;
};
interface GraphQLConfig {
gqlEndpoint: string;
@ -277,8 +281,8 @@ declare class GQLClient {
updateEnvironmentVariable(environmentVariableId: string, data: UpdateEnvironmentVariableInput): Promise<UpdateEnvironmentVariableResponse>;
removeEnvironmentVariable(environmentVariableId: string): Promise<RemoveEnvironmentVariableResponse>;
updateDeploymentToProd(deploymentId: string): Promise<UpdateDeploymentToProdResponse>;
addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput): Promise<AddProjectFromTemplateResponse>;
addProject(organizationSlug: string, data: AddProjectInput): Promise<AddProjectResponse>;
addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectFromTemplateResponse>;
addProject(organizationSlug: string, data: AddProjectInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectResponse>;
updateProject(projectId: string, data: UpdateProjectInput): Promise<UpdateProjectResponse>;
updateDomain(domainId: string, data: UpdateDomainInput): Promise<UpdateDomainResponse>;
redeployToProd(deploymentId: string): Promise<RedeployToProdResponse>;
@ -292,4 +296,4 @@ declare class GQLClient {
unauthenticateGithub(): Promise<UnauthenticateGitHubResponse>;
}
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type AuthenticateGitHubResponse, 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 };
export { type AddDomainInput, type AddDomainResponse, type AddEnvironmentVariableInput, type AddEnvironmentVariablesResponse, type AddProjectFromTemplateInput, type AddProjectFromTemplateResponse, type AddProjectInput, type AddProjectMemberInput, type AddProjectMemberResponse, type AddProjectResponse, type AuctionData, type AuthenticateGitHubResponse, 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

@ -76,6 +76,8 @@ query ($projectId: String!) {
template
updatedAt
prodBranch
auctionId
deployerLrn
framework
repository
webhooks
@ -123,6 +125,8 @@ query ($organizationSlug: String!) {
createdAt
description
framework
auctionId
deployerLrn
prodBranch
webhooks
repository
@ -230,6 +234,8 @@ query ($searchText: String!) {
createdAt
description
framework
auctionId
deployerLrn
prodBranch
webhooks
updatedAt
@ -308,15 +314,15 @@ var updateDeploymentToProd = import_client2.gql`
}
`;
var addProjectFromTemplate = import_client2.gql`
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data) {
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput, $lrn: string, $auctionData: Auctiondata) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
id
}
}
`;
var addProject = import_client2.gql`
mutation ($organizationSlug: String!, $data: AddProjectInput) {
addProject(organizationSlug: $organizationSlug, data: $data) {
mutation ($organizationSlug: String!, $data: AddProjectInput, $lrn: string, $auctionData: Auctiondata) {
addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
id
}
}
@ -557,25 +563,29 @@ var GQLClient = class {
return data;
});
}
addProjectFromTemplate(organizationSlug, data) {
addProjectFromTemplate(organizationSlug, data, lrn, auctionData) {
return __async(this, null, function* () {
const result = yield this.client.mutate({
mutation: addProjectFromTemplate,
variables: {
organizationSlug,
data
data,
lrn,
auctionData
}
});
return result.data;
});
}
addProject(organizationSlug, data) {
addProject(organizationSlug, data, lrn, auctionData) {
return __async(this, null, function* () {
const result = yield this.client.mutate({
mutation: addProject,
variables: {
organizationSlug,
data
data,
lrn,
auctionData
}
});
return result.data;

File diff suppressed because one or more lines are too long

View File

@ -49,6 +49,8 @@ query ($projectId: String!) {
template
updatedAt
prodBranch
auctionId
deployerLrn
framework
repository
webhooks
@ -96,6 +98,8 @@ query ($organizationSlug: String!) {
createdAt
description
framework
auctionId
deployerLrn
prodBranch
webhooks
repository
@ -203,6 +207,8 @@ query ($searchText: String!) {
createdAt
description
framework
auctionId
deployerLrn
prodBranch
webhooks
updatedAt
@ -281,15 +287,15 @@ var updateDeploymentToProd = gql2`
}
`;
var addProjectFromTemplate = gql2`
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data) {
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput, $lrn: string, $auctionData: Auctiondata) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
id
}
}
`;
var addProject = gql2`
mutation ($organizationSlug: String!, $data: AddProjectInput) {
addProject(organizationSlug: $organizationSlug, data: $data) {
mutation ($organizationSlug: String!, $data: AddProjectInput, $lrn: string, $auctionData: Auctiondata) {
addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
id
}
}
@ -530,25 +536,29 @@ var GQLClient = class {
return data;
});
}
addProjectFromTemplate(organizationSlug, data) {
addProjectFromTemplate(organizationSlug, data, lrn, auctionData) {
return __async(this, null, function* () {
const result = yield this.client.mutate({
mutation: addProjectFromTemplate,
variables: {
organizationSlug,
data
data,
lrn,
auctionData
}
});
return result.data;
});
}
addProject(organizationSlug, data) {
addProject(organizationSlug, data, lrn, auctionData) {
return __async(this, null, function* () {
const result = yield this.client.mutate({
mutation: addProject,
variables: {
organizationSlug,
data
data,
lrn,
auctionData
}
});
return result.data;

File diff suppressed because one or more lines are too long

View File

@ -230,13 +230,17 @@ export class GQLClient {
async addProjectFromTemplate(
organizationSlug: string,
data: types.AddProjectFromTemplateInput
data: types.AddProjectFromTemplateInput,
lrn?: string,
auctionData?: types.AuctionData,
): Promise<types.AddProjectFromTemplateResponse> {
const result = await this.client.mutate({
mutation: mutations.addProjectFromTemplate,
variables: {
organizationSlug,
data,
lrn,
auctionData
},
});
@ -245,13 +249,17 @@ export class GQLClient {
async addProject(
organizationSlug: string,
data: types.AddProjectInput
data: types.AddProjectInput,
lrn?: string,
auctionData?: types.AuctionData,
): Promise<types.AddProjectResponse> {
const result = await this.client.mutate({
mutation: mutations.addProject,
variables: {
organizationSlug,
data,
lrn,
auctionData
},
});

View File

@ -49,16 +49,16 @@ export const updateDeploymentToProd = gql`
`;
export const addProjectFromTemplate = gql`
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data) {
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput, $lrn: string, $auctionData: Auctiondata) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
id
}
}
`;
export const addProject = gql`
mutation ($organizationSlug: String!, $data: AddProjectInput) {
addProject(organizationSlug: $organizationSlug, data: $data) {
mutation ($organizationSlug: String!, $data: AddProjectInput, $lrn: string, $auctionData: Auctiondata) {
addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
id
}
}

View File

@ -23,6 +23,8 @@ query ($projectId: String!) {
template
updatedAt
prodBranch
auctionId
deployerLrn
framework
repository
webhooks
@ -71,6 +73,8 @@ query ($organizationSlug: String!) {
createdAt
description
framework
auctionId
deployerLrn
prodBranch
webhooks
repository
@ -183,6 +187,8 @@ query ($searchText: String!) {
createdAt
description
framework
auctionId
deployerLrn
prodBranch
webhooks
updatedAt

View File

@ -309,3 +309,8 @@ export type AuthenticateGitHubResponse = {
export type UnauthenticateGitHubResponse = {
unauthenticateGitHub: boolean;
};
export type AuctionData = {
maxPrice: string;
numProviders: number;
};