diff --git a/.env.sample b/.env.sample index d5e995bc..97457612 100644 --- a/.env.sample +++ b/.env.sample @@ -4,8 +4,8 @@ DATABASE_URL="postgresql://ft_transcendence:supersecretpassword@db/ft_transcende NEXT_PUBLIC_API_ENDPOINT="https://localhost" NEXT_PUBLIC_UPLOADS_BASE="https://localhost" NEXT_PUBLIC_WS_ENDPOINT="wss://localhost" -API_42_UID="u-s4t2ud-94c0c5cf7592264ccffbc786dac656324fd173fd328b1bc442dbf9e2d1f316a1" -API_42_SECRET="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" +API_42_UID="u-s4t2ud-something-something" +API_42_SECRET="s-s4t2ud-something-something" API_42_CALLBACK="https://localhost/api/auth/42/callback" FRONTEND_ORIGIN="https://localhost" JWT_SECRET="super secret key :)" diff --git a/.vscode/settings.json b/.vscode/settings.json index b71f6adb..5ac57d3d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,7 +10,7 @@ "editor.defaultFormatter": "esbenp.prettier-vscode", }, "editor.codeActionsOnSave": { - "source.organizeImports": true, + "source.organizeImports": "explicit" }, "[prisma]": { "editor.formatOnSave": true, diff --git a/project/backend/.env.sample.dev b/project/backend/.env.sample.dev index 8bd7c70c..11b84121 100644 --- a/project/backend/.env.sample.dev +++ b/project/backend/.env.sample.dev @@ -2,8 +2,8 @@ NODE_ENV="development" PORT=60080 DATABASE_URL="postgresql://ft_transcendence:supersecretpassword@localhost:65432/ft_transcendence?schema=public" # TODO: regenerate/replace API secret later -API_42_UID="u-s4t2ud-94c0c5cf7592264ccffbc786dac656324fd173fd328b1bc442dbf9e2d1f316a1" -API_42_SECRET="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" +API_42_UID="u-s4t2ud-something-something" +API_42_SECRET="s-s4t2ud-something-something" API_42_CALLBACK="http://localhost:53000/api/auth/42/callback" FRONTEND_ORIGIN="http://localhost:53000" JWT_SECRET="super secret key :)" diff --git a/project/backend/src/channel/dto/message-pagination.dto.ts b/project/backend/src/channel/dto/message-pagination.dto.ts index c83976a0..9c2b9372 100644 --- a/project/backend/src/channel/dto/message-pagination.dto.ts +++ b/project/backend/src/channel/dto/message-pagination.dto.ts @@ -16,11 +16,11 @@ export class MessagePaginationDto { @ApiProperty({ description: '페이지당 메시지 수', required: false, - default: 10, example: 10, }) @Type(() => Number) + @IsOptional() @IsInt() @Min(1) - pageSize: number = 10; + pageSize?: number; } diff --git a/project/backend/src/users/dto/update-user.dto.ts b/project/backend/src/users/dto/update-user.dto.ts index c8188b8c..6ba8135b 100644 --- a/project/backend/src/users/dto/update-user.dto.ts +++ b/project/backend/src/users/dto/update-user.dto.ts @@ -1,5 +1,5 @@ import { ApiPropertyOptional } from '@nestjs/swagger'; -import { IsOptional, IsString, Matches } from 'class-validator'; +import { IsOptional, IsString, Matches, MaxLength } from 'class-validator'; export class UpdateUserDto { @ApiPropertyOptional({ @@ -25,5 +25,6 @@ export class UpdateUserDto { @ApiPropertyOptional({ description: '프로필 상태 메세지', required: false }) @IsOptional() @IsString() + @MaxLength(100) statusMessage?: string; } diff --git a/project/frontend/src/components/profile/ProfileEditModal.tsx b/project/frontend/src/components/profile/ProfileEditModal.tsx index aaddd315..c783ac43 100644 --- a/project/frontend/src/components/profile/ProfileEditModal.tsx +++ b/project/frontend/src/components/profile/ProfileEditModal.tsx @@ -44,13 +44,8 @@ export const ProfileEditModal: React.FC = ({ }); fetchData(); onClose(); - } catch (error) { - if (error instanceof Error) { - alert(`${error.message}`); - console.error('Error saving changes:', error); - } else { - console.error('Non-Error type error:', error); - } + } catch (error: any) { + alert(error?.error?.message ?? '프로필 수정에 실패했습니다.'); } }, [api, newData, onClose, fetchData]); diff --git a/project/frontend/src/components/sign-in/RegisterUser.tsx b/project/frontend/src/components/sign-in/RegisterUser.tsx index 3119f2cc..24a9d1a1 100644 --- a/project/frontend/src/components/sign-in/RegisterUser.tsx +++ b/project/frontend/src/components/sign-in/RegisterUser.tsx @@ -28,14 +28,14 @@ export default function RegisterUser({ try { await api.authControllerRegister({ nickname, imageUrl }); router.push('/friend'); - } catch (error) { + } catch (error: any) { + error?.error?.message && alert(`${error?.error?.message}`); console.error('error', error); } }, [api, imageUrl, nickname, router]); return (
- {/*
*/}

선택한 닉네임: {nickname}

선택한 아바타:

@@ -47,7 +47,6 @@ export default function RegisterUser({ height={100} />
- {/*
*/}
diff --git a/project/frontend/src/hooks/chat/useSocket.ts b/project/frontend/src/hooks/chat/useSocket.ts index ceab99b1..5fbb39bd 100644 --- a/project/frontend/src/hooks/chat/useSocket.ts +++ b/project/frontend/src/hooks/chat/useSocket.ts @@ -1,3 +1,4 @@ +import useToast from '@/components/common/useToast'; import { MessageContentInterface, messageType, @@ -14,7 +15,7 @@ export const useSocket = ( render: object, ) => { const router = useRouter(); - // const { openMessage } = useToast(); + const { openMessage } = useToast(); useEffect(() => { const socket = getSocket(); const localMe = localStorage.getItem('me'); @@ -65,7 +66,7 @@ export const useSocket = ( ) => { socket.on('leave', (res: any) => { if (res.data.member.id === meId) { - // openMessage('채널에서 나갔습니다!'); + openMessage('채널에서 나갔습니다!'); router.replace('/channel'); } else { setMessageWithScrollTarget(render, setMessages, res); @@ -94,9 +95,9 @@ export const useSocket = ( ) { if (targetUserId === meId && channelId === res.data.channelId) { if (res.data.actionType === 'KICK') { - // openMessage('방장이 나가라고 합니다!'); + openMessage('방장이 나가라고 합니다!'); } else { - // openMessage('방장이 채널에서 차단했습니다!'); + openMessage('방장이 채널에서 차단했습니다!'); } router.replace('/channel'); } @@ -105,13 +106,13 @@ export const useSocket = ( channelId === res.data.channelId && targetUserId === meId ) { - // openMessage('관리자가 되었습니다!'); + openMessage('관리자가 되었습니다!'); } else if ( res.data.actionType === 'MUTE' && targetUserId === meId && channelId === res.data.channelId ) { - // openMessage('방장이 1분간 조용히 하래요 ㅠ'); + openMessage('방장이 1분간 조용히 하래요 ㅠ'); } }); }; @@ -130,5 +131,5 @@ export const useSocket = ( socket.off('join'); socket.off('kickBanPromote'); }; - }, [type, setMessages, channelId, router, targetName, render]); + }, [type, setMessages, channelId, router, targetName, render, openMessage]); };