Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release] 3차 배포 (11/29) #325

Merged
merged 78 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
df0c8af
feat: 티클 삭제 기능 구현
Jieun1ee Nov 27, 2024
f35c78e
feat: 티클 삭젝 시 연관테이블도 삭제
Jieun1ee Nov 27, 2024
a0a067d
feat: 모듈별 이벤트 정리 및 pause/resume consumers 이벤트 추가
seoko97 Nov 27, 2024
0d2ec1b
feat: 소켓 이벤트 이름 변경 및 Consumer pause/resume event 추가
seoko97 Nov 27, 2024
c926170
feat: producerId에 따라 consumer를 제거하는 메서드 추가
seoko97 Nov 27, 2024
fcb96ce
feat: producerId에 따라 consumer를 일시 정지, 재개 및 제거하는 메서드 추가
seoko97 Nov 27, 2024
061929e
feat: Consumer 상태 변경 및 관리 메서드 추가
seoko97 Nov 27, 2024
2ce474c
feat: consume 메서드 재구성 및 createConsumers 메서드 추가
seoko97 Nov 27, 2024
6b57502
feat: createConsumers 이벤트 추가
seoko97 Nov 27, 2024
72234ba
Merge pull request #300 from boostcampwm-2024/feat/#274/video-pagenation
seoko97 Nov 27, 2024
e72428f
feat: 옵션 목록을 portal로 띄워서 다른 요소에 영향받지 않도록 수정
simeunseo Nov 27, 2024
bac986a
feat: useOutsideClick에 넘겨주는 ref 영역을 옵션 목록 영역으로 제한하여 잘못된 outside click…
simeunseo Nov 27, 2024
9f41b23
feat: ticle 상세조회 타입에 isOwner, alreadyApplied 추가
simeunseo Nov 27, 2024
4bda6d2
feat: ticle 상세조회 api에서 userid가 아닌 applicantid로 비교하고있는 문제 해결
simeunseo Nov 27, 2024
4bc74b4
feat: 신청 완료된 티클은 버튼 disabled, 내 티클은 버튼을 보이지 않게 처리
simeunseo Nov 27, 2024
68e5aeb
feat: 티클 신청시 티클 상세조회 invalidate
simeunseo Nov 27, 2024
29887d8
design: 제목이 길어도 레이아웃이 일관되도록 수정
simeunseo Nov 27, 2024
453e1d8
feat: consumer 생성시 producer 상태 업데이트에 따른 이벤트 등록
seoko97 Nov 27, 2024
7240a84
design: 대시보드에서 티클명이 길 때 ellipsis 처리
simeunseo Nov 27, 2024
ad2145a
feat: 기존 producerResumed 이벤트 제거
seoko97 Nov 27, 2024
a62cc91
feat: zustand 설치 및 authStore 정의
simeunseo Nov 27, 2024
bdc2c8e
feat: 로그인 정보에 따라 authStore를 업데이트하는 훅 구현
simeunseo Nov 27, 2024
5038747
feat: authStore 내 데이터에 따라서 유저 정보를 보여줌
simeunseo Nov 27, 2024
dcfaa65
feat: 인증 정보가 필요한 route에 대해 로그인 하지 않고 접속시 로그인 페이지로 리다이렉트
simeunseo Nov 27, 2024
937721b
feat: useParams의 from 옵션으로 넣어주던 라우트 수정
simeunseo Nov 27, 2024
252058a
design: 커스텀 스크롤바를 필요한 곳에서만 사용하도록 변경
simeunseo Nov 27, 2024
e44eca7
chore: prettier 오류 수정
simeunseo Nov 28, 2024
25b825f
chore: prettier 오류 수정
simeunseo Nov 28, 2024
ff9a1a1
feat: nickname type 추가
simeunseo Nov 28, 2024
713813e
feat: nickname 넘겨주기
simeunseo Nov 28, 2024
7a36c3a
feat: VideoPlayer에 nickname 표시
simeunseo Nov 28, 2024
d183347
fix: 잘못된 의존성 배열로 인해 무한 리렌더링 되는 문제 해결
simeunseo Nov 28, 2024
34da867
chore: 안 쓰는 메소드 정리
Jieun1ee Nov 28, 2024
26c1f09
feat: useAuthInfo에서 반환 타입을 명시하여 타입 추론
simeunseo Nov 28, 2024
d2c8690
feat: merge 'feat/#307/auth-zustand' into feat/#261/video-nickname
simeunseo Nov 28, 2024
ed37519
Merge pull request #316 from boostcampwm-2024/feat/#303/ticle-modify-…
Jieun1ee Nov 28, 2024
c660707
Merge pull request #312 from boostcampwm-2024/feat/#24/ticle-state
simeunseo Nov 28, 2024
647fd4f
feat: consume 메서드 간소화 및 createConsumers 메서드에 매개변수 추가
seoko97 Nov 28, 2024
8b51324
feat: consume 및 createConsumers 메서드 매개변수 구조 변경 및 appData 처리 개선
seoko97 Nov 28, 2024
d42a025
feat: resumeAudioConsumers 및 resumeVideoConsumers 이벤트 추가
seoko97 Nov 28, 2024
dd2ae29
feat: 로그인 시 원래있던 페이지로 redirect
begong313 Nov 28, 2024
5bda2dd
feat: path 만 받아오게 수정
begong313 Nov 28, 2024
7e58b59
feat: /auth/oauth 에 redirect searchParam 포함
simeunseo Nov 28, 2024
c504890
feat: guest login, oauth login에서 search param으로 redirect url 넘겨주기
simeunseo Nov 28, 2024
91d176f
feat: Merge branch 'feat/#189/login-redicert' of https://github.com/b…
simeunseo Nov 28, 2024
6fc97d2
feat: redirect url 없을시 빈 문자열로 넘김
simeunseo Nov 28, 2024
d86902a
fix: undefined error 수정
begong313 Nov 28, 2024
e7639c8
feat: locallogin, guestlogin시에도 redirect 정상동작하게 만들기
begong313 Nov 28, 2024
893dff7
refactor: 타입지정
begong313 Nov 28, 2024
d47af65
feat: _authenticated에서 리다이렉트 하기 전에 auth state를 먼저 설정
simeunseo Nov 28, 2024
9bde0c8
fix: route type 에러 해결
simeunseo Nov 28, 2024
f894839
feat: 티클 삭제 api 연동
simeunseo Nov 28, 2024
9d75224
feat: 티클 삭제 버튼 동작 추가
simeunseo Nov 28, 2024
50b53d8
fix: 서버에서 userId, ticleId 잘못 넘겨주고 있는 것 해결
simeunseo Nov 28, 2024
38781ad
Merge pull request #308 from boostcampwm-2024/feat/#274/video-pagenation
seoko97 Nov 28, 2024
5280db6
Merge pull request #309 from boostcampwm-2024/feat/#306/ui-layout
begong313 Nov 28, 2024
bec2dba
Merge pull request #311 from boostcampwm-2024/feat/#307/auth-zustand
begong313 Nov 28, 2024
ffc3c7f
chore: pnpm-lock 파일 수정
seoko97 Nov 28, 2024
2c54f52
Merge pull request #313 from boostcampwm-2024/feat/#305/select
begong313 Nov 28, 2024
ead1f7e
feat: resumeAudioConsumers 및 resumeVideoConsumers 이벤트 추가
seoko97 Nov 28, 2024
c827857
Merge pull request #317 from boostcampwm-2024/feat/#261/video-nickname
begong313 Nov 28, 2024
8efcb8d
Merge pull request #322 from boostcampwm-2024/feat/#189/login-redicert
begong313 Nov 28, 2024
439ed90
feat: CreateConsumerRes 및 ResumeConsumersRes 인터페이스에 peerId 및 paused 속…
seoko97 Nov 28, 2024
c2e7386
feat: CreateConsumerDto에 peerId 속성 추가 및 consume 메서드 반환 값 수정
seoko97 Nov 28, 2024
82561ab
feat: RemoteStreamContext에 pauseVideoConsumers 메서드 추가 및 resumeVideoSt…
seoko97 Nov 28, 2024
7529b17
feat: PinnedGrid에 pinnedStream 속성 추가
seoko97 Nov 28, 2024
0803088
Merge pull request #323 from boostcampwm-2024/feat/#319/ticle-delete
begong313 Nov 28, 2024
d3a7c4a
feat: grid 변경시 해당 grid resume 여부 변경
seoko97 Nov 28, 2024
57ca6ba
feat: useDebouncedCallback 훅 추가
seoko97 Nov 28, 2024
512d033
fix: 이벤트 이름 getProducer -> getProducers로 수정
seoko97 Nov 28, 2024
28a65b5
feat: useRemoteStream consumer 관리 기능 추가 및 resume/pause 메서드 구현
seoko97 Nov 28, 2024
bd784fe
feat: 초기 접속시 audio 스트림에 대한 resume 여부 판단
seoko97 Nov 28, 2024
9caa238
feat: 아바타가 항상 중앙에 위치하도록 수정
seoko97 Nov 28, 2024
bfadb07
fix: 병합 충돌 해결
seoko97 Nov 28, 2024
97696dc
Merge branch 'develop' into feat/#274/video-pagenation
seoko97 Nov 28, 2024
77d0a1a
Merge pull request #324 from boostcampwm-2024/feat/#274/video-pagenation
seoko97 Nov 28, 2024
32bf0eb
fix: AudioPlayer Props 에서 nickname 제거
seoko97 Nov 28, 2024
0495edc
Merge pull request #326 from boostcampwm-2024/fix/#325/audio-palyer
seoko97 Nov 28, 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
39 changes: 26 additions & 13 deletions apps/api/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Body, Controller, Get, Post, Res, UseGuards } from '@nestjs/common';
import { Body, Controller, Get, Post, Query, Res, UseGuards } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { ApiBody, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { ThrottlerGuard } from '@nestjs/throttler';
Expand Down Expand Up @@ -43,17 +43,21 @@ export class AuthController {
@ApiResponse({ status: 302, description: '홈으로 리다이렉션' })
@ApiResponse({ status: 401 })
@UseGuards(LocalAuthGuard)
localLogin(@GetUserId() userId: number, @Res() response: Response) {
this.loginProcess(response, userId);
localLogin(
@GetUserId() userId: number,
@Query('redirect') redirect: string,
@Res() response: Response
) {
this.loginProcess(response, userId, redirect);
}

@Get('guest/login')
@ApiOperation({ summary: '게스트 로그인' })
@ApiResponse({ status: 302, description: '홈으로 리다이렉션' })
@UseGuards(ThrottlerGuard)
async guestLogin(@Res() response: Response) {
async guestLogin(@Query('redirect') redirect: string, @Res() response: Response) {
const guestUser = await this.authService.createGuestUser();
this.loginProcess(response, guestUser.id);
this.loginProcess(response, guestUser.id, redirect);
}

@Get('google/login')
Expand All @@ -65,8 +69,12 @@ export class AuthController {

@Get('google/callback')
@UseGuards(GoogleAuthGuard)
googleAuthCallback(@GetUserId() userId: number, @Res() response: Response) {
this.loginProcess(response, userId);
googleAuthCallback(
@GetUserId() userId: number,
@Query('state') state: string,
@Res() response: Response
) {
this.loginProcess(response, userId, state);
}

@Get('github/login')
Expand All @@ -78,8 +86,12 @@ export class AuthController {

@Get('github/callback')
@UseGuards(GitHubAuthGuard)
githubAuthCallback(@GetUserId() userId: number, @Res() response: Response) {
this.loginProcess(response, userId);
githubAuthCallback(
@GetUserId() userId: number,
@Query('state') state: string,
@Res() response: Response
) {
this.loginProcess(response, userId, state);
}

@Get('logout')
Expand All @@ -90,13 +102,14 @@ export class AuthController {
this.redirectToHome(response);
}

private loginProcess(response: Response, userId: number) {
private loginProcess(response: Response, userId: number, path?: string) {
const { accessToken } = this.authService.createJWT(userId);
response.cookie('accessToken', accessToken, this.cookieConfig.getAuthCookieOptions());
this.redirectToHome(response);
this.redirectToHome(response, path);
}

private redirectToHome(response: Response) {
response.redirect(this.redirectUrl);
private redirectToHome(response: Response, path?: string) {
const redirectUrl = `${this.redirectUrl}${path || ''}`;
response.redirect(redirectUrl);
}
}
10 changes: 9 additions & 1 deletion apps/api/src/auth/github/github.strategy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PassportStrategy } from '@nestjs/passport';
import { Profile, Strategy } from 'passport-github2';
import { Request } from 'express';
import { Profile, Strategy, StrategyOption } from 'passport-github2';
import { Provider } from '@repo/types';

import { AuthService } from '../auth.service';
Expand All @@ -19,6 +20,13 @@ export class GitHubStrategy extends PassportStrategy(Strategy, Provider.github)
scope: ['user:email'],
});
}
authenticate(req: Request, options: StrategyOption) {
const returnUrl = req.query.redirect as string;
if (returnUrl) {
options.state = returnUrl;
}
return super.authenticate(req, options);
}

async validate(accessToken: string, refreshToken: string, profile: Profile) {
const { id, username, emails, photos } = profile;
Expand Down
10 changes: 10 additions & 0 deletions apps/api/src/auth/google/google.strategy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PassportStrategy } from '@nestjs/passport';
import { Request } from 'express';
import { StrategyOption } from 'passport-github2';
import { Profile, Strategy } from 'passport-google-oauth20';
import { Provider } from '@repo/types';

Expand All @@ -20,6 +22,14 @@ export class GoogleStrategy extends PassportStrategy(Strategy, Provider.google)
});
}

authenticate(req: Request, options: StrategyOption) {
const returnUrl = req.query.redirect as string;
if (returnUrl) {
options.state = returnUrl;
}
return super.authenticate(req, options);
}

async validate(accessToken: string, refreshToken: string, profile: Profile): Promise<any> {
const { id, displayName, emails, photos } = profile;

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/entity/applicant.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class Applicant {
@PrimaryGeneratedColumn({ type: 'bigint' })
id: number;

@ManyToOne(() => Ticle, (ticle) => ticle.applicants)
@ManyToOne(() => Ticle, (ticle) => ticle.applicants, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'ticle_id' })
ticle: Ticle;

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/entity/summary.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Summary {
@CreateDateColumn({ type: 'timestamp', name: 'created_at' })
createdAt: Date;

@OneToOne(() => Ticle, (ticle) => ticle.summary)
@OneToOne(() => Ticle, (ticle) => ticle.summary, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'ticle_id' })
ticle: Ticle;
}
8 changes: 7 additions & 1 deletion apps/api/src/ticle/ticle.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Body, Controller, Get, Param, Post, Query, UseGuards } from '@nestjs/common';
import { Body, Controller, Delete, Get, Param, Post, Query, UseGuards } from '@nestjs/common';
import { CreateTicleSchema } from '@repo/types';

import { JwtAuthGuard } from '@/auth/jwt/jwt-auth.guard';
Expand Down Expand Up @@ -50,4 +50,10 @@ export class TicleController {
applyToTicle(@GetUserId() userId: number, @Param('ticleId') ticleId: number) {
return this.ticleService.applyTicle(ticleId, userId);
}

@Delete(':ticleId')
@UseGuards(JwtAuthGuard)
deleteTicle(@GetUserId() userId: number, @Param('ticleId') ticleId: number) {
return this.ticleService.deleteTicle(userId, ticleId);
}
}
23 changes: 21 additions & 2 deletions apps/api/src/ticle/ticle.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ export class TicleService {
.leftJoinAndSelect('ticle.tags', 'tags')
.leftJoinAndSelect('ticle.speaker', 'speaker')
.leftJoinAndSelect('ticle.applicants', 'applicants')
.select(['ticle', 'tags', 'speaker.id', 'speaker.profileImageUrl', 'applicants'])
.leftJoinAndSelect('applicants.user', 'user')
.select(['ticle', 'tags', 'speaker.id', 'speaker.profileImageUrl', 'applicants', 'user.id'])
.where('ticle.id = :id', { id: ticleId })
.getOne();

Expand All @@ -143,7 +144,7 @@ export class TicleService {
}
const { tags, speaker, ...ticleData } = ticle;

const alreadyApplied = ticle.applicants.some((applicnat) => applicnat.id === userId);
const alreadyApplied = ticle.applicants.some((applicant) => applicant.user.id === userId);

return {
...ticleData,
Expand Down Expand Up @@ -226,4 +227,22 @@ export class TicleService {
},
};
}

async deleteTicle(userId: number, ticleId: number) {
const ticle = await this.ticleRepository.findOne({
where: { id: ticleId },
relations: ['speaker'],
});

if (!ticle) {
throw new NotFoundException(ErrorMessage.TICLE_NOT_FOUND);
}

if (ticle.speaker.id !== userId) {
throw new BadRequestException(ErrorMessage.CANNOT_DELETE_OTHERS_TICLE);
}

await this.ticleRepository.remove(ticle);
return;
}
}
1 change: 1 addition & 0 deletions apps/media/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@nestjs/platform-express": "^10.0.0",
"@nestjs/platform-socket.io": "^10.4.7",
"@nestjs/websockets": "^10.4.7",
"@repo/lint": "workspace:*",
"@repo/tsconfig": "workspace:*",
"@repo/mediasoup": "workspace:*",
"@repo/types": "workspace:*",
Expand Down
Loading