fix (backend): make sure to use the exact same time for id and createdAt

This commit is contained in:
naskya 2024-05-29 19:14:00 +09:00 committed by Eana Hufwe
parent def565af9b
commit db4e0e931b

View file

@ -8,7 +8,7 @@ import {
Followings, Followings,
} from "@/models/index.js"; } from "@/models/index.js";
import { import {
genId, genIdAt,
isSilencedServer, isSilencedServer,
sendPushNotification, sendPushNotification,
PushNotificationKind, PushNotificationKind,
@ -63,9 +63,10 @@ export async function createNotification(
} }
// Create notification // Create notification
const createdAt = new Date();
const notification = await Notifications.insert({ const notification = await Notifications.insert({
id: genId(), id: genIdAt(createdAt),
createdAt: new Date(), createdAt,
notifieeId: notifieeId, notifieeId: notifieeId,
type: type, type: type,
// 相手がこの通知をミュートしているようなら、既読を予めつけておく // 相手がこの通知をミュートしているようなら、既読を予めつけておく