Files
dognation_PT/src/api/spots.ts
T
sb eb51201669
CI / build (push) Failing after 11m51s
feat: 강아지 등록 중성화 필수 선택 + AI 추천 중성화 조건 옵션
- 등록 폼: 중성화 여부(완료/안 함) 필수 토글, 미선택 시 등록 불가
- AI 추천: 중성화 찾기 옵션(상관없음/완료/안 함) → 조건 강아지 중에서만 추천

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

56 lines
1.4 KiB
TypeScript

import { http } from './http'
export interface Spot {
id: number
name: string
type: string
latitude: number | null
longitude: number | null
}
export interface Mate {
dogId: number
name: string
breed: string | null
}
export interface AiMate {
dogId: number
name: string
breed: string | null
score: number
reason: string
}
export interface Review {
id: number
tag: string | null
content: string | null
createdAt: string
}
export interface CheckInResult {
id: number
spotId: number
dogId: number
expiresAt: string
}
export const spotsApi = {
list: () => http.get<Spot[]>('/api/spots'),
mates: (spotId: number, userId?: number) =>
http.get<Mate[]>(`/api/spots/${spotId}/mates${userId ? `?userId=${userId}` : ''}`),
aiMates: (spotId: number, dogId: number, neutered?: boolean) =>
http.get<AiMate[]>(
`/api/spots/${spotId}/ai-mates?dogId=${dogId}` +
(neutered != null ? `&neutered=${neutered}` : ''),
),
frequentBreeds: (spotId: number) =>
http.get<{ breeds: string[] }>(`/api/spots/${spotId}/frequent-breeds`),
reviews: (spotId: number) => http.get<Review[]>(`/api/spots/${spotId}/reviews`),
checkIn: (spotId: number, userId: number, dogId: number) =>
http.post<CheckInResult>(`/api/spots/${spotId}/checkins`, { userId, dogId }),
addReview: (spotId: number, userId: number, tag: string) =>
http.post<Review>(`/api/spots/${spotId}/reviews`, { userId, tag }),
}