16 lines
406 B
JavaScript
16 lines
406 B
JavaScript
import { NoteWatchings } from "../../models/index.js";
|
|
import { genId } from "../../misc/gen-id.js";
|
|
export default (async (me, note)=>{
|
|
// 自分の投稿はwatchできない
|
|
if (me === note.userId) {
|
|
return;
|
|
}
|
|
await NoteWatchings.insert({
|
|
id: genId(),
|
|
createdAt: new Date(),
|
|
noteId: note.id,
|
|
userId: me,
|
|
noteUserId: note.userId
|
|
});
|
|
});
|