fix: use entity.save() instead of insert (needed for caching)

This commit is contained in:
Samuel
2023-03-18 04:13:04 +01:00
parent 52f8508b38
commit 7b00e99053
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -52,17 +52,17 @@ router.put("/:id", route({}), async (req: Request, res: Response) => {
where: { owner: { id: owner.id }, target: { id: target.id } },
})
) {
Note.update(
await Note.update(
{ owner: { id: owner.id }, target: { id: target.id } },
{ owner, target, content: note },
);
} else {
Note.insert({
await Note.create({
id: Snowflake.generate(),
owner,
target,
content: note,
});
}).save();
}
} else {
await Note.delete({
+1 -1
View File
@@ -274,7 +274,7 @@ export async function sendMessage(opts: MessageOptions) {
const message = await handleMessage({ ...opts, timestamp: new Date() });
await Promise.all([
Message.insert(message),
message.save(),
emitEvent({
event: "MESSAGE_CREATE",
channel_id: opts.channel_id,