refactor(database): ♻️ Simplify User and Note logic further

This commit is contained in:
Jesse Wierzbinski 2024-12-09 13:50:46 +01:00
parent a8541bdc44
commit 83399ba5f1
No known key found for this signature in database
6 changed files with 67 additions and 107 deletions

View file

@ -15,14 +15,7 @@ import type {
Note as VersiaNote,
User as VersiaUser,
} from "@versia/federation/types";
import {
Instance,
Like,
Note,
Notification,
Relationship,
User,
} from "@versia/kit/db";
import { Instance, Like, Note, Relationship, User } from "@versia/kit/db";
import { Likes, Notes } from "@versia/kit/tables";
import type { SocketAddress } from "bun";
import chalk from "chalk";
@ -340,11 +333,10 @@ export class InboxProcessor {
languages: [],
});
await Notification.insert({
accountId: author.id,
type: followee.data.isLocked ? "follow_request" : "follow",
notifiedId: followee.id,
});
await followee.createNotification(
followee.data.isLocked ? "follow_request" : "follow",
author,
);
if (!followee.data.isLocked) {
await followee.sendFollowAccept(author);