accounts stuff

This commit is contained in:
2024-11-22 14:56:37 -05:00
parent 4f461cfc40
commit c0ae295734
5 changed files with 24 additions and 16 deletions

View File

@@ -1,4 +1,6 @@
// db/queries.ts
"use server";
import { eq, not , asc} from "drizzle-orm";
import { Account } from '../schema/Account'
import { db } from '../index';
@@ -14,10 +16,10 @@ export async function addAcount(first_name: string, last_name : string, username
// Update a account
export async function updateAcount(id: number, first_name: string, last_name : string, username : string, password_hash: string ) {
return await db.update(Account).set({ first_name, last_name, username, password_hash }).where(Account.id.equals(id));
return await db.update(Account).set({ first_name, last_name, username, password_hash }).where(eq(Account.id, id));
}
// Delete a account
export async function deleteAccount(id: number) {
return await db.delete(Account).where(Account.id.equals(id));
return await db.delete(Account).where(eq(Account.id, id));
}