mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
update user backend + frontend server function
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { User } from "@issue/shared";
|
||||
import { User, type UserRecord } from "@issue/shared";
|
||||
import { eq } from "drizzle-orm";
|
||||
import { db } from "../client";
|
||||
|
||||
@@ -16,3 +16,11 @@ export async function getUserByUsername(username: string) {
|
||||
const [user] = await db.select().from(User).where(eq(User.username, username));
|
||||
return user;
|
||||
}
|
||||
|
||||
export async function updateById(
|
||||
id: number,
|
||||
updates: { name?: string; passwordHash?: string; serverURL?: string },
|
||||
): Promise<UserRecord | undefined> {
|
||||
const [user] = await db.update(User).set(updates).where(eq(User.id, id)).returning();
|
||||
return user;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user