mirror of
https://git.joinfirefish.org/firefish/firefish.git
synced 2024-05-19 07:51:11 +02:00
f60ff2eaf4
Co-authored-by: sup39 <dev@sup39.dev>
21 lines
560 B
TypeScript
21 lines
560 B
TypeScript
import type { User } from "@/models/entities/user.js";
|
|
import type { Note } from "@/models/entities/note.js";
|
|
import { NoteWatchings } from "@/models/index.js";
|
|
import { genId } from "backend-rs";
|
|
import type { NoteWatching } from "@/models/entities/note-watching.js";
|
|
|
|
export default async (me: User["id"], note: Note) => {
|
|
// 自分の投稿はwatchできない
|
|
if (me === note.userId) {
|
|
return;
|
|
}
|
|
|
|
await NoteWatchings.insert({
|
|
id: genId(),
|
|
createdAt: new Date(),
|
|
noteId: note.id,
|
|
userId: me,
|
|
noteUserId: note.userId,
|
|
} as NoteWatching);
|
|
};
|