mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
adding
This commit is contained in:
23
src/db/queries/index.ts
Normal file
23
src/db/queries/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
// db/queries.ts
|
||||
import { accounts } from '../schema/accounts'
|
||||
import { db } from '../index';
|
||||
|
||||
// Fetch all accounts
|
||||
export async function getAllAccounts() {
|
||||
return await db.select().from(accounts);
|
||||
}
|
||||
|
||||
// Add a new accounts
|
||||
export async function addAcounts(name: string) {
|
||||
return await db.insertInto(User).values({ name }).returning();
|
||||
}
|
||||
|
||||
// Update a user
|
||||
export async function updateUser(id: number, name: string) {
|
||||
return await db.update(User).set({ name }).where(User.id.equals(id));
|
||||
}
|
||||
|
||||
// Delete a user
|
||||
export async function deleteUser(id: number) {
|
||||
return await db.deleteFrom(User).where(User.id.equals(id));
|
||||
}
|
||||
Reference in New Issue
Block a user