init: 个人简历项目文件

This commit is contained in:
2026-05-16 23:27:09 +08:00
commit 90b2c049ce
124 changed files with 23324 additions and 0 deletions
@@ -0,0 +1,35 @@
import { eq } from "drizzle-orm";
import * as schema from "@db/schema";
import type { InsertUser } from "@db/schema";
import { getDb } from "./connection";
export async function findUserByUnionId(unionId: string) {
const rows = await getDb()
.select()
.from(schema.users)
.where(eq(schema.users.unionId, unionId))
.limit(1);
return rows.at(0);
}
export async function findUserById(id: number) {
const rows = await getDb()
.select()
.from(schema.users)
.where(eq(schema.users.id, id))
.limit(1);
return rows.at(0);
}
export async function upsertUser(data: InsertUser) {
await getDb()
.insert(schema.users)
.values(data)
.onDuplicateKeyUpdate({
set: {
lastSignInAt: new Date(),
name: data.name,
avatar: data.avatar,
},
});
}