call API trip

This commit is contained in:
2025-11-05 23:47:54 +07:00
parent 62b18e5bc0
commit 6288e79622
7 changed files with 115 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
import { api } from "@/config";
import { API_GET_TRIP } from "@/constants";
export async function queryTrip() {
return api.get<Model.Trip>(API_GET_TRIP);
}

View File

@@ -1,4 +1,5 @@
import * as AuthController from "./AuthController";
import * as DeviceController from "./DeviceController";
import * as MapController from "./MapController";
export { AuthController, DeviceController, MapController };
import * as TripController from "./TripController";
export { AuthController, DeviceController, MapController, TripController };

View File

@@ -90,4 +90,75 @@ declare namespace Model {
message?: string;
started_at?: number;
}
// Trip
interface Trip {
id: string;
ship_id: string;
ship_length: number;
vms_id: string;
name: string;
fishing_gears: FishingGear[]; // Dụng cụ đánh cá
crews?: TripCrews[]; // Thuyền viên
departure_time: string; // ISO datetime string
departure_port_id: number;
arrival_time: string; // ISO datetime string
arrival_port_id: number;
fishing_ground_codes: number[];
total_catch_weight: number | null;
total_species_caught: number | null;
trip_cost: TripCost[]; // Chi phí chuyến đi
trip_status: number;
approved_by: string;
notes: string | null;
fishing_logs: FishingLog[] | null; // tuỳ dữ liệu chi tiết có thể định nghĩa thêm
sync: boolean;
}
// Dụng cụ đánh cá
interface FishingGear {
name: string;
number: string;
}
// Thuyền viên
interface TripCrews {
role: string;
joined_at: Date;
left_at: Date | null;
note: string | null;
Person: TripCrewPerson;
}
// Chi phí chuyến đi
interface TripCost {
type: string;
unit: string;
amount: string;
total_cost: string;
cost_per_unit: string;
}
// Thông tin mẻ lưới
interface FishingLog {
fishing_log_id: string;
trip_id: string;
start_at: Date; // ISO datetime
end_at: Date; // ISO datetime
start_lat: number;
start_lon: number;
haul_lat: number;
haul_lon: number;
status: number;
weather_description: string;
info?: FishingLogInfo[]; // Thông tin cá
sync: boolean;
}
// Thông tin cá
interface FishingLogInfo {
fish_species_id?: number;
fish_name?: string;
catch_number?: number;
catch_unit?: string;
fish_size?: number;
fish_rarity?: number;
fish_condition?: string;
gear_usage?: string;
}
}