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; description!: string;
@Column('varchar', { nullable: true }) @Column('varchar', { nullable: true })
applicationDeploymentAuctionId?: string | null; auctionId?: string | null;
@Column('varchar', { nullable: true }) @Column('varchar', { nullable: true })
deployerLrn?: string[] | null; deployerLrn?: string[] | null;

View File

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

View File

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

View File

@ -255,6 +255,10 @@ type AuthenticateGitHubResponse = {
type UnauthenticateGitHubResponse = { type UnauthenticateGitHubResponse = {
unauthenticateGitHub: boolean; unauthenticateGitHub: boolean;
}; };
type AuctionData = {
maxPrice: string;
numProviders: number;
};
interface GraphQLConfig { interface GraphQLConfig {
gqlEndpoint: string; gqlEndpoint: string;
@ -277,8 +281,8 @@ declare class GQLClient {
updateEnvironmentVariable(environmentVariableId: string, data: UpdateEnvironmentVariableInput): Promise<UpdateEnvironmentVariableResponse>; updateEnvironmentVariable(environmentVariableId: string, data: UpdateEnvironmentVariableInput): Promise<UpdateEnvironmentVariableResponse>;
removeEnvironmentVariable(environmentVariableId: string): Promise<RemoveEnvironmentVariableResponse>; removeEnvironmentVariable(environmentVariableId: string): Promise<RemoveEnvironmentVariableResponse>;
updateDeploymentToProd(deploymentId: string): Promise<UpdateDeploymentToProdResponse>; updateDeploymentToProd(deploymentId: string): Promise<UpdateDeploymentToProdResponse>;
addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput): Promise<AddProjectFromTemplateResponse>; addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectFromTemplateResponse>;
addProject(organizationSlug: string, data: AddProjectInput): Promise<AddProjectResponse>; addProject(organizationSlug: string, data: AddProjectInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectResponse>;
updateProject(projectId: string, data: UpdateProjectInput): Promise<UpdateProjectResponse>; updateProject(projectId: string, data: UpdateProjectInput): Promise<UpdateProjectResponse>;
updateDomain(domainId: string, data: UpdateDomainInput): Promise<UpdateDomainResponse>; updateDomain(domainId: string, data: UpdateDomainInput): Promise<UpdateDomainResponse>;
redeployToProd(deploymentId: string): Promise<RedeployToProdResponse>; redeployToProd(deploymentId: string): Promise<RedeployToProdResponse>;
@ -292,4 +296,4 @@ declare class GQLClient {
unauthenticateGithub(): Promise<UnauthenticateGitHubResponse>; 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 = { type UnauthenticateGitHubResponse = {
unauthenticateGitHub: boolean; unauthenticateGitHub: boolean;
}; };
type AuctionData = {
maxPrice: string;
numProviders: number;
};
interface GraphQLConfig { interface GraphQLConfig {
gqlEndpoint: string; gqlEndpoint: string;
@ -277,8 +281,8 @@ declare class GQLClient {
updateEnvironmentVariable(environmentVariableId: string, data: UpdateEnvironmentVariableInput): Promise<UpdateEnvironmentVariableResponse>; updateEnvironmentVariable(environmentVariableId: string, data: UpdateEnvironmentVariableInput): Promise<UpdateEnvironmentVariableResponse>;
removeEnvironmentVariable(environmentVariableId: string): Promise<RemoveEnvironmentVariableResponse>; removeEnvironmentVariable(environmentVariableId: string): Promise<RemoveEnvironmentVariableResponse>;
updateDeploymentToProd(deploymentId: string): Promise<UpdateDeploymentToProdResponse>; updateDeploymentToProd(deploymentId: string): Promise<UpdateDeploymentToProdResponse>;
addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput): Promise<AddProjectFromTemplateResponse>; addProjectFromTemplate(organizationSlug: string, data: AddProjectFromTemplateInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectFromTemplateResponse>;
addProject(organizationSlug: string, data: AddProjectInput): Promise<AddProjectResponse>; addProject(organizationSlug: string, data: AddProjectInput, lrn?: string, auctionData?: AuctionData): Promise<AddProjectResponse>;
updateProject(projectId: string, data: UpdateProjectInput): Promise<UpdateProjectResponse>; updateProject(projectId: string, data: UpdateProjectInput): Promise<UpdateProjectResponse>;
updateDomain(domainId: string, data: UpdateDomainInput): Promise<UpdateDomainResponse>; updateDomain(domainId: string, data: UpdateDomainInput): Promise<UpdateDomainResponse>;
redeployToProd(deploymentId: string): Promise<RedeployToProdResponse>; redeployToProd(deploymentId: string): Promise<RedeployToProdResponse>;
@ -292,4 +296,4 @@ declare class GQLClient {
unauthenticateGithub(): Promise<UnauthenticateGitHubResponse>; 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 template
updatedAt updatedAt
prodBranch prodBranch
auctionId
deployerLrn
framework framework
repository repository
webhooks webhooks
@ -123,6 +125,8 @@ query ($organizationSlug: String!) {
createdAt createdAt
description description
framework framework
auctionId
deployerLrn
prodBranch prodBranch
webhooks webhooks
repository repository
@ -230,6 +234,8 @@ query ($searchText: String!) {
createdAt createdAt
description description
framework framework
auctionId
deployerLrn
prodBranch prodBranch
webhooks webhooks
updatedAt updatedAt
@ -308,15 +314,15 @@ var updateDeploymentToProd = import_client2.gql`
} }
`; `;
var addProjectFromTemplate = import_client2.gql` var addProjectFromTemplate = import_client2.gql`
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput) { mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput, $lrn: string, $auctionData: Auctiondata) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data) { addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
id id
} }
} }
`; `;
var addProject = import_client2.gql` var addProject = import_client2.gql`
mutation ($organizationSlug: String!, $data: AddProjectInput) { mutation ($organizationSlug: String!, $data: AddProjectInput, $lrn: string, $auctionData: Auctiondata) {
addProject(organizationSlug: $organizationSlug, data: $data) { addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
id id
} }
} }
@ -557,25 +563,29 @@ var GQLClient = class {
return data; return data;
}); });
} }
addProjectFromTemplate(organizationSlug, data) { addProjectFromTemplate(organizationSlug, data, lrn, auctionData) {
return __async(this, null, function* () { return __async(this, null, function* () {
const result = yield this.client.mutate({ const result = yield this.client.mutate({
mutation: addProjectFromTemplate, mutation: addProjectFromTemplate,
variables: { variables: {
organizationSlug, organizationSlug,
data data,
lrn,
auctionData
} }
}); });
return result.data; return result.data;
}); });
} }
addProject(organizationSlug, data) { addProject(organizationSlug, data, lrn, auctionData) {
return __async(this, null, function* () { return __async(this, null, function* () {
const result = yield this.client.mutate({ const result = yield this.client.mutate({
mutation: addProject, mutation: addProject,
variables: { variables: {
organizationSlug, organizationSlug,
data data,
lrn,
auctionData
} }
}); });
return result.data; return result.data;

File diff suppressed because one or more lines are too long

View File

@ -49,6 +49,8 @@ query ($projectId: String!) {
template template
updatedAt updatedAt
prodBranch prodBranch
auctionId
deployerLrn
framework framework
repository repository
webhooks webhooks
@ -96,6 +98,8 @@ query ($organizationSlug: String!) {
createdAt createdAt
description description
framework framework
auctionId
deployerLrn
prodBranch prodBranch
webhooks webhooks
repository repository
@ -203,6 +207,8 @@ query ($searchText: String!) {
createdAt createdAt
description description
framework framework
auctionId
deployerLrn
prodBranch prodBranch
webhooks webhooks
updatedAt updatedAt
@ -281,15 +287,15 @@ var updateDeploymentToProd = gql2`
} }
`; `;
var addProjectFromTemplate = gql2` var addProjectFromTemplate = gql2`
mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput) { mutation ($organizationSlug: String!, $data: AddProjectFromTemplateInput, $lrn: string, $auctionData: Auctiondata) {
addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data) { addProjectFromTemplate(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
id id
} }
} }
`; `;
var addProject = gql2` var addProject = gql2`
mutation ($organizationSlug: String!, $data: AddProjectInput) { mutation ($organizationSlug: String!, $data: AddProjectInput, $lrn: string, $auctionData: Auctiondata) {
addProject(organizationSlug: $organizationSlug, data: $data) { addProject(organizationSlug: $organizationSlug, data: $data, lrn: $lrn, auctionData: $auctionData) {
id id
} }
} }
@ -530,25 +536,29 @@ var GQLClient = class {
return data; return data;
}); });
} }
addProjectFromTemplate(organizationSlug, data) { addProjectFromTemplate(organizationSlug, data, lrn, auctionData) {
return __async(this, null, function* () { return __async(this, null, function* () {
const result = yield this.client.mutate({ const result = yield this.client.mutate({
mutation: addProjectFromTemplate, mutation: addProjectFromTemplate,
variables: { variables: {
organizationSlug, organizationSlug,
data data,
lrn,
auctionData
} }
}); });
return result.data; return result.data;
}); });
} }
addProject(organizationSlug, data) { addProject(organizationSlug, data, lrn, auctionData) {
return __async(this, null, function* () { return __async(this, null, function* () {
const result = yield this.client.mutate({ const result = yield this.client.mutate({
mutation: addProject, mutation: addProject,
variables: { variables: {
organizationSlug, organizationSlug,
data data,
lrn,
auctionData
} }
}); });
return result.data; 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( async addProjectFromTemplate(
organizationSlug: string, organizationSlug: string,
data: types.AddProjectFromTemplateInput data: types.AddProjectFromTemplateInput,
lrn?: string,
auctionData?: types.AuctionData,
): Promise<types.AddProjectFromTemplateResponse> { ): Promise<types.AddProjectFromTemplateResponse> {
const result = await this.client.mutate({ const result = await this.client.mutate({
mutation: mutations.addProjectFromTemplate, mutation: mutations.addProjectFromTemplate,
variables: { variables: {
organizationSlug, organizationSlug,
data, data,
lrn,
auctionData
}, },
}); });
@ -245,13 +249,17 @@ export class GQLClient {
async addProject( async addProject(
organizationSlug: string, organizationSlug: string,
data: types.AddProjectInput data: types.AddProjectInput,
lrn?: string,
auctionData?: types.AuctionData,
): Promise<types.AddProjectResponse> { ): Promise<types.AddProjectResponse> {
const result = await this.client.mutate({ const result = await this.client.mutate({
mutation: mutations.addProject, mutation: mutations.addProject,
variables: { variables: {
organizationSlug, organizationSlug,
data, data,
lrn,
auctionData
}, },
}); });

View File

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

View File

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

View File

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