15 lines
343 B
TypeScript
15 lines
343 B
TypeScript
import { getCollection } from "../mongodb";
|
|
|
|
export type User = {
|
|
_id: string;
|
|
name: string;
|
|
role: number;
|
|
account: string;
|
|
password: string;
|
|
}
|
|
export async function getUser(account: string) {
|
|
const collection = await getCollection('user')
|
|
const user = await collection.findOne<User>({ account })
|
|
|
|
return user
|
|
} |