Remove unused GQL methods

This commit is contained in:
Shreerang Kale 2025-02-03 13:28:11 +05:30
parent d1e6171874
commit b6084008b8
12 changed files with 56 additions and 77 deletions

View File

@ -70,18 +70,6 @@ export const createResolvers = async (service: Service): Promise<any> => {
return service.getDomainsByProjectId(projectId, filter); return service.getDomainsByProjectId(projectId, filter);
}, },
oldestDomain: async (
_: any,
{ projectId }: { projectId: string },
) => {
try {
return await service.getOldestDomainByProjectId(projectId);
} catch (err) {
log(err);
return false;
}
},
getAuctionData: async ( getAuctionData: async (
_: any, _: any,
{ auctionId }: { auctionId: string }, { auctionId }: { auctionId: string },

View File

@ -108,6 +108,7 @@ type Deployment {
environment: Environment! environment: Environment!
deployer: Deployer deployer: Deployer
applicationDeploymentRequestId: String applicationDeploymentRequestId: String
applicationDeploymentRecordData: AppDeploymentRecordAttributes
isCurrent: Boolean! isCurrent: Boolean!
baseDomain: String baseDomain: String
status: DeploymentStatus! status: DeploymentStatus!
@ -257,6 +258,19 @@ type DNSRecordAttributes {
version: String version: String
} }
type AppDeploymentRecordAttributes {
application: String
auction: String
deployer: String
dns: String
meta: String
name: String
request: String
type: String
url: String
version: String
}
input AuctionParams { input AuctionParams {
maxPrice: String, maxPrice: String,
numProviders: Int, numProviders: Int,
@ -274,7 +288,6 @@ type Query {
searchProjects(searchText: String!): [Project!] searchProjects(searchText: String!): [Project!]
getAuctionData(auctionId: String!): Auction! getAuctionData(auctionId: String!): Auction!
latestDNSRecord(projectId: String!): DNSRecordAttributes latestDNSRecord(projectId: String!): DNSRecordAttributes
oldestDomain(projectId: String!): Domain
domains(projectId: String!, filter: FilterDomainsInput): [Domain] domains(projectId: String!, filter: FilterDomainsInput): [Domain]
deployers: [Deployer] deployers: [Deployer]
address: String! address: String!

View File

@ -1407,12 +1407,6 @@ export class Service {
return updateResult; return updateResult;
} }
async getOldestDomainByProjectId(
projectId: string,
): Promise<Domain | null> {
return await this.db.getOldestDomainByProjectId(projectId)
}
async authenticateGitHub( async authenticateGitHub(
code: string, code: string,
user: User, user: User,

View File

@ -87,7 +87,7 @@ export const ProjectCard = ({
<p className={theme.title()}>{project.name}</p> <p className={theme.title()}>{project.name}</p>
</Tooltip> </Tooltip>
<p className={theme.description()}> <p className={theme.description()}>
{project.deployments[0]?.domain?.name ?? 'No domain'} {project.deployments[0].applicationDeploymentRecordData.url ?? 'No domain'}
</p> </p>
</div> </div>
{/* Icons */} {/* Icons */}

View File

@ -178,8 +178,7 @@ const EditDomainDialog = ({
})} })}
disabled={ disabled={
!Boolean(branches.length) !Boolean(branches.length)
// || //|| watch('redirectedTo') !== DEFAULT_REDIRECT_OPTIONS[0]
// watch('redirectedTo') !== DEFAULT_REDIRECT_OPTIONS[0]
} }
/> />
{!isValid && ( {!isValid && (

View File

@ -10,6 +10,7 @@ import { DeleteVariableDialog } from 'components/projects/Dialog/DeleteVariableD
import { DeleteDomainDialog } from 'components/projects/Dialog/DeleteDomainDialog'; import { DeleteDomainDialog } from 'components/projects/Dialog/DeleteDomainDialog';
import { CancelDeploymentDialog } from 'components/projects/Dialog/CancelDeploymentDialog'; import { CancelDeploymentDialog } from 'components/projects/Dialog/CancelDeploymentDialog';
import { import {
AppDeploymentRecordAttributes,
Deployment, Deployment,
DeploymentStatus, DeploymentStatus,
Domain, Domain,
@ -57,6 +58,7 @@ const deployment: Deployment = {
updatedAt: '1677680400', // 2023-03-01T13:00:00Z updatedAt: '1677680400', // 2023-03-01T13:00:00Z
applicationDeploymentRequestId: applicationDeploymentRequestId:
'bafyreiaycvq6imoppnpwdve4smj6t6ql5svt5zl3x6rimu4qwyzgjorize', 'bafyreiaycvq6imoppnpwdve4smj6t6ql5svt5zl3x6rimu4qwyzgjorize',
applicationDeploymentRecordData: {} as AppDeploymentRecordAttributes,
}; };
const domains: Domain[] = [ const domains: Domain[] = [

View File

@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import { import {
Link, Link,
// useNavigate, // useNavigate,
useOutletContext useOutletContext,
} from 'react-router-dom'; } from 'react-router-dom';
import { RequestError } from 'octokit'; import { RequestError } from 'octokit';
@ -202,16 +202,9 @@ const OverviewTabPanel = () => {
project.deployments.length > 0 && project.deployments.length > 0 &&
project.deployments.map((deployment) => ( project.deployments.map((deployment) => (
<div className="flex gap-2 items-center"> <div className="flex gap-2 items-center">
<Link <Link to={deployment.applicationDeploymentRecordData.url}>
to={
deployment.domain?.name
? `https://${deployment.domain.name}`
: `https://${project.name.toLowerCase()}.${deployment.deployer.baseDomain}`
}
>
<span className="text-controls-primary dark:text-foreground group hover:border-controls-primary transition-colors border-b border-b-transparent flex gap-2 items-center text-sm tracking-tight"> <span className="text-controls-primary dark:text-foreground group hover:border-controls-primary transition-colors border-b border-b-transparent flex gap-2 items-center text-sm tracking-tight">
{deployment.domain?.name ?? {deployment.applicationDeploymentRecordData.url}
`https://${project.name.toLowerCase()}.${deployment.deployer.baseDomain}`}
<LinkIcon className="group-hover:rotate-45 transition-transform" /> <LinkIcon className="group-hover:rotate-45 transition-transform" />
</span> </span>
</Link> </Link>

View File

@ -60,21 +60,19 @@ const Domains = () => {
return ( return (
<ProjectSettingContainer <ProjectSettingContainer
headingText="Domains" headingText="Domains"
button={ {...(!project.auctionId && {
<> button: (
{!project.auctionId && ( <Button
<Button as="a"
as="a" href="add"
href="add" variant="secondary"
variant="secondary" leftIcon={<PlusIcon />}
leftIcon={<PlusIcon />} size="md"
size="md" >
> Add domain
Add domain </Button>
</Button> ),
)} })}
</>
}
> >
{project.auctionId ? ( {project.auctionId ? (
<p className="text-gray-500"> <p className="text-gray-500">

View File

@ -12,6 +12,7 @@ import {
Domain, Domain,
Environment, Environment,
Permission, Permission,
AppDeploymentRecordAttributes,
} from 'gql-client'; } from 'gql-client';
export const user: User = { export const user: User = {
@ -111,6 +112,7 @@ export const deployment0: Deployment = {
}, },
applicationDeploymentRequestId: applicationDeploymentRequestId:
'bafyreiaycvq6imoppnpwdve4smj6t6ql5svt5zl3x6rimu4qwyzgjorize', 'bafyreiaycvq6imoppnpwdve4smj6t6ql5svt5zl3x6rimu4qwyzgjorize',
applicationDeploymentRecordData: {} as AppDeploymentRecordAttributes,
}; };
export const project: Project = { export const project: Project = {

View File

@ -393,19 +393,6 @@ export class GQLClient {
return data; return data;
} }
async oldestDomain(
projectId: string,
): Promise<types.OldestDomainResponse> {
const { data } = await this.client.query({
query: queries.oldestDomain,
variables: {
projectId,
},
});
return data;
}
async authenticateGitHub( async authenticateGitHub(
code: string code: string
): Promise<types.AuthenticateGitHubResponse> { ): Promise<types.AuthenticateGitHubResponse> {

View File

@ -57,6 +57,9 @@ query ($projectId: String!) {
commitHash commitHash
createdAt createdAt
environment environment
applicationDeploymentRecordData {
url
}
deployer { deployer {
baseDomain baseDomain
} }
@ -112,6 +115,9 @@ query ($organizationSlug: String!) {
commitMessage commitMessage
createdAt createdAt
environment environment
applicationDeploymentRecordData {
url
}
domain { domain {
status status
branch branch
@ -261,19 +267,6 @@ query ($projectId: String!, $filter: FilterDomainsInput) {
} }
`; `;
export const oldestDomain = gql`
query ($projectId: String!) {
oldestDomain(projectId: $projectId) {
branch
createdAt
id
name
status
updatedAt
}
}
`
export const getAuctionData = gql` export const getAuctionData = gql`
query ($auctionId: String!) { query ($auctionId: String!) {
getAuctionData(auctionId: $auctionId){ getAuctionData(auctionId: $auctionId){

View File

@ -108,6 +108,7 @@ export type Deployment = {
environment: Environment; environment: Environment;
isCurrent: boolean; isCurrent: boolean;
baseDomain?: string; baseDomain?: string;
applicationDeploymentRecordData: AppDeploymentRecordAttributes;
status: DeploymentStatus; status: DeploymentStatus;
createdBy: User; createdBy: User;
createdAt: string; createdAt: string;
@ -236,10 +237,6 @@ export type GetDomainsResponse = {
domains: Domain[]; domains: Domain[];
}; };
export type OldestDomainResponse = {
oldestDomain: Domain | null;
}
export type GetDeployersResponse = { export type GetDeployersResponse = {
deployers: Deployer[]; deployers: Deployer[];
}; };
@ -392,3 +389,16 @@ export type DNSRecordAttributes = {
export type GetLatestDNSDataResponse = { export type GetLatestDNSDataResponse = {
latestDNSRecord: DNSRecordAttributes | null latestDNSRecord: DNSRecordAttributes | null
} }
export interface AppDeploymentRecordAttributes {
application: string;
auction: string;
deployer: string;
dns: string;
meta: string;
name: string;
request: string;
type: string;
url: string;
version: string;
}