refactor(server): use insert instead of save
This commit is contained in:
parent
4a64280a7c
commit
6be1db00d1
9 changed files with 19 additions and 18 deletions
|
|
@ -59,14 +59,14 @@ export const meta = {
|
|||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, async (ps) => {
|
||||
const announcement = await Announcements.save({
|
||||
const announcement = await Announcements.insert({
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
updatedAt: null,
|
||||
title: ps.title,
|
||||
text: ps.text,
|
||||
imageUrl: ps.imageUrl,
|
||||
});
|
||||
}).then(x => Announcements.findOneOrFail(x.identifiers[0]));
|
||||
|
||||
return announcement;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export default define(meta, async (ps, me) => {
|
|||
|
||||
const name = file.name.split('.')[0].match(/^[a-z0-9_]+$/) ? file.name.split('.')[0] : `_${rndstr('a-z0-9', 8)}_`;
|
||||
|
||||
const emoji = await Emojis.save({
|
||||
const emoji = await Emojis.insert({
|
||||
id: genId(),
|
||||
updatedAt: new Date(),
|
||||
name: name,
|
||||
|
|
@ -47,7 +47,7 @@ export default define(meta, async (ps, me) => {
|
|||
aliases: [],
|
||||
url: file.url,
|
||||
type: file.type,
|
||||
});
|
||||
}).then(x => Emojis.findOneOrFail(x.identifiers[0]));
|
||||
|
||||
await getConnection().queryResultCache!.remove(['meta_emojis']);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue