mirror of
https://github.com/FranP-code/spend-ia.git
synced 2025-10-13 00:14:09 +00:00
19 lines
403 B
TypeScript
19 lines
403 B
TypeScript
interface User {
|
|
id: string;
|
|
name: string;
|
|
}
|
|
|
|
// Imaginary database
|
|
const users: User[] = [];
|
|
export const db = {
|
|
user: {
|
|
create: async (data: { name: string }) => {
|
|
const user = { id: String(users.length + 1), ...data };
|
|
users.push(user);
|
|
return user;
|
|
},
|
|
findById: async (id: string) => users.find((user) => user.id === id),
|
|
findMany: async () => users,
|
|
},
|
|
};
|