Files
dognation_PT/src/api/affinity.ts
T
sb c8a8681a61
CI / build (push) Successful in 27s
feat: 찰떡지수 피드백 UI (우리/동네 궁합도)
- FeedbackDialog: 잘 놀았어요/안 맞았어요 + BAD 사유 선택·추가입력
- 채팅 '산책 완료' 버튼 + 2시간 FEEDBACK_REQUEST 알림 → 피드백 팝업
- AffinityBadges: 동네 찰떡지수(전체), 우리 찰떡지수(매칭 쌍·유료 게이팅)
  스팟 메이트/AI 추천 카드 및 우리 강아지 프로필에 노출

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 23:55:16 +09:00

32 lines
1.1 KiB
TypeScript

import { http } from './http'
export type FeedbackVerdict = 'GOOD' | 'BAD'
/** 동네 찰떡지수 (전체 노출). */
export interface NeighborhoodScore {
percent: number
label: string
}
/**
* 우리 찰떡지수 (1회 이상 매칭된 쌍만).
* - locked=true : 무료회원 → "유료회원 전용"
* - matched=false: 매칭 이력 없음 → 미노출
*/
export interface PairScore {
matched: boolean
locked: boolean
percent: number
label: string
}
export const affinityApi = {
/** 산책 후 피드백 제출 → 우리/동네 찰떡지수 반영. */
feedback: (matchId: number, raterDogId: number, verdict: FeedbackVerdict, reasons?: string) =>
http.post<void>(`/api/affinity/matches/${matchId}/feedback`, { raterDogId, verdict, reasons }),
/** 동네 찰떡지수. */
neighborhood: (dogId: number) => http.get<NeighborhoodScore>(`/api/affinity/neighborhood/${dogId}`),
/** 우리 찰떡지수 — viewerDogId(내 강아지) 기준. */
pair: (viewerDogId: number, otherDogId: number) =>
http.get<PairScore>(`/api/affinity/pair?viewerDogId=${viewerDogId}&otherDogId=${otherDogId}`),
}