| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import { http } from '../http/client'
- import type {
- CustomerDashboardSummary,
- CustomerDetailEntity,
- CustomerEntity,
- PaginatedCustomerList,
- } from './contracts'
- export type {
- CustomerDashboardSummary,
- CustomerDetailEntity,
- CustomerEntity,
- PaginatedCustomerList,
- } from './contracts'
- export type CustomerUpsertInput = {
- name: string
- namePronunciation?: string
- phone: string
- email?: string
- birthday?: string
- avatar?: string
- expectContact?: 'LINE' | 'PHONE' | 'EMAIL' | 'NONE'
- hairLength?: 'SHORT' | 'MEDIUM' | 'LONG' | 'UNCONFIRM'
- hairTexture?: 'UNCONFIRM' | 'THIN' | 'NORMAL' | 'HARD_CRUDE' | 'CURLY'
- notice?: string
- allergy?: string
- innerRemark?: string
- nextFollowDate?: string
- recommendVisitDate?: string
- firstSuggestHair?: 'AUTO' | 'LONG' | 'MEDIUM' | 'SHORT'
- planDate?: string
- visitPurpose?: 'CUT_DYE' | 'CUT' | 'DYE' | 'CONSULT_SIM'
- trouble?: string
- consultContent?: string
- expectLook?: string
- }
- export async function listCustomers(
- params: {
- page?: number
- pageSize?: number
- q?: string
- visitStatus?: string
- followStatus?: string
- hairLength?: string
- } = {},
- ): Promise<PaginatedCustomerList> {
- const query = new URLSearchParams()
- if (params.page) query.set('page', String(params.page))
- if (params.pageSize) query.set('pageSize', String(params.pageSize))
- if (params.q) query.set('q', params.q)
- if (params.visitStatus) query.set('visitStatus', params.visitStatus)
- if (params.followStatus) query.set('followStatus', params.followStatus)
- if (params.hairLength) query.set('hairLength', params.hairLength)
- const qs = query.toString()
- return http.get<PaginatedCustomerList>(`/customers${qs ? `?${qs}` : ''}`)
- }
- export async function createCustomer(input: CustomerUpsertInput): Promise<CustomerEntity> {
- return http.post<CustomerEntity>('/customers', input)
- }
- export async function getCustomerById(customerId: string): Promise<CustomerDetailEntity> {
- return http.get<CustomerDetailEntity>(`/customers/${customerId}`)
- }
- export async function getCustomerDashboardSummary(): Promise<CustomerDashboardSummary> {
- return http.get<CustomerDashboardSummary>('/customers/summary')
- }
|