diff options
-rw-r--r-- | src/api/routes/users/@me/notes.ts | 6 | ||||
-rw-r--r-- | src/api/util/handlers/Message.ts | 2 | ||||
-rw-r--r-- | src/util/util/Database.ts | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/api/routes/users/@me/notes.ts b/src/api/routes/users/@me/notes.ts index 64730c1a..f82c3ca1 100644 --- a/src/api/routes/users/@me/notes.ts +++ b/src/api/routes/users/@me/notes.ts @@ -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({ diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts index e514d400..8fbbf4bf 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts @@ -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, diff --git a/src/util/util/Database.ts b/src/util/util/Database.ts index 5c5c8b4c..5d48ac03 100644 --- a/src/util/util/Database.ts +++ b/src/util/util/Database.ts @@ -127,10 +127,10 @@ export async function initDatabase(): Promise<DataSource> { // Manually insert every current migration to prevent this: await Promise.all( dbConnection.migrations.map((migration) => - Migration.insert({ + Migration.create({ name: migration.name, timestamp: Date.now(), - }), + }).save(), ), ); } else { |