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

@@ -18,6 +18,6 @@ export default async (actor: CacheableRemoteUser, activity: IBlock): Promise<str
return `skip: ブロックしようとしているユーザーはローカルユーザーではありません`;
}
await block(await Users.findOneOrFail(actor.id), blockee);
await block(await Users.findOneByOrFail({ id: actor.id }), blockee);
return `ok`;
};

View File

@@ -12,7 +12,7 @@ export async function deleteActor(actor: CacheableRemoteUser, uri: string): Prom
return `skip: delete actor ${actor.uri} !== ${uri}`;
}
const user = await Users.findOneOrFail(actor.id);
const user = await Users.findOneByOrFail({ id: actor.id });
if (user.isDeleted) {
logger.info(`skip: already deleted`);
}

View File

@@ -11,7 +11,7 @@ export default async (actor: CacheableRemoteUser, activity: IFlag): Promise<stri
const uris = getApIds(activity.object);
const userIds = uris.filter(uri => uri.startsWith(config.url + '/users/')).map(uri => uri.split('/').pop()!);
const users = await Users.find({
const users = await Users.findBy({
id: In(userIds),
});
if (users.length < 1) return `skip`;

View File

@@ -13,7 +13,7 @@ export const performReadActivity = async (actor: CacheableRemoteUser, activity:
const messageId = id.split('/').pop();
const message = await MessagingMessages.findOne(messageId);
const message = await MessagingMessages.findOneBy({ id: messageId });
if (message == null) {
return `skip: message not found`;
}

View File

@@ -13,7 +13,7 @@ export default async (actor: CacheableRemoteUser, activity: IAccept): Promise<st
return `skip: follower not found`;
}
const following = await Followings.findOne({
const following = await Followings.findOneBy({
followerId: follower.id,
followeeId: actor.id,
});

View File

@@ -6,7 +6,7 @@ import deleteNote from '@/services/note/delete.js';
export const undoAnnounce = async (actor: CacheableRemoteUser, activity: IAnnounce): Promise<string> => {
const uri = getApId(activity);
const note = await Notes.findOne({
const note = await Notes.findOneBy({
uri,
});

View File

@@ -16,6 +16,6 @@ export default async (actor: CacheableRemoteUser, activity: IBlock): Promise<str
return `skip: ブロック解除しようとしているユーザーはローカルユーザーではありません`;
}
await unblock(await Users.findOneOrFail(actor.id), blockee);
await unblock(await Users.findOneByOrFail({ id: actor.id }), blockee);
return `ok`;
};

View File

@@ -17,12 +17,12 @@ export default async (actor: CacheableRemoteUser, activity: IFollow): Promise<st
return `skip: フォロー解除しようとしているユーザーはローカルユーザーではありません`;
}
const req = await FollowRequests.findOne({
const req = await FollowRequests.findOneBy({
followerId: actor.id,
followeeId: followee.id,
});
const following = await Followings.findOne({
const following = await Followings.findOneBy({
followerId: actor.id,
followeeId: followee.id,
});