mirror of
https://github.com/FranP-code/spend-ia.git
synced 2025-10-13 00:14:09 +00:00
feat: added monorepo
This commit is contained in:
18
packages/server/db.ts
Normal file
18
packages/server/db.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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,
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user