- Change MinIO healthcheck from `mc ready local` to curl-based probe (`curl -sf http://localhost:9000/minio/health/live`) in both docker-compose.yml and docker-compose.prod.yml, matching the approach already used in docker-compose.ci.yml - Add descriptive placeholder for REDIS_PASSWORD in .env.example (was empty, now has CHANGE_ME_IN_PRODUCTION reminder) Co-Authored-By: Paperclip <noreply@paperclip.ing>
70 lines
2.0 KiB
TypeScript
70 lines
2.0 KiB
TypeScript
import { apiClient } from './api-client';
|
|
|
|
// ─── Types ──────────────────────────────────────────────
|
|
|
|
export interface InquiryReadDto {
|
|
id: string;
|
|
listingId: string;
|
|
listingTitle: string;
|
|
userId: string;
|
|
userName: string;
|
|
userPhone: string;
|
|
message: string;
|
|
phone: string | null;
|
|
isRead: boolean;
|
|
createdAt: string;
|
|
}
|
|
|
|
export interface CreateInquiryDto {
|
|
listingId: string;
|
|
message: string;
|
|
phone: string;
|
|
}
|
|
|
|
export interface PaginatedResult<T> {
|
|
data: T[];
|
|
total: number;
|
|
page: number;
|
|
limit: number;
|
|
totalPages: number;
|
|
}
|
|
|
|
export interface ListInquiriesParams {
|
|
page?: number;
|
|
limit?: number;
|
|
}
|
|
|
|
// ─── API Functions ──────────────────────────────────────
|
|
|
|
export const inquiriesApi = {
|
|
/** List all inquiries for current agent */
|
|
getMyInquiries: (params: ListInquiriesParams = {}) => {
|
|
const query = new URLSearchParams();
|
|
if (params.page) query.append('page', String(params.page));
|
|
if (params.limit) query.append('limit', String(params.limit));
|
|
const qs = query.toString();
|
|
return apiClient.get<PaginatedResult<InquiryReadDto>>(
|
|
`/inquiries/agent/me${qs ? `?${qs}` : ''}`,
|
|
);
|
|
},
|
|
|
|
/** List inquiries by listing */
|
|
getByListing: (listingId: string, params: ListInquiriesParams = {}) => {
|
|
const query = new URLSearchParams();
|
|
if (params.page) query.append('page', String(params.page));
|
|
if (params.limit) query.append('limit', String(params.limit));
|
|
const qs = query.toString();
|
|
return apiClient.get<PaginatedResult<InquiryReadDto>>(
|
|
`/inquiries/listing/${listingId}${qs ? `?${qs}` : ''}`,
|
|
);
|
|
},
|
|
|
|
/** Mark an inquiry as read */
|
|
markAsRead: (id: string) =>
|
|
apiClient.patch<{ success: boolean }>(`/inquiries/${id}/read`),
|
|
|
|
/** Create a new inquiry for a listing */
|
|
create: (data: CreateInquiryDto) =>
|
|
apiClient.post<InquiryReadDto>('/inquiries', data),
|
|
};
|