Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
3bd5503
refactor: `room-socket` 서브 모듈을 `websocket` 모듈로 분리
blu3fishez Nov 25, 2024
5f0ae21
refactor: 시그널링 서버의 로그 삭제
blu3fishez Nov 25, 2024
e2322b0
fix: 스터디 세션 나가기 로직 오류 수정
blu3fishez Nov 25, 2024
5477d1e
refactor: 스터디 세션 입장, 생성 로직 분리
blu3fishez Nov 25, 2024
a9c1897
fix: 여러 WAS에서 스터디세션을 잘못 생성하는 버그 수정
blu3fishez Nov 25, 2024
b9fe581
fix: `create_room` 시, `join` emit까지 받는 버그 수정
blu3fishez Nov 25, 2024
ca2f744
fix: 마지막 사용자가 방 퇴장 시 삭제되지 않던 오류 수정
blu3fishez Nov 25, 2024
99ee909
chore: docker compose 파일 업데이트
blu3fishez Nov 25, 2024
ef38c09
Merge pull request #222 from boostcampwm-2024/fix/generate-session-id
twalla26 Nov 25, 2024
da6e3ab
fix: docker-compose.yml 파일 수정
blu3fishez Nov 25, 2024
12a9e83
fix: docker-compose.yml 파일 수정
blu3fishez Nov 25, 2024
de77200
refactor: og-image용 이미지 svg가 아닌 jpg 파일로 추가
ShipFriend0516 Nov 25, 2024
3c19967
refactor: deprecated된 태그 대체 태그 사용
ShipFriend0516 Nov 25, 2024
b3340cb
feat: user_question_list 엔티티 구현
twalla26 Nov 25, 2024
d5f9863
feat: 로그인 상태에 따라 사이드바 다르게 보이도록 구현
yiseungyun Nov 25, 2024
3a14ac1
feat: 로그인된 사용자 로그인 페이지 접근 막기
yiseungyun Nov 25, 2024
8f8ad59
Merge remote-tracking branch 'upstream/main' into dev
ShipFriend0516 Nov 25, 2024
a94fb92
chore: constraints -> constants 폴더이름 변경
ShipFriend0516 Nov 25, 2024
ce12b47
refactor: 변경된 소켓 이벤트명 분리
ShipFriend0516 Nov 25, 2024
b8f79eb
feat: 마이 페이지 프로필, 질문지 탭 생성
yiseungyun Nov 25, 2024
9372a3d
feat: 사용자 닉네임 표시
yiseungyun Nov 25, 2024
6a15988
refactor: 세션아이디 없을 때 토스트 메시지
ShipFriend0516 Nov 26, 2024
fc6bf02
refactor: 변경된 웹소켓 API 이벤트명으로 변경
ShipFriend0516 Nov 26, 2024
de304ad
fix: websocket gateway CORS 허용
blu3fishez Nov 26, 2024
5d0147c
fix: 웹소켓 설정파일 수정
blu3fishez Nov 26, 2024
af6e2e0
Merge pull request #226 from ShipFriend0516/refactor/app-metadata
ShipFriend0516 Nov 26, 2024
fa2b30d
Merge pull request #229 from ShipFriend0516/fix/select-component-props
ShipFriend0516 Nov 26, 2024
81e3c44
Merge pull request #227 from boostcampwm-2024/fix/add-cors
ShipFriend0516 Nov 26, 2024
199b4e4
Merge pull request #228 from ShipFriend0516/refactor/websocket-api
ShipFriend0516 Nov 26, 2024
828aa89
Merge remote-tracking branch 'upstream/dev-be' into refactor/login-page
ShipFriend0516 Nov 26, 2024
55c824c
feat: 페이지네이션 공통 컴포넌트 생성
yiseungyun Nov 26, 2024
358baf2
feat: 마이페이지 질문리스트 영역 생성
yiseungyun Nov 26, 2024
c150ae9
refactor: 방 생성 API 변경된 웹소켓 API 이벤트명으로 변경
ShipFriend0516 Nov 26, 2024
787aacc
refactor: 소켓 exception 핸들러 추가
ShipFriend0516 Nov 26, 2024
cfdf414
feat: 질문지 스크랩 기능 구현
twalla26 Nov 26, 2024
48026b4
feat: 스크랩한 질문지 조회 기능
twalla26 Nov 26, 2024
061b2f8
feat: 게스트 로그인 기능을 추가
ShipFriend0516 Nov 26, 2024
b8b2be2
refactor: 기존 transaction 처리 코드를 typeorm에서 제공하는 코드로 변경
twalla26 Nov 26, 2024
4c0cde9
refactor: 로그인 페이지 컴포넌트 분리
ShipFriend0516 Nov 26, 2024
28a5d94
feat: 모달 배경 클릭 시 닫히도록 구현
yiseungyun Nov 26, 2024
d904abe
feat: 버튼 컴포넌트 생성
yiseungyun Nov 26, 2024
3b9b55d
feat: 회원 정보 변경 모달 창 생성
yiseungyun Nov 26, 2024
fe41925
refactor: 사이드바를 포함하는 기본 페이지 레이아웃을 component/layout으로 분리
ShipFriend0516 Nov 26, 2024
34a19fe
refactor: create-session-page 레이아웃을 SidebarPageLayout으로 대체
ShipFriend0516 Nov 26, 2024
5203276
feat: 삭제 로직을 위한 cascade, onDelete 설정
twalla26 Nov 26, 2024
18cd465
fix: category 필드 추가, 명세에 맞게 엔티티 DTO 수정
blu3fishez Nov 26, 2024
20f3b36
refactor: room_full 이벤트 핸들러 함수화
ShipFriend0516 Nov 26, 2024
2114c37
refactor: 로그문 삭제
blu3fishez Nov 26, 2024
92ed536
feat: 질문지 스크랩 취소(unscrap) 기능 구현
twalla26 Nov 26, 2024
e2e0a02
Merge remote-tracking branch 'upstream/fix/session-api-sepc' into ref…
ShipFriend0516 Nov 26, 2024
53f2eda
feat: 회원 정보 수정 폼 항목 추가
yiseungyun Nov 26, 2024
6967013
Merge pull request #230 from ShipFriend0516/refactor/login-page
yiseungyun Nov 26, 2024
dca2e2b
fix: join 이벤트 emit 시 명세에 맞게 보내주도록 수정
blu3fishez Nov 26, 2024
d6aa79a
Merge branch 'dev-fe' into feature/mypage
ShipFriend0516 Nov 26, 2024
b480b0e
Merge pull request #235 from boostcampwm-2024/feature/mypage
ShipFriend0516 Nov 26, 2024
09be264
refactor: 세션 생성 응답 형식 변경
ShipFriend0516 Nov 26, 2024
523bdd1
refactor: 세션 입장 데이터 타입 변경
ShipFriend0516 Nov 26, 2024
dad0226
refactor: 세션 헤더에서 타입을 import 하도록 수정
ShipFriend0516 Nov 26, 2024
d0cd585
feat: 카테고리 속성을 여러개 지원 가능하도록 수정
blu3fishez Nov 26, 2024
6ba45d8
Merge remote-tracking branch 'upstream/fix/session-api-sepc' into ref…
ShipFriend0516 Nov 26, 2024
6427e0f
fix: unscrap 기능에서 body로 받던 questionListId를 url 경로롤 받기
twalla26 Nov 26, 2024
4be9f21
fix: selected 대신 defaultValue를 사용하도록 수정
ShipFriend0516 Nov 26, 2024
a4fd881
fix: session 타입 스펠링 수정
ShipFriend0516 Nov 26, 2024
3582d75
refactor: 호스트 변경 이벤트 응답 형식 수정
ShipFriend0516 Nov 26, 2024
f5decb5
refactor: 세션 사이드바에서 퇴장 처리 이벤트 변경된 API에 맞게 수정
ShipFriend0516 Nov 26, 2024
e844e0d
feat: room dto 수정
blu3fishez Nov 26, 2024
f87697a
feat: 방 생성 시 빈방으로 생성하고 별도로 참가하도록 수정
blu3fishez Nov 26, 2024
aa11a9d
Merge remote-tracking branch 'upstream/fix/session-api-sepc' into ref…
ShipFriend0516 Nov 26, 2024
48c7427
feat: 로그인한 회원 input에 본인 닉네임 적혀있도록 구현
ShipFriend0516 Nov 27, 2024
34d81f0
refactor: 리액션기능 api 변경 대응
ShipFriend0516 Nov 27, 2024
16fb395
refactor: join room 이벤트 타입 수정
ShipFriend0516 Nov 27, 2024
762edd6
refactor: 세션 생성시 카테고리 배열로 변경
ShipFriend0516 Nov 27, 2024
ed347cb
chore: props 이름 변경
ShipFriend0516 Nov 27, 2024
e8ab2d8
refactor: webrtc peerconnection 수립과정 로깅 추가
ShipFriend0516 Nov 27, 2024
2dc7f4d
fix: 유저 join이 잘 되지 않던 오류 수정
ShipFriend0516 Nov 27, 2024
dc9bacf
fix: map 안정성 추가
ShipFriend0516 Nov 27, 2024
5191c8d
Merge pull request #250 from ShipFriend0516/refactor/session-page
ShipFriend0516 Nov 27, 2024
8c5a7b6
Merge pull request #234 from twalla26/feature/question-list
twalla26 Nov 27, 2024
42074dd
Merge remote-tracking branch 'origin/dev-fe' into dev
blu3fishez Nov 27, 2024
b883cdf
fix: candidate 서버측 이벤트명 수정
blu3fishez Nov 27, 2024
5e354cb
fix: lint 수정
ShipFriend0516 Nov 27, 2024
b05723a
Merge remote-tracking branch 'origin/dev' into dev
blu3fishez Nov 27, 2024
1a6178d
fix: 방 퇴장 시 quit 이벤트도 Emit 되도록 변경
blu3fishez Nov 27, 2024
8e068a7
fix: 방 종료 시 버그 수정
blu3fishez Nov 27, 2024
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
115 changes: 94 additions & 21 deletions backend/src/question-list/question-list.controller.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import {
Body,
Controller,
Get,
Post,
Req,
Res,
UseGuards,
} from "@nestjs/common";
import { Body, Controller, Delete, Get, Param, Post, Req, Res, UseGuards } from "@nestjs/common";
import { QuestionListService } from "./question-list.service";
import { CreateQuestionListDto } from "./dto/create-question-list.dto";
import { CreateQuestionDto } from "./dto/create-question.dto";
import { GetAllQuestionListDto } from "./dto/get-all-question-list.dto";
import { QuestionListContentsDto } from "./dto/question-list-contents.dto";
import { AuthGuard } from "@nestjs/passport";
import { JwtPayload } from "../auth/jwt/jwt.decorator";
import { IJwtPayload } from "../auth/jwt/jwt.model";
import { JwtPayload } from "@/auth/jwt/jwt.decorator";
import { IJwtPayload } from "@/auth/jwt/jwt.model";
import { MyQuestionListDto } from "./dto/my-question-list.dto";

@Controller("question-list")
Expand Down Expand Up @@ -70,9 +61,7 @@ export class QuestionListController {

// 질문지 생성
const { createdQuestionList, createdQuestions } =
await this.questionListService.createQuestionList(
createQuestionListDto
);
await this.questionListService.createQuestionList(createQuestionListDto);

return res.send({
success: true,
Expand Down Expand Up @@ -102,9 +91,7 @@ export class QuestionListController {
try {
const { categoryName } = body;
const allQuestionLists: GetAllQuestionListDto[] =
await this.questionListService.getAllQuestionListsByCategoryName(
categoryName
);
await this.questionListService.getAllQuestionListsByCategoryName(categoryName);
return res.send({
success: true,
message: "All question lists received successfully.",
Expand Down Expand Up @@ -132,9 +119,7 @@ export class QuestionListController {
try {
const { questionListId } = body;
const questionListContents: QuestionListContentsDto =
await this.questionListService.getQuestionListContents(
questionListId
);
await this.questionListService.getQuestionListContents(questionListId);
return res.send({
success: true,
message: "Question list contents received successfully.",
Expand Down Expand Up @@ -173,4 +158,92 @@ export class QuestionListController {
});
}
}

@Get("scrap")
@UseGuards(AuthGuard("jwt"))
async getScrappedQuestionLists(@Res() res, @JwtPayload() token: IJwtPayload) {
try {
const userId = token.userId;
const scrappedQuestionLists =
await this.questionListService.getScrappedQuestionLists(userId);
return res.send({
success: true,
message: "Scrapped question lists received successfully.",
data: {
scrappedQuestionLists,
},
});
} catch (error) {
return res.send({
success: false,
message: "Failed to get scrapped question lists.",
error: error.message,
});
}
}

@Post("scrap")
@UseGuards(AuthGuard("jwt"))
async scrapQuestionList(
@Res() res,
@JwtPayload() token: IJwtPayload,
@Body() body: { questionListId: number }
) {
try {
const userId = token.userId;
const { questionListId } = body;
const scrappedQuestionList = await this.questionListService.scrapQuestionList(
questionListId,
userId
);

return res.send({
success: true,
message: "Question list is scrapped successfully.",
data: {
scrappedQuestionList,
},
});
} catch (error) {
return res.send({
success: false,
message: "Failed to scrap question list.",
error: error.message,
});
}
}

@Delete("scrap/:questionListId")
@UseGuards(AuthGuard("jwt"))
async unscrapQuestionList(
@Res() res,
@JwtPayload() token: IJwtPayload,
@Param("questionListId") questionListId: number
) {
try {
const userId = token.userId;
const unscrappedQuestionList = await this.questionListService.unscrapQuestionList(
questionListId,
userId
);

if (unscrappedQuestionList.affected) {
return res.send({
success: true,
message: "Question list unscrapped successfully.",
});
} else {
return res.send({
success: false,
message: "Failed to unscrap question list.",
});
}
} catch (error) {
return res.send({
success: false,
message: "Failed to unscrap question list.",
error: error.message,
});
}
}
}
16 changes: 12 additions & 4 deletions backend/src/question-list/question-list.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ManyToMany,
JoinTable,
} from "typeorm";
import { User } from "../user/user.entity";
import { User } from "@/user/user.entity";
import { Question } from "./question.entity";
import { Category } from "./category.entity";

Expand All @@ -30,21 +30,29 @@ export class QuestionList {
@Column()
userId: number;

@ManyToOne(() => User, (user) => user.questionLists)
@ManyToOne(() => User, (user) => user.questionLists, {
onDelete: "CASCADE",
})
user: User;

@OneToMany(() => Question, (question) => question.questionList)
@OneToMany(() => Question, (question) => question.questionList, {
cascade: true,
})
questions: Question[];

@ManyToMany(() => Category, (category) => category.questionLists, {
cascade: true,
onDelete: "CASCADE",
})
@JoinTable({
name: "question_list_category",
joinColumn: {
name: "questionListId",
name: "question_list_id",
referencedColumnName: "id",
},
})
categories: Category[];

@ManyToMany(() => User, (user) => user.scrappedQuestionLists)
scrappedByUsers: User[];
}
3 changes: 2 additions & 1 deletion backend/src/question-list/question-list.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { Module } from "@nestjs/common";
import { QuestionListController } from "./question-list.controller";
import { QuestionListService } from "./question-list.service";
import { QuestionListRepository } from "./question-list.repository";
import { UserRepository } from "@/user/user.repository";

@Module({
controllers: [QuestionListController],
providers: [QuestionListService, QuestionListRepository],
providers: [QuestionListService, QuestionListRepository, UserRepository],
exports: [QuestionListRepository],
})
export class QuestionListModule {}
39 changes: 38 additions & 1 deletion backend/src/question-list/question-list.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ import { DataSource, In } from "typeorm";
import { QuestionList } from "./question-list.entity";
import { Question } from "./question.entity";
import { Category } from "./category.entity";
import { User } from "../user/user.entity";
import { User } from "@/user/user.entity";

@Injectable()
export class QuestionListRepository {
constructor(private dataSource: DataSource) {}

createQuestionList(questionList: QuestionList) {
return this.dataSource.getRepository(QuestionList).save(questionList);
}

async createQuestions(questions: Question[]) {
return this.dataSource.getRepository(Question).save(questions);
}

findPublicQuestionLists() {
return this.dataSource.getRepository(QuestionList).find({
where: { isPublic: true },
Expand Down Expand Up @@ -86,4 +94,33 @@ export class QuestionListRepository {
})
.getCount();
}

scrapQuestionList(questionListId: number, userId: number) {
return this.dataSource
.createQueryBuilder()
.insert()
.into("user_question_list")
.values({
user_id: userId,
question_list_id: questionListId,
})
.orIgnore()
.execute();
}

getScrappedQuestionListsByUser(user: User) {
return this.dataSource.getRepository(QuestionList).find({
where: { scrappedByUsers: user },
});
}

unscrapQuestionList(questionListId: number, userId: number) {
return this.dataSource
.createQueryBuilder()
.delete()
.from("user_question_list")
.where("user_id = :userId", { userId })
.andWhere("question_list_id = :questionListId", { questionListId })
.execute();
}
}
Loading