mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
14 lines
267 B
TypeScript
14 lines
267 B
TypeScript
import { Token } from "~database/entities/Token";
|
|
|
|
export const getUserByToken = async (access_token: string | null) => {
|
|
if (!access_token) return null;
|
|
|
|
const token = await Token.findOneBy({
|
|
access_token,
|
|
});
|
|
|
|
if (!token) return null;
|
|
|
|
return token.user;
|
|
};
|