refactor: migrate to typeorm 3.0 (#8443)

* wip

* wip

* wip

* Update following.ts

* wip

* wip

* wip

* Update resolve-user.ts

* maxQueryExecutionTime

* wip

* wip
This commit is contained in:
syuilo
2022-03-26 15:34:00 +09:00
committed by GitHub
parent 41c87074e6
commit 1c67c26bd8
325 changed files with 1314 additions and 1494 deletions

View File

@@ -13,7 +13,7 @@ import { countIf } from '@/prelude/array.js';
import * as url from '@/prelude/url.js';
import { Users, Notes } from '@/models/index.js';
import { makePaginationQuery } from '../api/common/make-pagination-query.js';
import { Brackets } from 'typeorm';
import { Brackets, IsNull } from 'typeorm';
import { Note } from '@/models/entities/note.js';
export default async (ctx: Router.RouterContext) => {
@@ -35,9 +35,9 @@ export default async (ctx: Router.RouterContext) => {
return;
}
const user = await Users.findOne({
const user = await Users.findOneBy({
id: userId,
host: null,
host: IsNull(),
});
if (user == null) {
@@ -99,7 +99,7 @@ export default async (ctx: Router.RouterContext) => {
*/
export async function packActivity(note: Note): Promise<any> {
if (note.renoteId && note.text == null && !note.hasPoll && (note.fileIds == null || note.fileIds.length === 0)) {
const renote = await Notes.findOneOrFail(note.renoteId);
const renote = await Notes.findOneByOrFail({ id: note.renoteId });
return renderAnnounce(renote.uri ? renote.uri : `${config.url}/notes/${renote.id}`, note);
}