Compare commits

...

6 Commits

Author SHA1 Message Date
Sujith Thirumalaisamy
433c378e12
Merge 0b28b8d46a into e5e34c42ed 2024-05-08 00:14:31 +05:30
Sujith Thirumalaisamy
0b28b8d46a
Merge branch 'main' into main 2024-05-08 00:14:28 +05:30
Bartosz Jarocki
e5e34c42ed Enabled introspection 2024-04-14 14:07:32 +02:00
Bartosz Jarocki
2390a3a5f3 Add graphql studio 2024-04-14 14:02:33 +02:00
Bartosz Jarocki
bfdb1d5d8b Merge branch 'main' of github.com:BartoszJarocki/cv 2024-04-14 13:51:34 +02:00
Bartosz Jarocki
27b6a8bd29 Added GraphQL api 2024-04-14 13:50:04 +02:00
6 changed files with 1142 additions and 77 deletions

View File

@ -9,20 +9,27 @@
"lint": "next lint"
},
"dependencies": {
"@apollo/server": "^4.10.2",
"@as-integrations/next": "^3.0.0",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-slot": "^1.0.2",
"@vercel/analytics": "^1.1.2",
"class-validator": "^0.14.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cmdk": "^0.2.0",
"graphql": "^16.8.1",
"graphql-scalars": "^1.23.0",
"lucide-react": "^0.300.0",
"next": "14.0.4",
"next-themes": "^0.3.0",
"react": "^18",
"react-dom": "^18",
"reflect-metadata": "^0.2.2",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7",
"type-graphql": "^2.0.0-beta.6",
"vaul": "^0.8.0"
},
"devDependencies": {

11
src/apollo/resolvers.ts Normal file
View File

@ -0,0 +1,11 @@
import { Resolver, Query } from "type-graphql";
import { Me } from "./type-defs";
import { RESUME_DATA } from "../data/resume-data";
@Resolver(() => Me)
export class MeResolver {
@Query(() => Me)
me(): Me {
return RESUME_DATA as any;
}
}

127
src/apollo/type-defs.ts Normal file
View File

@ -0,0 +1,127 @@
import { ObjectType, Field } from "type-graphql";
@ObjectType()
export class Social {
@Field(() => String)
name: string;
@Field(() => String)
url: string;
}
@ObjectType()
export class Contact {
@Field(() => String)
email: string;
@Field(() => String)
tel: string;
@Field(() => [Social])
social: Social[];
}
@ObjectType()
export class Education {
@Field(() => String)
school: string;
@Field(() => String)
degree: string;
@Field(() => String)
start: string;
@Field(() => String)
end: string;
}
@ObjectType()
export class Work {
@Field(() => String)
company: string;
@Field(() => String)
link: string;
@Field(() => [String])
badges: string[];
@Field(() => String)
title: string;
@Field(() => String)
start: string;
@Field(() => String)
end: string;
@Field(() => String)
description: string;
}
@ObjectType()
export class Link {
@Field(() => String)
label: string;
@Field(() => String)
href: string;
}
@ObjectType()
export class Project {
@Field(() => String)
title: string;
@Field(() => [String])
techStack: string[];
@Field(() => String)
description: string;
@Field(() => Link, { nullable: true })
link?: Link;
}
@ObjectType()
export class Me {
@Field(() => String)
name: string;
@Field(() => String)
initials: string;
@Field(() => String)
location: string;
@Field(() => String)
locationLink: string;
@Field(() => String)
about: string;
@Field(() => String)
summary: string;
@Field(() => String)
avatarUrl: string;
@Field(() => String)
personalWebsiteUrl: string;
@Field(() => Contact)
contact: Contact;
@Field(() => [Education])
education: Education[];
@Field(() => [Work])
work: Work[];
@Field(() => [String])
skills: string[];
@Field(() => [Project])
projects: Project[];
}

21
src/app/graphql/route.ts Normal file
View File

@ -0,0 +1,21 @@
import "reflect-metadata";
import { ApolloServer } from "@apollo/server";
import { startServerAndCreateNextHandler } from "@as-integrations/next";
import { ApolloServerPluginLandingPageLocalDefault } from "@apollo/server/plugin/landingPage/default";
import { MeResolver } from "../../apollo/resolvers";
import { buildSchema } from "type-graphql";
import { NextRequest } from "next/server";
const schema = await buildSchema({
resolvers: [MeResolver],
});
const apolloServer = new ApolloServer({
schema,
plugins: [ApolloServerPluginLandingPageLocalDefault()],
introspection: true,
});
const handler = startServerAndCreateNextHandler<NextRequest>(apolloServer, {
context: async (req) => ({ req }),
});
export { handler as GET, handler as POST };

View File

@ -1,7 +1,9 @@
{
"compilerOptions": {
"target": "es5",
"target": "es2021",
"lib": ["dom", "dom.iterable", "esnext"],
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowJs": true,
"skipLibCheck": true,
"strict": true,
@ -9,6 +11,7 @@
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"strictPropertyInitialization": false,
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
@ -22,6 +25,12 @@
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/images/logos/*.*"],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"src/images/logos/*.*"
],
"exclude": ["node_modules"]
}

1038
yarn.lock

File diff suppressed because it is too large Load Diff