15 lines
366 B
TypeScript
15 lines
366 B
TypeScript
import { sequelize } from "../config/database.js";
|
|
|
|
export async function getUtcTimestamp(): Promise<string | null> {
|
|
if (!sequelize) {
|
|
return null;
|
|
}
|
|
|
|
try {
|
|
const [results] = await sequelize.query("SELECT NOW() AS utc_time");
|
|
const rows = results as { utc_time: string }[];
|
|
return rows[0]?.utc_time ?? null;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|