32 lines
1.1 KiB
TypeScript
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}`),
|
||
|
|
}
|