53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import { ResponseApi } from "./response.types";
|
|
import { CacheState, ErrorState, SelectState } from "./store.types";
|
|
|
|
export interface BackboneRepositoryProps {
|
|
getAll: () => Promise<BackboneDataTable[] | []>;
|
|
getBackboneById: (id: string) => Promise<Backbone>;
|
|
createBackbone: (backbone: BackboneRequest) => Promise<Pick<ResponseApi<any>, "status">>;
|
|
updateBackbone: (id: string, backbone: BackboneRequest) => Promise<Pick<ResponseApi<any>, "status">>;
|
|
getDeviceSelect: () => Promise<SelectState[] | null>;
|
|
}
|
|
|
|
export interface Backbone {
|
|
id: string;
|
|
backbone_code: string;
|
|
longitude: string | number;
|
|
latitude: string | number;
|
|
dev_start_id?: string | number | null;
|
|
dev_end_id?: string | number | null;
|
|
core_amount: string | number;
|
|
created_at: string;
|
|
updated_at: string;
|
|
}
|
|
|
|
export interface BackboneRequest extends Omit<Backbone, "id" & "created_at" & "updated_at"> {}
|
|
|
|
/**
|
|
* Backbone State
|
|
* =============
|
|
*/
|
|
export interface BackboneState extends ErrorState, CacheState {
|
|
data?: BackboneDataTable[];
|
|
backbone?: Backbone | null;
|
|
isLoading: boolean;
|
|
lastUpdate: number | null;
|
|
deviceSelect: SelectState[] | null;
|
|
getDeviceSelect: () => Promise<void>;
|
|
getAll: () => Promise<void>;
|
|
find: (id: string) => Promise<void>;
|
|
create: (backbone: BackboneRequest) => Promise<void>;
|
|
update: (id: string, backbone: BackboneRequest) => Promise<void>;
|
|
clearBackbone: () => void;
|
|
}
|
|
|
|
export interface BackboneDataTable extends Pick<Backbone, "id" | "backbone_code" | "longitude" | "latitude" | "core_amount"> {
|
|
device_start: string;
|
|
device_end: string;
|
|
total_fishbone: string | number;
|
|
}
|
|
|
|
export interface IGetDeviceSelect {
|
|
id: string;
|
|
device_code: string;
|
|
} |