init
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import { ApiBaseResponse, ApiListQueryParams } from "./types"
|
||||
|
||||
export interface CrudOperations {
|
||||
list: <T>(params: ApiListQueryParams) => Promise<ApiBaseResponse<T>>
|
||||
create: <T>(payload: unknown) => Promise<ApiBaseResponse<T>>
|
||||
update: <T>(id: string, payload: unknown) => Promise<ApiBaseResponse<T>>
|
||||
destroy: <T>(id: string) => Promise<ApiBaseResponse<T>>
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
export type ApiBaseResponse<T> = {
|
||||
data: T;
|
||||
meta: {
|
||||
current_page: number,
|
||||
last_page: number,
|
||||
per_page: number,
|
||||
total: number,
|
||||
from: number,
|
||||
to: number
|
||||
}
|
||||
}
|
||||
|
||||
export type ApiListQueryParams = {
|
||||
page?: number;
|
||||
per_page?: number;
|
||||
sort_by?: string;
|
||||
sort_order?: 'asc' | 'desc';
|
||||
[key: string]: any; // For additional filters
|
||||
}
|
||||
Reference in New Issue
Block a user