29 lines
1,005 B
TypeScript
29 lines
1,005 B
TypeScript
// @ts-nocheck
|
|
interface CategoriaData {
|
|
id?: string;
|
|
nome?: string;
|
|
[key: string]: any;
|
|
}
|
|
|
|
interface ServiceResponse<T = unknown> {
|
|
success: boolean;
|
|
data?: T;
|
|
documents?: T[];
|
|
total?: number;
|
|
error?: string;
|
|
message?: string;
|
|
}
|
|
|
|
const emptyList = <T,>(): ServiceResponse<T> => ({ success: true, data: [], documents: [], total: 0 });
|
|
const removed = (message = 'Service removido'): ServiceResponse => ({ success: false, error: message, message });
|
|
|
|
export const categoriaService = {
|
|
listarTodas: async () => emptyList<CategoriaData>(),
|
|
listar: async (_page = 1, _limit = 10) => emptyList<CategoriaData>(),
|
|
buscarPorNome: async (_nome: string, _page = 1, _limit = 10) => emptyList<CategoriaData>(),
|
|
buscarPorId: async (_id?: string) => ({ success: true, data: null as CategoriaData | null }),
|
|
criar: async (_data?: CategoriaData) => removed(),
|
|
atualizar: async (_id?: string, _data?: Partial<CategoriaData>) => removed(),
|
|
deletar: async (_id?: string) => removed(),
|
|
};
|
|
|