24 lines
626 B
TypeScript
24 lines
626 B
TypeScript
import type { Antenna } from "@/models/entities/antenna.js";
|
|
import type { Note } from "@/models/entities/note.js";
|
|
import { getTimestamp } from "@/misc/gen-id.js";
|
|
import { redisClient } from "@/db/redis.js";
|
|
import { publishAntennaStream } from "@/services/stream.js";
|
|
import type { User } from "@/models/entities/user.js";
|
|
|
|
export async function addNoteToAntenna(
|
|
antenna: Antenna,
|
|
note: Note,
|
|
_noteUser: { id: User["id"] },
|
|
) {
|
|
redisClient.xadd(
|
|
`antennaTimeline:${antenna.id}`,
|
|
"MAXLEN",
|
|
"~",
|
|
"200",
|
|
`${getTimestamp(note.id)}-*`,
|
|
"note",
|
|
note.id,
|
|
);
|
|
|
|
publishAntennaStream(antenna.id, "note", note);
|
|
}
|