Skip to content

Instantly share code, notes, and snippets.

@brandonchadlange
Created October 10, 2022 20:55
Show Gist options
  • Save brandonchadlange/5f6aa2f51107eef84ab526f658ddc6ff to your computer and use it in GitHub Desktop.
Save brandonchadlange/5f6aa2f51107eef84ab526f658ddc6ff to your computer and use it in GitHub Desktop.
A simple interface for defining CRUD services
export interface ICrudService<T> {
getAll: () => Promise<T[]>;
getOne: (id: string) => Promise<T | null>;
create: (data: T) => Promise<T>;
update: (id: string, data: T) => Promise<T>;
delete: (id: string) => Promise<T>;
}
@yogithesymbian
Copy link

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment