Skip to content

Commit

Permalink
Merge branch 'main' into feat-message-pagination-#183
Browse files Browse the repository at this point in the history
  • Loading branch information
wken5577 committed Dec 16, 2023
2 parents 09664c4 + 6736bd1 commit b817c3a
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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 :)"
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.organizeImports": "explicit"
},
"[prisma]": {
"editor.formatOnSave": true,
Expand Down
4 changes: 2 additions & 2 deletions project/backend/.env.sample.dev
Original file line number Diff line number Diff line change
Expand Up @@ -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 :)"
Expand Down
4 changes: 2 additions & 2 deletions project/backend/src/channel/dto/message-pagination.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
3 changes: 2 additions & 1 deletion project/backend/src/users/dto/update-user.dto.ts
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -25,5 +25,6 @@ export class UpdateUserDto {
@ApiPropertyOptional({ description: '프로필 상태 메세지', required: false })
@IsOptional()
@IsString()
@MaxLength(100)
statusMessage?: string;
}
9 changes: 2 additions & 7 deletions project/frontend/src/components/profile/ProfileEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,8 @@ export const ProfileEditModal: React.FC<ModalProfileProps> = ({
});
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]);

Expand Down
5 changes: 2 additions & 3 deletions project/frontend/src/components/sign-in/RegisterUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="w-xl h-xl bg-light-background border-2 border-dark-purple rounded-lg flex flex-col gap-xl justify-center items-start p-xl">
{/* <form encType="multipart/form-data"> */}
<p className="font-semibold text-h3">선택한 닉네임: {nickname}</p>
<div className="flex flex-row items-center">
<p className="font-semibold text-h3">선택한 아바타: </p>
Expand All @@ -47,7 +47,6 @@ export default function RegisterUser({
height={100}
/>
</div>
{/* </form> */}
<div className="self-end">
<Button onClick={handleSubmitClick}>가입하기!</Button>
</div>
Expand Down
15 changes: 8 additions & 7 deletions project/frontend/src/hooks/chat/useSocket.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import useToast from '@/components/common/useToast';
import {
MessageContentInterface,
messageType,
Expand All @@ -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');
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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');
}
Expand All @@ -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분간 조용히 하래요 ㅠ');
}
});
};
Expand All @@ -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]);
};

0 comments on commit b817c3a

Please sign in to comment.