diff --git a/src/api/chat.ts b/src/api/chat.ts index feb3f32..ad028b3 100644 --- a/src/api/chat.ts +++ b/src/api/chat.ts @@ -2,7 +2,8 @@ import { http } from './http' export interface ChatMessage { id: number - spotId: number + spotId: number | null + matchId: number | null senderId: number senderNickname: string content: string @@ -11,4 +12,6 @@ export interface ChatMessage { export const chatApi = { history: (spotId: number) => http.get(`/api/chat/spots/${spotId}/messages`), + matchHistory: (matchId: number) => + http.get(`/api/chat/matches/${matchId}/messages`), } diff --git a/src/api/matches.ts b/src/api/matches.ts index 57892d2..85b1b9d 100644 --- a/src/api/matches.ts +++ b/src/api/matches.ts @@ -6,13 +6,33 @@ export interface Match { targetDogId: number status: string createdAt: string + expiresAt: string | null respondedAt: string | null } +/** 받은 매칭 신청 (신청 견 정보 포함) — 수락/거절 UI용. */ +export interface ReceivedMatch { + id: number + requesterDogId: number + requesterDogName: string + requesterDogBreed: string | null + createdAt: string + expiresAt: string | null +} + +/** STOMP /topic/users/{userId} 로 오는 매칭 알림. */ +export interface MatchNotification { + type: 'NEW_REQUEST' | 'ACCEPTED' | 'REJECTED' | 'EXPIRED' + matchId: number + title: string + message: string +} + export const matchesApi = { create: (requesterDogId: number, targetDogId: number) => http.post('/api/matches', { requesterDogId, targetDogId }), accept: (id: number) => http.post(`/api/matches/${id}/accept`), reject: (id: number) => http.post(`/api/matches/${id}/reject`), - received: (dogId: number) => http.get(`/api/matches/received/${dogId}`), + received: (dogId: number) => http.get(`/api/matches/received/${dogId}`), + sent: (dogId: number) => http.get(`/api/matches/sent/${dogId}`), } diff --git a/src/components/MatchChatDialog.vue b/src/components/MatchChatDialog.vue new file mode 100644 index 0000000..7fa90a7 --- /dev/null +++ b/src/components/MatchChatDialog.vue @@ -0,0 +1,144 @@ + + + + + \ No newline at end of file diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index aea6b4a..4eb4509 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -8,6 +8,37 @@ {{ tierLabel }} + + + + + {{ matching.received.length }} + + + + 받은 매칭 신청 + + 받은 신청이 없어요. + + + + + + + {{ r.requesterDogName }} + {{ r.requesterDogBreed || '견종 미상' }} · 매칭 신청 + + +
+ + +
+
+
+
+
+
+ @@ -46,22 +77,73 @@ + + +