- types/purchase: Purchase·PurchaseInsert에 quantity 필드 추가 - usePurchases: totalSpent·categoryBreakdown를 price×quantity 기준으로 변경 - extractErrorMessage 헬퍼 추가 (Supabase PostgrestError 메시지 정확히 추출) - pages/purchases/index: 수량 컬럼 추가, 가격 셀에 합계(단가×수량) 표시 - PurchaseForm: 수량 입력, 세미콜론(;) → ×1000 단가 변환, 합계 미리보기 - PurchaseExcelUpload: 수량 파싱·검증, 단가/수량/합계 컬럼 분리 - 카테고리 셀 → USelect 인라인 수정 및 즉시 재검증 - 템플릿에 수량 컬럼 추가 (단가 → 수량 순서) - 저장 실패 시 실제 오류 메시지 표시
58 lines
1.1 KiB
TypeScript
58 lines
1.1 KiB
TypeScript
export type EquipmentCategory =
|
|
| 'tent'
|
|
| 'sleeping'
|
|
| 'cooking'
|
|
| 'lighting'
|
|
| 'clothing'
|
|
| 'backpack'
|
|
| 'furniture'
|
|
| 'safety'
|
|
| 'electronics'
|
|
| 'other'
|
|
|
|
export const CATEGORY_LABELS: Record<EquipmentCategory, string> = {
|
|
tent: '텐트',
|
|
sleeping: '침낭/매트',
|
|
cooking: '취사도구',
|
|
lighting: '조명',
|
|
clothing: '의류',
|
|
backpack: '배낭',
|
|
furniture: '가구',
|
|
safety: '안전장비',
|
|
electronics: '전자기기',
|
|
other: '기타'
|
|
}
|
|
|
|
export const CATEGORY_OPTIONS = Object.entries(CATEGORY_LABELS).map(([value, label]) => ({
|
|
value: value as EquipmentCategory,
|
|
label
|
|
}))
|
|
|
|
export interface Purchase {
|
|
id: string
|
|
user_id: string
|
|
name: string
|
|
category: EquipmentCategory
|
|
brand?: string
|
|
price: number
|
|
quantity: number
|
|
purchase_date: string
|
|
store?: string
|
|
warranty_until?: string
|
|
notes?: string
|
|
created_at: string
|
|
updated_at: string
|
|
}
|
|
|
|
export interface PurchaseInsert {
|
|
name: string
|
|
category: EquipmentCategory
|
|
brand?: string
|
|
price: number
|
|
quantity: number
|
|
purchase_date: string
|
|
store?: string
|
|
warranty_until?: string
|
|
notes?: string
|
|
}
|