Skip to content
Merged

Djh #18

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
3 changes: 1 addition & 2 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ export class AuthService {
constructor(
private usersService: UsercenterService,
private jwtService: JwtService,
) { }
) {}

async signIn(username: string, pass: string): Promise<any> {

const user = await this.usersService.findOne(username);

// 直接使用用户密码进行验证
Expand Down
2 changes: 1 addition & 1 deletion src/auth/guards/admin.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class AdminGuard implements CanActivate {

// 获取用户信息
const userInfo = await this.usercenterService.findOne(user.sub);

// 检查用户是否具有管理员权限 (userAuth === 2)
if (userInfo.userAuth !== 2) {
throw new ForbiddenException('需要管理员权限');
Expand Down
4 changes: 3 additions & 1 deletion src/recruitment/dto/recruitment-response.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export class RecruitmentResponseDto {
this.recrType = recruitment.recrType;
this.recrTypeText = this.getRecrTypeText(recruitment.recrType);
this.officialResumeStatus = recruitment.officialResumeStatus;
this.officialResumeStatusText = this.getStatusText(recruitment.officialResumeStatus);
this.officialResumeStatusText = this.getStatusText(
recruitment.officialResumeStatus,
);
this.officialFeedbackInfromation = recruitment.officialFeedbackInfromation;
this.resumeFilePath = recruitment.resumeFilePath;
this.createTime = recruitment.createTime;
Expand Down
8 changes: 1 addition & 7 deletions src/recruitment/dto/update-recruitment.dto.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
IsInt,
IsOptional,
IsString,
Min,
Max,
} from 'class-validator';
import { IsInt, IsOptional, IsString, Min, Max } from 'class-validator';
import { Type } from 'class-transformer';

/**
Expand Down
154 changes: 77 additions & 77 deletions src/recruitment/entities/recruiment.entity.ts
Original file line number Diff line number Diff line change
@@ -1,92 +1,92 @@
// 招聘模块数据表
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
} from 'typeorm';

@Entity("recruitment")
@Entity('recruitment')
export class RecruitmentEntity {
// 官网简历投递ID
@PrimaryGeneratedColumn({
name: 'official_resume_id',
})
officialResumeId: number;
// 官网简历投递ID
@PrimaryGeneratedColumn({
name: 'official_resume_id',
})
officialResumeId: number;

// 用户ID
@Column({
name: "user_id",
nullable: false,
type: "int",
})
userId: number;
// 用户ID
@Column({
name: 'user_id',
nullable: false,
type: 'int',
})
userId: number;

// 求职类型
@Column({
name: "recr_type",
nullable: false,
type: "int",
default: 1,
})
recrType: number; // 前端部门 1, UI部门 2,办公部门 3
// 求职类型
@Column({
name: 'recr_type',
nullable: false,
type: 'int',
default: 1,
})
recrType: number; // 前端部门 1, UI部门 2,办公部门 3

// 简历投递状态
@Column({
name: "official_resume_status",
nullable: false,
type: "int",
default: 1,
})
officialResumeStatus: number; // 1. 未处理 2. 淘汰 3. 面试 4. 通过面试
// 简历投递状态
@Column({
name: 'official_resume_status',
nullable: false,
type: 'int',
default: 1,
})
officialResumeStatus: number; // 1. 未处理 2. 淘汰 3. 面试 4. 通过面试

// 官网简历反馈信息
@Column({
name: "official_feedback_infromation",
nullable: true,
type: "text",
})
officialFeedbackInfromation: string;
// 官网简历反馈信息
@Column({
name: 'official_feedback_infromation',
nullable: true,
type: 'text',
})
officialFeedbackInfromation: string;

// email
@Column({
name: "email",
nullable: true,
type: "varchar",
default: "",
})
email: string;
// email
@Column({
name: 'email',
nullable: true,
type: 'varchar',
default: '',
})
email: string;

// 电话号
@Column({
name: "phone",
nullable: true,
type: "varchar",
default: "",
})
phone: string;
// 电话号
@Column({
name: 'phone',
nullable: true,
type: 'varchar',
default: '',
})
phone: string;

// 简历文件地址
@Column({
name: "resume_file_path",
nullable: true,
type: "varchar",
default: "",
})
resumeFilePath: string;
// 简历文件地址
@Column({
name: 'resume_file_path',
nullable: true,
type: 'varchar',
default: '',
})
resumeFilePath: string;

// 创建时间
@CreateDateColumn({
name: "create_time",
nullable: false,
})
createTime: Date;
// 创建时间
@CreateDateColumn({
name: 'create_time',
nullable: false,
})
createTime: Date;

// 更新时间
@UpdateDateColumn({
name: "update_time",
nullable: false,
})
updateTime: Date;
// 更新时间
@UpdateDateColumn({
name: 'update_time',
nullable: false,
})
updateTime: Date;
}
6 changes: 5 additions & 1 deletion src/recruitment/recruitment.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ export class RecruitmentController {
@Body() updateRecruitmentDto: UpdateRecruitmentDto,
@Request() req,
): Promise<RecruitmentResponseDto> {
return this.recruitmentService.update(+id, updateRecruitmentDto, req.user.sub);
return this.recruitmentService.update(
+id,
updateRecruitmentDto,
req.user.sub,
);
}

/**
Expand Down
6 changes: 2 additions & 4 deletions src/recruitment/recruitment.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import { RecruitmentEntity } from './entities/recruiment.entity';
import { UserEntity } from '../usercenter/entities/usercenter.entity';

@Module({
imports: [
TypeOrmModule.forFeature([RecruitmentEntity, UserEntity]),
],
imports: [TypeOrmModule.forFeature([RecruitmentEntity, UserEntity])],
controllers: [RecruitmentController],
providers: [RecruitmentService]
providers: [RecruitmentService],
})
export class RecruitmentModule {}
29 changes: 22 additions & 7 deletions src/recruitment/recruitment.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { Injectable, NotFoundException, ForbiddenException } from '@nestjs/common';
import {
Injectable,
NotFoundException,
ForbiddenException,
} from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository, Between } from 'typeorm';
import { RecruitmentEntity } from './entities/recruiment.entity';
Expand Down Expand Up @@ -61,7 +65,8 @@ export class RecruitmentService {
const skip = (page - 1) * limit;

// 创建查询构建器
const queryBuilder = this.recruitmentRepository.createQueryBuilder('recruitment');
const queryBuilder =
this.recruitmentRepository.createQueryBuilder('recruitment');

// 根据求职类型过滤
if (type) {
Expand All @@ -70,17 +75,23 @@ export class RecruitmentService {

// 根据简历状态过滤
if (status) {
queryBuilder.andWhere('recruitment.officialResumeStatus = :status', { status });
queryBuilder.andWhere('recruitment.officialResumeStatus = :status', {
status,
});
}

// 根据邮箱过滤
if (email) {
queryBuilder.andWhere('recruitment.email LIKE :email', { email: `%${email}%` });
queryBuilder.andWhere('recruitment.email LIKE :email', {
email: `%${email}%`,
});
}

// 根据电话过滤
if (phone) {
queryBuilder.andWhere('recruitment.phone LIKE :phone', { phone: `%${phone}%` });
queryBuilder.andWhere('recruitment.phone LIKE :phone', {
phone: `%${phone}%`,
});
}

// 根据时间范围过滤
Expand Down Expand Up @@ -162,7 +173,9 @@ export class RecruitmentService {
const isAdmin = user.userAuth === 2;

if (!isAdmin) {
throw new ForbiddenException('您没有权限修改这份简历,只有管理员可以进行此操作');
throw new ForbiddenException(
'您没有权限修改这份简历,只有管理员可以进行此操作',
);
}

const updatedRecruitment = await this.recruitmentRepository.save({
Expand Down Expand Up @@ -204,7 +217,9 @@ export class RecruitmentService {
const isAdmin = user.userAuth === 2;

if (!isAdmin) {
throw new ForbiddenException('您没有权限删除这份简历,只有管理员可以进行此操作');
throw new ForbiddenException(
'您没有权限删除这份简历,只有管理员可以进行此操作',
);
}

// 删除简历
Expand Down
7 changes: 6 additions & 1 deletion src/upload/entities/upload.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn } from 'typeorm';
import {
Column,
CreateDateColumn,
Entity,
PrimaryGeneratedColumn,
} from 'typeorm';

@Entity('uploads')
export class Upload {
Expand Down
10 changes: 9 additions & 1 deletion src/upload/upload.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { Controller, Post, Get, UploadedFile, UseInterceptors, Query, UseGuards } from '@nestjs/common';
import {
Controller,
Post,
Get,
UploadedFile,
UseInterceptors,
Query,
UseGuards,
} from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
import { UploadService } from './upload.service';
import { Upload } from './entities/upload.entity';
Expand Down
Loading
Loading