Skip to content

Commit

Permalink
Merge pull request #65 from richard483/fix-1
Browse files Browse the repository at this point in the history
unapply rename to reject & move to contract
  • Loading branch information
richard483 authored Jan 21, 2024
2 parents e66ad8c + 6f5472f commit a1d4314
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 59 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backend-8tech",
"version": "4.1.6",
"version": "4.1.7",
"description": "",
"author": "8tech",
"private": true,
Expand Down
16 changes: 8 additions & 8 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ enum Role {
}

enum ContractStatus {
PENDING
ACCEPTED
REJECTED
ONGOING
COMPLETED
PENDING //default & menunggu konfirmasi recruiter
ACCEPTED //diterima recruiter tapi kontrak bleum deal
REJECTED //ditolak recruiter
ONGOING //kontrak sudah deal (kl kontrak yg di tawarin recuiter di acc sama freelancer)
COMPLETED // recruiter udah bayar (payment status = paid)
}

enum PaymentStatus {
PENDING
PAID
FAILED
PENDING //default
PAID //dibayar recruiter
ACCEPTED //diterima freelancer (guard biar paid out 2 kali)
}
44 changes: 44 additions & 0 deletions src/contract/contract.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import {
Param,
Redirect,
Req,
Request,
} from '@nestjs/common';
import {
ApiBearerAuth,
ApiBody,
ApiCookieAuth,
ApiParam,
ApiResponse,
ApiTags,
Expand Down Expand Up @@ -187,4 +189,46 @@ export class ContractController {
);
return response;
}

@ApiBearerAuth()
@ApiCookieAuth()
@ApiParam({
name: 'contractId',
type: String,
description: 'contractId of the job vacancy that want to be deleted',
})
@ApiResponse({
schema: {
example: {
status: true,
statusCode: 200,
data: {
id: '19eb7629-3cc4-49ec-8a50-eba25f9d2a62',
userId: 'd557b674-7f45-4734-9115-2ef1154959bc',
jobId: '9a6402b9-9a20-4ab1-bb15-9324398cef39',
paymentId: null,
title:
'Lowongan pekerjaan Enna Alouette for d557b674-7f45-4734-9115-2ef1154959bc',
description: 'Contract for the following job description: auauaaa',
paymentRate: null,
template: null,
createdAt: '2024-01-16T17:35:13.586Z',
updatedAt: '2024-01-16T17:35:13.586Z',
status: 'PENDING',
customField: null,
workSubmission: null,
ratingId: null,
},
},
},
})
@Roles(Role.USER)
@UseGuards(JwtAuthGuard, RoleGuard)
@Get('reject/:contractId')
async rejectJobByContractId(@Request() req) {
console.info('#unapplyJobByContractId request incoming');
return await this.contractService.unApplyJobByContractId(
req.params.contractId,
);
}
}
4 changes: 4 additions & 0 deletions src/contract/contract.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ export class ContractService {
}
//#endregion

async unApplyJobByContractId(contractId: string) {
return this.contractRepository.delete(contractId);
}

//#region File
//Remove File by fileName
removeFile(fileName) {
Expand Down
40 changes: 0 additions & 40 deletions src/users/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,44 +191,4 @@ export class UserController {
console.info('#UserGetProfileInfoById request incoming');
return await this.userService.findOneById(params.id);
}

@ApiBearerAuth()
@ApiCookieAuth()
@ApiParam({
name: 'contractId',
type: String,
description: 'contractId of the job vacancy that want to be deleted',
})
@ApiResponse({
schema: {
example: {
status: true,
statusCode: 200,
data: {
id: '19eb7629-3cc4-49ec-8a50-eba25f9d2a62',
userId: 'd557b674-7f45-4734-9115-2ef1154959bc',
jobId: '9a6402b9-9a20-4ab1-bb15-9324398cef39',
paymentId: null,
title:
'Lowongan pekerjaan Enna Alouette for d557b674-7f45-4734-9115-2ef1154959bc',
description: 'Contract for the following job description: auauaaa',
paymentRate: null,
template: null,
createdAt: '2024-01-16T17:35:13.586Z',
updatedAt: '2024-01-16T17:35:13.586Z',
status: 'PENDING',
customField: null,
workSubmission: null,
ratingId: null,
},
},
},
})
@Roles(Role.USER)
@UseGuards(JwtAuthGuard, RoleGuard)
@Get('unapply/:contractId')
async unapplyJobByContractId(@Request() req, @Res() res) {
console.info('#unapplyJobByContractId request incoming');
return await this.userService.unApplyJobByContractId(req.params.contractId);
}
}
2 changes: 0 additions & 2 deletions src/users/users.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { UserController } from './user.controller';
import { UserRepository } from './user.repository';
import { UserHelper } from './user.helper';
import { CompanyRepository } from '../company/company.repository';
import { ContractRepository } from '../contract/contract.repository';

@Module({
providers: [
Expand All @@ -14,7 +13,6 @@ import { ContractRepository } from '../contract/contract.repository';
UserRepository,
UserHelper,
CompanyRepository,
ContractRepository,
],
exports: [UsersService],
controllers: [UserController],
Expand Down
6 changes: 0 additions & 6 deletions src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import { UserFilterRequestDto } from './dto/user-filter.dto';
import { UserHelper } from './user.helper';
import { User } from '@prisma/client';
import { CompanyRepository } from '../company/company.repository';
import { ContractRepository } from '../contract/contract.repository';

@Injectable()
export class UsersService {
constructor(
private userRepository: UserRepository,
private companyRepository: CompanyRepository,
private contractRepository: ContractRepository,
private userHelper: UserHelper,
) {}

Expand Down Expand Up @@ -112,8 +110,4 @@ export class UsersService {
): Promise<any | null> {
return this.userRepository.getAppliedJob(userId, page, size);
}

async unApplyJobByContractId(contractId: string) {
return this.contractRepository.delete(contractId);
}
}

0 comments on commit a1d4314

Please sign in to comment.