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

@@ -83,7 +83,7 @@ export default define(meta, paramDef, async (ps, user) => {
// Check blocking
if (note.userId !== user.id) {
const block = await Blockings.findOne({
const block = await Blockings.findOneBy({
blockerId: note.userId,
blockeeId: user.id,
});
@@ -92,7 +92,7 @@ export default define(meta, paramDef, async (ps, user) => {
}
}
const poll = await Polls.findOneOrFail({ noteId: note.id });
const poll = await Polls.findOneByOrFail({ noteId: note.id });
if (poll.expiresAt && poll.expiresAt < createdAt) {
throw new ApiError(meta.errors.alreadyExpired);
@@ -103,7 +103,7 @@ export default define(meta, paramDef, async (ps, user) => {
}
// if already voted
const exist = await PollVotes.find({
const exist = await PollVotes.findBy({
noteId: note.id,
userId: user.id,
});
@@ -125,7 +125,7 @@ export default define(meta, paramDef, async (ps, user) => {
noteId: note.id,
userId: user.id,
choice: ps.choice,
}).then(x => PollVotes.findOneOrFail(x.identifiers[0]));
}).then(x => PollVotes.findOneByOrFail(x.identifiers[0]));
// Increment votes count
const index = ps.choice + 1; // In SQL, array index is 1 based
@@ -144,7 +144,7 @@ export default define(meta, paramDef, async (ps, user) => {
});
// Fetch watchers
NoteWatchings.find({
NoteWatchings.findBy({
noteId: note.id,
userId: Not(user.id),
}).then(watchers => {
@@ -159,7 +159,7 @@ export default define(meta, paramDef, async (ps, user) => {
// リモート投票の場合リプライ送信
if (note.userHost != null) {
const pollOwner = await Users.findOneOrFail(note.userId) as IRemoteUser;
const pollOwner = await Users.findOneByOrFail({ id: note.userId }) as IRemoteUser;
deliver(user, renderActivity(await renderVote(user, vote, note, poll, pollOwner)), pollOwner.inbox);
}