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);
},
oldestDomain: async (
_: any,
{ projectId }: { projectId: string },
) => {
try {
return await service.getOldestDomainByProjectId(projectId);
} catch (err) {
log(err);
return false;
}
},
getAuctionData: async (
_: any,
{ auctionId }: { auctionId: string },

View File

@ -108,6 +108,7 @@ type Deployment {
environment: Environment!
deployer: Deployer
applicationDeploymentRequestId: String
applicationDeploymentRecordData: AppDeploymentRecordAttributes
isCurrent: Boolean!
baseDomain: String
status: DeploymentStatus!
@ -257,6 +258,19 @@ type DNSRecordAttributes {
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 {
maxPrice: String,
numProviders: Int,
@ -274,7 +288,6 @@ type Query {
searchProjects(searchText: String!): [Project!]
getAuctionData(auctionId: String!): Auction!
latestDNSRecord(projectId: String!): DNSRecordAttributes
oldestDomain(projectId: String!): Domain
domains(projectId: String!, filter: FilterDomainsInput): [Domain]
deployers: [Deployer]
address: String!

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -57,6 +57,9 @@ query ($projectId: String!) {
commitHash
createdAt
environment
applicationDeploymentRecordData {
url
}
deployer {
baseDomain
}
@ -112,6 +115,9 @@ query ($organizationSlug: String!) {
commitMessage
createdAt
environment
applicationDeploymentRecordData {
url
}
domain {
status
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`
query ($auctionId: String!) {
getAuctionData(auctionId: $auctionId){

View File

@ -108,6 +108,7 @@ export type Deployment = {
environment: Environment;
isCurrent: boolean;
baseDomain?: string;
applicationDeploymentRecordData: AppDeploymentRecordAttributes;
status: DeploymentStatus;
createdBy: User;
createdAt: string;
@ -236,10 +237,6 @@ export type GetDomainsResponse = {
domains: Domain[];
};
export type OldestDomainResponse = {
oldestDomain: Domain | null;
}
export type GetDeployersResponse = {
deployers: Deployer[];
};
@ -392,3 +389,16 @@ export type DNSRecordAttributes = {
export type GetLatestDNSDataResponse = {
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;
}