|
1 | | -import { Resolver, Query, Mutation, Args, Int } from '@nestjs/graphql'; |
2 | | -import { UseGuards } from '@nestjs/common'; |
3 | | -import { JobService } from './job.service'; |
4 | | -import { Job } from './models/job.model'; |
5 | | -import { CreateJobDto } from './dto/create-job.dto'; |
6 | | -import { UpdateJobDto } from './dto/update-job.dto'; |
7 | | -import { JobArgs } from './args/job.args'; |
8 | | -import { GqlAuthGuard } from '../common/auth/gql-auth.guard'; |
9 | | -import { UserEntity as User } from './../common/decorators/user.decorator'; |
| 1 | +// import { Resolver, Query, Mutation, Args, Int } from '@nestjs/graphql'; |
| 2 | +// import { UseGuards } from '@nestjs/common'; |
| 3 | +// import { JobService } from './job.service'; |
| 4 | +// import { Job } from './models/job.model'; |
| 5 | +// import { CreateJobDto } from './dto/create-job.dto'; |
| 6 | +// import { UpdateJobDto } from './dto/update-job.dto'; |
| 7 | +// import { JobArgs } from './args/job.args'; |
| 8 | +// import { GqlAuthGuard } from '../common/auth/gql-auth.guard'; |
| 9 | +// import { UserEntity as User } from './../common/decorators/user.decorator'; |
10 | 10 |
|
11 | | -/** |
12 | | - * Job GraphQL Resolver |
13 | | - * |
14 | | - * Provides GraphQL queries and mutations for job management. |
15 | | - * Handles both public queries (viewing jobs) and protected mutations |
16 | | - * (creating, updating, deleting jobs). |
17 | | - * |
18 | | - * Queries: |
19 | | - * - jobs: Get paginated list of jobs with filtering |
20 | | - * - job: Get single job by ID |
21 | | - * - jobsByCompany: Get jobs for a specific company |
22 | | - * - jobsByTag: Get jobs with a specific tag |
23 | | - * |
24 | | - * Mutations: |
25 | | - * - createJob: Create a new job listing |
26 | | - * - updateJob: Update an existing job listing |
27 | | - * - deleteJob: Delete a job listing |
28 | | - */ |
29 | | -@Resolver(() => Job) |
30 | | -export class JobResolver { |
31 | | - constructor(private readonly jobService: JobService) {} |
| 11 | +// /** |
| 12 | +// * Job GraphQL Resolver |
| 13 | +// * |
| 14 | +// * Provides GraphQL queries and mutations for job management. |
| 15 | +// * Handles both public queries (viewing jobs) and protected mutations |
| 16 | +// * (creating, updating, deleting jobs). |
| 17 | +// * |
| 18 | +// * Queries: |
| 19 | +// * - jobs: Get paginated list of jobs with filtering |
| 20 | +// * - job: Get single job by ID |
| 21 | +// * - jobsByCompany: Get jobs for a specific company |
| 22 | +// * - jobsByTag: Get jobs with a specific tag |
| 23 | +// * |
| 24 | +// * Mutations: |
| 25 | +// * - createJob: Create a new job listing |
| 26 | +// * - updateJob: Update an existing job listing |
| 27 | +// * - deleteJob: Delete a job listing |
| 28 | +// */ |
| 29 | +// @Resolver(() => Job) |
| 30 | +// export class JobResolver { |
| 31 | +// constructor(private readonly jobService: JobService) {} |
32 | 32 |
|
33 | | - /** |
34 | | - * Get all jobs with optional filtering and pagination |
35 | | - * Public query - no authentication required |
36 | | - */ |
37 | | - @Query(() => [Job]) |
38 | | - async jobs(@Args() args: JobArgs) { |
39 | | - const result = await this.jobService.findAll({ |
40 | | - paginationArgs: args, |
41 | | - orderBy: args.orderBy, |
42 | | - search: args.search, |
43 | | - companyId: args.companyId, |
44 | | - location: args.location, |
45 | | - isRemote: args.isRemote, |
46 | | - tags: args.tags, |
47 | | - }); |
48 | | - return result.jobs; |
49 | | - } |
| 33 | +// /** |
| 34 | +// * Get all jobs with optional filtering and pagination |
| 35 | +// * Public query - no authentication required |
| 36 | +// */ |
| 37 | +// @Query(() => [Job]) |
| 38 | +// async jobs(@Args() args: JobArgs) { |
| 39 | +// const result = await this.jobService.findAll({ |
| 40 | +// paginationArgs: args, |
| 41 | +// orderBy: args.orderBy, |
| 42 | +// search: args.search, |
| 43 | +// companyId: args.companyId, |
| 44 | +// location: args.location, |
| 45 | +// isRemote: args.isRemote, |
| 46 | +// tags: args.tags, |
| 47 | +// }); |
| 48 | +// return result.jobs; |
| 49 | +// } |
50 | 50 |
|
51 | | - /** |
52 | | - * Get a single job by ID |
53 | | - * Public query - no authentication required |
54 | | - */ |
55 | | - @Query(() => Job, { name: 'job' }) |
56 | | - async findOne(@Args('id', { type: () => Int }) id: number) { |
57 | | - return this.jobService.findOne(id); |
58 | | - } |
| 51 | +// /** |
| 52 | +// * Get a single job by ID |
| 53 | +// * Public query - no authentication required |
| 54 | +// */ |
| 55 | +// @Query(() => Job, { name: 'job' }) |
| 56 | +// async findOne(@Args('id', { type: () => Int }) id: number) { |
| 57 | +// return this.jobService.findOne(id); |
| 58 | +// } |
59 | 59 |
|
60 | | - /** |
61 | | - * Get jobs for a specific company |
62 | | - * Public query - no authentication required |
63 | | - */ |
64 | | - @Query(() => [Job]) |
65 | | - async jobsByCompany(@Args('companyId', { type: () => Int }) companyId: number, @Args() args: JobArgs) { |
66 | | - const result = await this.jobService.findByCompany(companyId, args, args.orderBy); |
67 | | - return result.jobs; |
68 | | - } |
| 60 | +// /** |
| 61 | +// * Get jobs for a specific company |
| 62 | +// * Public query - no authentication required |
| 63 | +// */ |
| 64 | +// @Query(() => [Job]) |
| 65 | +// async jobsByCompany(@Args('companyId', { type: () => Int }) companyId: number, @Args() args: JobArgs) { |
| 66 | +// const result = await this.jobService.findByCompany(companyId, args, args.orderBy); |
| 67 | +// return result.jobs; |
| 68 | +// } |
69 | 69 |
|
70 | | - /** |
71 | | - * Get jobs with a specific tag |
72 | | - * Public query - no authentication required |
73 | | - */ |
74 | | - @Query(() => [Job]) |
75 | | - async jobsByTag(@Args('tagName') tagName: string, @Args() args: JobArgs) { |
76 | | - const result = await this.jobService.findByTag(tagName, args, args.orderBy); |
77 | | - return result.jobs; |
78 | | - } |
| 70 | +// /** |
| 71 | +// * Get jobs with a specific tag |
| 72 | +// * Public query - no authentication required |
| 73 | +// */ |
| 74 | +// @Query(() => [Job]) |
| 75 | +// async jobsByTag(@Args('tagName') tagName: string, @Args() args: JobArgs) { |
| 76 | +// const result = await this.jobService.findByTag(tagName, args, args.orderBy); |
| 77 | +// return result.jobs; |
| 78 | +// } |
79 | 79 |
|
80 | | - /** |
81 | | - * Create a new job listing |
82 | | - * Protected mutation - requires authentication |
83 | | - */ |
84 | | - @Mutation(() => Job) |
85 | | - @UseGuards(GqlAuthGuard) |
86 | | - async createJob(@Args('createJobInput') createJobDto: CreateJobDto, @User() user: any) { |
87 | | - return this.jobService.create(createJobDto, user.id); |
88 | | - } |
| 80 | +// /** |
| 81 | +// * Create a new job listing |
| 82 | +// * Protected mutation - requires authentication |
| 83 | +// */ |
| 84 | +// @Mutation(() => Job) |
| 85 | +// @UseGuards(GqlAuthGuard) |
| 86 | +// async createJob(@Args('createJobInput') createJobDto: CreateJobDto, @User() user: any) { |
| 87 | +// return this.jobService.create(createJobDto, user.id); |
| 88 | +// } |
89 | 89 |
|
90 | | - /** |
91 | | - * Update an existing job listing |
92 | | - * Protected mutation - requires authentication |
93 | | - */ |
94 | | - @Mutation(() => Job) |
95 | | - @UseGuards(GqlAuthGuard) |
96 | | - async updateJob(@Args('id', { type: () => Int }) id: number, @Args('updateJobInput') updateJobDto: UpdateJobDto, @User() user: any) { |
97 | | - return this.jobService.update(id, updateJobDto, user.id); |
98 | | - } |
| 90 | +// /** |
| 91 | +// * Update an existing job listing |
| 92 | +// * Protected mutation - requires authentication |
| 93 | +// */ |
| 94 | +// @Mutation(() => Job) |
| 95 | +// @UseGuards(GqlAuthGuard) |
| 96 | +// async updateJob(@Args('id', { type: () => Int }) id: number, @Args('updateJobInput') updateJobDto: UpdateJobDto, @User() user: any) { |
| 97 | +// return this.jobService.update(id, updateJobDto, user.id); |
| 98 | +// } |
99 | 99 |
|
100 | | - /** |
101 | | - * Delete a job listing |
102 | | - * Protected mutation - requires authentication |
103 | | - */ |
104 | | - @Mutation(() => Boolean) |
105 | | - @UseGuards(GqlAuthGuard) |
106 | | - async deleteJob(@Args('id', { type: () => Int }) id: number, @User() user: any) { |
107 | | - await this.jobService.remove(id, user.id); |
108 | | - return true; |
109 | | - } |
110 | | -} |
| 100 | +// /** |
| 101 | +// * Delete a job listing |
| 102 | +// * Protected mutation - requires authentication |
| 103 | +// */ |
| 104 | +// @Mutation(() => Boolean) |
| 105 | +// @UseGuards(GqlAuthGuard) |
| 106 | +// async deleteJob(@Args('id', { type: () => Int }) id: number, @User() user: any) { |
| 107 | +// await this.jobService.remove(id, user.id); |
| 108 | +// return true; |
| 109 | +// } |
| 110 | +// } |
0 commit comments