import { api } from "@/config"; import { API_GET_TRIP, API_HAUL_HANDLE, API_POST_TRIPSLIST, API_UPDATE_FISHING_LOGS, API_UPDATE_TRIP_STATUS, API_GET_LAST_TRIP, API_POST_TRIP, API_PUT_TRIP, API_TRIP_CREW, API_GET_TRIP_BY_ID, API_TRIP_APPROVE_REQUEST, API_TRIP_CANCEL_REQUEST, } from "@/constants"; export async function queryTrip() { return api.get(API_GET_TRIP); } export async function queryTripById(tripId: string) { return api.get(`${API_GET_TRIP_BY_ID}/${tripId}`); } export async function queryLastTrip(thingId: string) { return api.get(`${API_GET_LAST_TRIP}/${thingId}`); } export async function queryUpdateTripState(body: Model.TripUpdateStateRequest) { return api.put(API_UPDATE_TRIP_STATUS, body); } export async function queryStartNewHaul(body: Model.NewFishingLogRequest) { return api.put(API_HAUL_HANDLE, body); } export async function queryUpdateFishingLogs(body: Model.FishingLog) { return api.put(API_UPDATE_FISHING_LOGS, body); } export async function queryTripsList(body: Model.TripListBody) { return api.post(API_POST_TRIPSLIST, body); } export async function createTrip(thingId: string, body: Model.TripAPIBody) { return api.post(`${API_POST_TRIP}/${thingId}`, body); } export async function updateTrip(tripId: string, body: Model.TripAPIBody) { return api.put(`${API_PUT_TRIP}/${tripId}`, body); } export async function tripApproveRequest(tripId: string) { return api.put(`${API_TRIP_APPROVE_REQUEST}/${tripId}`); } export async function tripCancelRequest(tripId: string) { return api.put(`${API_TRIP_CANCEL_REQUEST}/${tripId}`); }