Skip to content
Merged

Main #130

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
02bbcbf
fix:: 시간 없는 강의 return
Devheun Nov 18, 2024
eebc854
mod:: 시간표 삭제 시 재생성 로직 구현
Devheun Nov 26, 2024
57a2e15
mod:: 해당 학기에 시간표 존재하지 않을 시 추가로 하나 생성
Devheun Nov 26, 2024
e6e1ba9
refactor:: 시간표 삭제 시 남은 시간표 개수 조회 로직 수정
Devheun Nov 26, 2024
9731175
fix:: 시간표 삭제 시 남은 시간표 조회하는 로직 수정
Devheun Nov 26, 2024
57fc49b
fix:: 연도와 학기 조건 누락된 것 추가
Devheun Nov 29, 2024
18ed12e
Merge branch 'develop' into feature/course
JeongYeonSeung Nov 29, 2024
5e7e9fe
Merge pull request #114 from DevKor-github/feature/course
Devheun Dec 2, 2024
a46ad05
Merge pull request #116 from DevKor-github/feature/timetable
Devheun Dec 2, 2024
b49878c
feat:: 회원가입 시 디스코드 연동
Devheun Dec 9, 2024
4ad7b13
feat: 배너이미지 조회, 추가, 삭제 기능 구현
KimSeongHyeonn Jan 8, 2025
397d142
chore:: CICD yml 파일 수정
Devheun Jan 14, 2025
483aa7c
Merge pull request #119 from DevKor-github/feature/auth
Devheun Jan 14, 2025
10000f3
feat: 배너 이미지에 제목지정 기능 추가
KimSeongHyeonn Jan 15, 2025
605afcf
feat:: 검색 기본적인 전략 생성
Devheun Jan 15, 2025
907daf3
feat:: 강의 카테고리 enum 생성 및 커스텀 에러 생성
Devheun Jan 21, 2025
a564651
feat:: 강의검색 리팩토링에 따른 새로운 DTO 생성
Devheun Jan 21, 2025
60605df
refactor:: friendship 간단한 리팩토링
JeongYeonSeung Jan 25, 2025
1339ecc
feat: 받은 친구 요청 개수 반환 엔드포인트 구현
JeongYeonSeung Jan 25, 2025
49682d0
mod:: 받은 친구 요청 조회 시 읽음 처리되도록 변경
JeongYeonSeung Jan 25, 2025
76881fc
refactor:: Course 컨트롤러 수정 및 데코레이터 수정
Devheun Jan 27, 2025
6ed09fa
refactor:: 강의검색 전략 생성
Devheun Jan 27, 2025
47aecd1
refactor:: 강의검색 service 로직 수정
Devheun Jan 27, 2025
1dbcec1
refactor:: 모듈 등록
Devheun Jan 27, 2025
8f85ce5
refactor:: 필요없는 CourseCategory enum값 제거
Devheun Jan 27, 2025
4679553
refactor:: enum 수정에 따른 dto 수정
Devheun Jan 27, 2025
4203629
refactor:: 순환 의존성 해결 및 검색 로직 수정
Devheun Jan 27, 2025
423fad8
refactor:: 성현's review 반영
Devheun Feb 2, 2025
7d0f2ca
fix:: swagger 명세 수정
Devheun Feb 2, 2025
d0d127b
rename: 파일, 클래스 네이밍 수정
KimSeongHyeonn Feb 2, 2025
b9c5f35
Merge pull request #122 from DevKor-github/feature/friendNew
JeongYeonSeung Feb 4, 2025
e8b1b0b
Merge pull request #120 from DevKor-github/feature/banner
KimSeongHyeonn Feb 4, 2025
605b6db
fix: 오타 수정 및 swagger 명세 수정
Devheun Feb 4, 2025
563c958
Merge pull request #121 from DevKor-github/refactor/search-course
Devheun Feb 4, 2025
2c92974
fix: 가입안된 유저에 대한 에러 처리
KimSeongHyeonn Feb 9, 2025
227acee
Merge pull request #123 from DevKor-github/fix/temp-password
KimSeongHyeonn Feb 9, 2025
81e773c
feat:: 동아리 상세 정보 조회 api 추가
JeongYeonSeung Feb 9, 2025
c9b15d0
feat: 신고 수락(유저 정지) 기능 추가
KimSeongHyeonn Feb 9, 2025
b91eb85
feat: 정지된 유저 커뮤니티 활동 제한
KimSeongHyeonn Feb 9, 2025
0ee55e6
feat: swagger 문서 에러 추가
KimSeongHyeonn Feb 9, 2025
53184ed
feat: 신고수락시 글 삭제기능 추가
KimSeongHyeonn Feb 9, 2025
4ea9637
mod:: 받은 친구 요청 개수 조회 로직의 응답 dto 수정
JeongYeonSeung Feb 9, 2025
f8d3e30
fix:: 보낸/받은 친구 요청 조회 시 최신 순으로 정렬하도록 수정
JeongYeonSeung Feb 9, 2025
0fcdc65
fix: 게시글 신고시 글 삭제로직 트랜잭션 포함되도록 수정
KimSeongHyeonn Feb 9, 2025
1081667
fix: 게시글 삭제되어도 댓글 남겨두도록 수정
KimSeongHyeonn Feb 9, 2025
8e016a9
fix: 게시글이 삭제된 댓글 삭제로직 수정
KimSeongHyeonn Feb 9, 2025
ecdddba
fix: 신고된 글 삭제 권한확인 로직 추가
KimSeongHyeonn Feb 9, 2025
bfa545e
fix: swagger 명세 수정
KimSeongHyeonn Feb 9, 2025
8731c69
Merge pull request #126 from DevKor-github/refactor/friendship
JeongYeonSeung Feb 11, 2025
3d8a2f0
feat:: 오늘의 시간표 반환 API 개발
Devheun Feb 11, 2025
09a5bc2
mod:: hot club 조회 시 5개 반환하도록 변경
JeongYeonSeung Feb 12, 2025
87c14ca
mod:: recommend club 조회 시 5개 반환하도록 변경
JeongYeonSeung Feb 12, 2025
12b5b60
rename:: 메서드명에 자료형 넣지 않도록 변경
JeongYeonSeung Feb 12, 2025
99ef051
feat:: 동아리 상세 정보 조회 응답 DTO에 링크 개수 추가
JeongYeonSeung Feb 18, 2025
0cb3c49
Merge pull request #125 from DevKor-github/feature/user-ban
KimSeongHyeonn Feb 23, 2025
ddd44a1
refactor: PR 리뷰 반영
Devheun Feb 23, 2025
589e491
Merge pull request #124 from DevKor-github/feature/club-detail
JeongYeonSeung Feb 24, 2025
4482988
mod:: 반환할 club 개수 상수로 뺴기
JeongYeonSeung Feb 24, 2025
c55dfbd
Merge branch 'develop' into refactor/club
JeongYeonSeung Feb 24, 2025
f5df60f
Merge pull request #129 from DevKor-github/refactor/club
JeongYeonSeung Feb 24, 2025
fa5a3a3
Merge pull request #128 from DevKor-github/refactor/timetable
Devheun Feb 25, 2025
d781633
fix:: club controller 라우팅 순서 수정
JeongYeonSeung Feb 25, 2025
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
2 changes: 2 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
echo "REDIS_HOST=${{ secrets.REDIS_HOST }}" >> .env.test
echo "REDIS_PORT=${{ secrets.REDIS_PORT }}" >> .env.test
echo "REDIS_PASSWORD=${{ secrets.REDIS_PASSWORD }}" >> .env.test
echo "DISCORD_WEBHOOK_URL=${{ secrets.DISCORD_WEBHOOK_URL }}" >> .env.test

cat .env.test

Expand Down Expand Up @@ -112,6 +113,7 @@ jobs:
echo "REDIS_HOST=${{ secrets.REDIS_HOST }}" >> .env.prod
echo "REDIS_PORT=${{ secrets.REDIS_PORT }}" >> .env.prod
echo "REDIS_PASSWORD=${{ secrets.REDIS_PASSWORD }}" >> .env.prod
echo "DISCORD_WEBHOOK_URL=${{ secrets.DISCORD_WEBHOOK_URL }}" >> .env.prod

cat .env.prod

Expand Down
57 changes: 43 additions & 14 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"class-validator": "^0.14.1",
"cross-env": "^7.0.3",
"deepl-node": "^1.13.0",
"discord-webhook-node": "^1.1.8",
"express-basic-auth": "^1.2.1",
"multer": "^1.4.5-lts.1",
"multer-s3": "^3.0.1",
Expand Down
2 changes: 2 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { AttendanceCheckModule } from './attendance-check/attendance-check.modul
import { APP_FILTER } from '@nestjs/core';
import { UnhandledExceptionFilter } from './common/filter/unhandled-exception.filter';
import { KukeyExceptionFilter } from './common/filter/kukey-exception.filter';
import { BannerModule } from './home/banner/banner.module';

console.log(`.env.${process.env.NODE_ENV}`);

Expand Down Expand Up @@ -75,6 +76,7 @@ console.log(`.env.${process.env.NODE_ENV}`);
CalendarModule,
ReportModule,
AttendanceCheckModule,
BannerModule,
],
controllers: [AppController],
providers: [
Expand Down
21 changes: 21 additions & 0 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { ChangePasswordResponseDto } from './dto/change-password-response.dto';
import { SendTempPasswordResponseDto } from './dto/send-temporary-password.dto';
import { EntityManager } from 'typeorm';
import { throwKukeyException } from 'src/utils/exception.util';
import { Webhook } from 'discord-webhook-node';

@Injectable()
export class AuthService {
Expand Down Expand Up @@ -254,6 +255,21 @@ export class AuthService {
user,
);

const discordUrl = await this.configService.get('DISCORD_WEBHOOK_URL');
const hook = new Webhook(discordUrl);
const totalUsers = await this.userService.getTotalUsersCount();

await hook
.send(
'The ' +
totalUsers +
'th user has signed up for KU-KEY! (' +
studentNumber +
')',
)
.then(() => console.log('Sent new user request to discord'))
.catch((err) => console.log(err.message));

return new SignUpResponseDto(true, studentNumber);
}

Expand Down Expand Up @@ -343,6 +359,11 @@ export class AuthService {
email: string,
): Promise<SendTempPasswordResponseDto> {
const user = await this.userService.findUserByEmail(email);

if (!user) {
throwKukeyException('USER_NOT_FOUND');
}

const tempPassword = this.generateRandomString(10);

const isUpdated = await this.userService.updatePassword(
Expand Down
1 change: 1 addition & 0 deletions src/common/constant/club-count.constant.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const CLUB_COUNT = 5;
28 changes: 1 addition & 27 deletions src/community/comment/comment.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ import { GetCommentResponseDto } from './dto/get-comment.dto';
import { UpdateCommentRequestDto } from './dto/update-comment.dto';
import { DeleteCommentResponseDto } from './dto/delete-comment.dto';
import { LikeCommentResponseDto } from './dto/like-comment.dto';
import {
CreateReportRequestDto,
CreateReportResponseDto,
} from '../report/dto/create-report.dto';
import { ReportService } from '../report/report.service';
import { CursorPageOptionsDto } from 'src/common/dto/CursorPageOptions.dto';
import { GetMyCommentListResponseDto } from './dto/get-myComment-list.dto';
import { TransactionInterceptor } from 'src/common/interceptors/transaction.interceptor';
Expand All @@ -39,10 +34,7 @@ import { CommentDocs } from 'src/decorators/docs/comment.decorator';
@ApiBearerAuth('accessToken')
@CommentDocs
export class CommentController {
constructor(
private readonly commentService: CommentService,
private readonly reportService: ReportService,
) {}
constructor(private readonly commentService: CommentService) {}

@Get('/my')
async getMyCommentList(
Expand Down Expand Up @@ -112,22 +104,4 @@ export class CommentController {
commentId,
);
}

@Post('/:commentId/report')
async reportComment(
@User() user: AuthorizedUserDto,
@Param('commentId') commentId: number,
@Body() body: CreateReportRequestDto,
): Promise<CreateReportResponseDto> {
const comment = await this.commentService.getComment(commentId);
if (!comment) {
throwKukeyException('COMMENT_NOT_FOUND');
}
return await this.reportService.createReport(
user.id,
body.reason,
comment.postId,
commentId,
);
}
}
5 changes: 3 additions & 2 deletions src/community/comment/comment.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { PostModule } from '../post/post.module';
import { CommentLikeEntity } from 'src/entities/comment-like.entity';
import { CommentAnonymousNumberEntity } from 'src/entities/comment-anonymous-number.entity';
import { NoticeModule } from 'src/notice/notice.module';
import { ReportModule } from '../report/report.module';
import { UserModule } from 'src/user/user.module';

@Module({
imports: [
Expand All @@ -19,9 +19,10 @@ import { ReportModule } from '../report/report.module';
]),
PostModule,
NoticeModule,
ReportModule,
UserModule,
],
controllers: [CommentController],
providers: [CommentService, CommentRepository],
exports: [CommentService],
})
export class CommentModule {}
56 changes: 40 additions & 16 deletions src/community/comment/comment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { CursorPageOptionsDto } from 'src/common/dto/CursorPageOptions.dto';
import { CursorPageMetaResponseDto } from 'src/common/dto/CursorPageResponse.dto';
import { GetMyCommentListResponseDto } from './dto/get-myComment-list.dto';
import { throwKukeyException } from 'src/utils/exception.util';
import { UserBanService } from 'src/user/user-ban.service';

@Injectable()
export class CommentService {
Expand All @@ -28,6 +29,7 @@ export class CommentService {
@InjectRepository(CommentAnonymousNumberEntity)
private readonly commentAnonymousNumberRepository: Repository<CommentAnonymousNumberEntity>,
private readonly noticeService: NoticeService,
private readonly userBanService: UserBanService,
) {}

async getMyCommentList(
Expand Down Expand Up @@ -62,6 +64,10 @@ export class CommentService {
requestDto: CreateCommentRequestDto,
parentCommentId?: number,
) {
if (await this.userBanService.checkUserBan(user.id)) {
throwKukeyException('USER_BANNED');
}

const post = await this.postService.isExistingPostId(postId);
if (!post) {
throwKukeyException('POST_NOT_FOUND');
Expand Down Expand Up @@ -171,6 +177,10 @@ export class CommentService {
commentId: number,
requestDto: UpdateCommentRequestDto,
): Promise<GetCommentResponseDto> {
if (await this.userBanService.checkUserBan(user.id)) {
throwKukeyException('USER_BANNED');
}

const comment =
await this.commentRepository.getCommentByCommentId(commentId);
if (!comment) {
Expand Down Expand Up @@ -218,13 +228,20 @@ export class CommentService {
if (!comment) {
throwKukeyException('COMMENT_NOT_FOUND');
}
if (comment.userId !== user.id) {
throwKukeyException('COMMENT_OWNERSHIP_REQUIRED');
}

const post = await this.postService.isExistingPostId(comment.postId);
if (Number(post.boardId) === 2) {
throwKukeyException('COMMENT_IN_QUESTION_BOARD');

this.checkDeleteAuthority(comment, post, user);

if (post) {
const updateResult = await transactionManager.decrement(
PostEntity,
{ id: comment.postId },
'commentCount',
1,
);
if (!updateResult.affected) {
throwKukeyException('POST_UPDATE_FAILED');
}
}

const deleteResult = await transactionManager.softRemove(
Expand All @@ -235,19 +252,26 @@ export class CommentService {
throwKukeyException('COMMENT_DELETE_FAILED');
}

const updateResult = await transactionManager.decrement(
PostEntity,
{ id: comment.postId },
'commentCount',
1,
);
if (!updateResult.affected) {
throwKukeyException('POST_UPDATE_FAILED');
}

return new DeleteCommentResponseDto(true);
}

private checkDeleteAuthority(
comment: CommentEntity,
post: PostEntity,
user: AuthorizedUserDto,
) {
if (user.id !== -1) {
if (comment.userId !== user.id) {
throwKukeyException('COMMENT_OWNERSHIP_REQUIRED');
}
if (post) {
if (Number(post.boardId) === 2) {
throwKukeyException('COMMENT_IN_QUESTION_BOARD');
}
}
}
}

async likeComment(
tranasactionManager: EntityManager,
user: AuthorizedUserDto,
Expand Down
Loading
Loading