Cập nhật API thêm trip (validate)
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
API_UPDATE_FISHING_LOGS,
|
||||
API_UPDATE_TRIP_STATUS,
|
||||
API_GET_LAST_TRIP,
|
||||
API_POST_TRIP,
|
||||
} from "@/constants";
|
||||
|
||||
export async function queryTrip() {
|
||||
@@ -31,3 +32,7 @@ export async function queryUpdateFishingLogs(body: Model.FishingLog) {
|
||||
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<Model.Trip>(`${API_POST_TRIP}/${thingId}`, body);
|
||||
}
|
||||
|
||||
22
controller/typings.d.ts
vendored
22
controller/typings.d.ts
vendored
@@ -200,6 +200,28 @@ declare namespace Model {
|
||||
status: number;
|
||||
note?: string;
|
||||
}
|
||||
|
||||
// API body interface for creating a new trip
|
||||
interface TripAPIBody {
|
||||
thing_id?: string;
|
||||
name: string;
|
||||
departure_time: string; // ISO string
|
||||
departure_port_id: number;
|
||||
arrival_time: string; // ISO string
|
||||
arrival_port_id: number;
|
||||
fishing_ground_codes: number[];
|
||||
fishing_gears: Array<{
|
||||
name: string;
|
||||
number: string;
|
||||
}>;
|
||||
trip_cost: Array<{
|
||||
type: string;
|
||||
amount: number;
|
||||
unit: string;
|
||||
cost_per_unit: number;
|
||||
total_cost: number;
|
||||
}>;
|
||||
}
|
||||
//Fish
|
||||
interface FishSpeciesResponse {
|
||||
id: number;
|
||||
|
||||
Reference in New Issue
Block a user