refactor(backend): exist -> exists (#13203)

* refactor(backend): exist -> exists

* fix
This commit is contained in:
かっこかり 2024-02-08 16:04:41 +09:00 committed by GitHub
parent 90b633b5a6
commit 0f7918c51b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 64 additions and 64 deletions

View file

@ -385,7 +385,7 @@ export class CustomEmojiService implements OnApplicationShutdown {
*/ */
@bindThis @bindThis
public checkDuplicate(name: string): Promise<boolean> { public checkDuplicate(name: string): Promise<boolean> {
return this.emojisRepository.exist({ where: { name, host: IsNull() } }); return this.emojisRepository.exists({ where: { name, host: IsNull() } });
} }
@bindThis @bindThis

View file

@ -603,7 +603,7 @@ export class NoteCreateService implements OnApplicationShutdown {
if (data.reply) { if (data.reply) {
// 通知 // 通知
if (data.reply.userHost === null) { if (data.reply.userHost === null) {
const isThreadMuted = await this.noteThreadMutingsRepository.exist({ const isThreadMuted = await this.noteThreadMutingsRepository.exists({
where: { where: {
userId: data.reply.userId, userId: data.reply.userId,
threadId: data.reply.threadId ?? data.reply.id, threadId: data.reply.threadId ?? data.reply.id,
@ -741,7 +741,7 @@ export class NoteCreateService implements OnApplicationShutdown {
@bindThis @bindThis
private async createMentionedEvents(mentionedUsers: MinimumUser[], note: MiNote, nm: NotificationManager) { private async createMentionedEvents(mentionedUsers: MinimumUser[], note: MiNote, nm: NotificationManager) {
for (const u of mentionedUsers.filter(u => this.userEntityService.isLocalUser(u))) { for (const u of mentionedUsers.filter(u => this.userEntityService.isLocalUser(u))) {
const isThreadMuted = await this.noteThreadMutingsRepository.exist({ const isThreadMuted = await this.noteThreadMutingsRepository.exists({
where: { where: {
userId: u.id, userId: u.id,
threadId: note.threadId ?? note.id, threadId: note.threadId ?? note.id,

View file

@ -49,7 +49,7 @@ export class NoteReadService implements OnApplicationShutdown {
//#endregion //#endregion
// スレッドミュート // スレッドミュート
const isThreadMuted = await this.noteThreadMutingsRepository.exist({ const isThreadMuted = await this.noteThreadMutingsRepository.exists({
where: { where: {
userId: userId, userId: userId,
threadId: note.threadId ?? note.id, threadId: note.threadId ?? note.id,
@ -70,7 +70,7 @@ export class NoteReadService implements OnApplicationShutdown {
// 2秒経っても既読にならなかったら「未読の投稿がありますよ」イベントを発行する // 2秒経っても既読にならなかったら「未読の投稿がありますよ」イベントを発行する
setTimeout(2000, 'unread note', { signal: this.#shutdownController.signal }).then(async () => { setTimeout(2000, 'unread note', { signal: this.#shutdownController.signal }).then(async () => {
const exist = await this.noteUnreadsRepository.exist({ where: { id: unread.id } }); const exist = await this.noteUnreadsRepository.exists({ where: { id: unread.id } });
if (!exist) return; if (!exist) return;

View file

@ -74,12 +74,12 @@ export class SignupService {
const secret = generateUserToken(); const secret = generateUserToken();
// Check username duplication // Check username duplication
if (await this.usersRepository.exist({ where: { usernameLower: username.toLowerCase(), host: IsNull() } })) { if (await this.usersRepository.exists({ where: { usernameLower: username.toLowerCase(), host: IsNull() } })) {
throw new Error('DUPLICATED_USERNAME'); throw new Error('DUPLICATED_USERNAME');
} }
// Check deleted username duplication // Check deleted username duplication
if (await this.usedUsernamesRepository.exist({ where: { username: username.toLowerCase() } })) { if (await this.usedUsernamesRepository.exists({ where: { username: username.toLowerCase() } })) {
throw new Error('USED_USERNAME'); throw new Error('USED_USERNAME');
} }

View file

@ -144,7 +144,7 @@ export class UserFollowingService implements OnModuleInit {
let autoAccept = false; let autoAccept = false;
// 鍵アカウントであっても、既にフォローされていた場合はスルー // 鍵アカウントであっても、既にフォローされていた場合はスルー
const isFollowing = await this.followingsRepository.exist({ const isFollowing = await this.followingsRepository.exists({
where: { where: {
followerId: follower.id, followerId: follower.id,
followeeId: followee.id, followeeId: followee.id,
@ -156,7 +156,7 @@ export class UserFollowingService implements OnModuleInit {
// フォローしているユーザーは自動承認オプション // フォローしているユーザーは自動承認オプション
if (!autoAccept && (this.userEntityService.isLocalUser(followee) && followeeProfile.autoAcceptFollowed)) { if (!autoAccept && (this.userEntityService.isLocalUser(followee) && followeeProfile.autoAcceptFollowed)) {
const isFollowed = await this.followingsRepository.exist({ const isFollowed = await this.followingsRepository.exists({
where: { where: {
followerId: followee.id, followerId: followee.id,
followeeId: follower.id, followeeId: follower.id,
@ -170,7 +170,7 @@ export class UserFollowingService implements OnModuleInit {
if (followee.isLocked && !autoAccept) { if (followee.isLocked && !autoAccept) {
autoAccept = !!(await this.accountMoveService.validateAlsoKnownAs( autoAccept = !!(await this.accountMoveService.validateAlsoKnownAs(
follower, follower,
(oldSrc, newSrc) => this.followingsRepository.exist({ (oldSrc, newSrc) => this.followingsRepository.exists({
where: { where: {
followeeId: followee.id, followeeId: followee.id,
followerId: newSrc.id, followerId: newSrc.id,
@ -233,7 +233,7 @@ export class UserFollowingService implements OnModuleInit {
this.cacheService.userFollowingsCache.refresh(follower.id); this.cacheService.userFollowingsCache.refresh(follower.id);
const requestExist = await this.followRequestsRepository.exist({ const requestExist = await this.followRequestsRepository.exists({
where: { where: {
followeeId: followee.id, followeeId: followee.id,
followerId: follower.id, followerId: follower.id,
@ -531,7 +531,7 @@ export class UserFollowingService implements OnModuleInit {
} }
} }
const requestExist = await this.followRequestsRepository.exist({ const requestExist = await this.followRequestsRepository.exists({
where: { where: {
followeeId: followee.id, followeeId: followee.id,
followerId: follower.id, followerId: follower.id,

View file

@ -629,7 +629,7 @@ export class ApInboxService {
return 'skip: follower not found'; return 'skip: follower not found';
} }
const isFollowing = await this.followingsRepository.exist({ const isFollowing = await this.followingsRepository.exists({
where: { where: {
followerId: follower.id, followerId: follower.id,
followeeId: actor.id, followeeId: actor.id,
@ -686,14 +686,14 @@ export class ApInboxService {
return 'skip: フォロー解除しようとしているユーザーはローカルユーザーではありません'; return 'skip: フォロー解除しようとしているユーザーはローカルユーザーではありません';
} }
const requestExist = await this.followRequestsRepository.exist({ const requestExist = await this.followRequestsRepository.exists({
where: { where: {
followerId: actor.id, followerId: actor.id,
followeeId: followee.id, followeeId: followee.id,
}, },
}); });
const isFollowing = await this.followingsRepository.exist({ const isFollowing = await this.followingsRepository.exists({
where: { where: {
followerId: actor.id, followerId: actor.id,
followeeId: followee.id, followeeId: followee.id,

View file

@ -325,7 +325,7 @@ export class ApRendererService {
inReplyToNote = await this.notesRepository.findOneBy({ id: note.replyId }); inReplyToNote = await this.notesRepository.findOneBy({ id: note.replyId });
if (inReplyToNote != null) { if (inReplyToNote != null) {
const inReplyToUserExist = await this.usersRepository.exist({ where: { id: inReplyToNote.userId } }); const inReplyToUserExist = await this.usersRepository.exists({ where: { id: inReplyToNote.userId } });
if (inReplyToUserExist) { if (inReplyToUserExist) {
if (inReplyToNote.uri) { if (inReplyToNote.uri) {

View file

@ -51,14 +51,14 @@ export class ChannelEntityService {
const banner = channel.bannerId ? await this.driveFilesRepository.findOneBy({ id: channel.bannerId }) : null; const banner = channel.bannerId ? await this.driveFilesRepository.findOneBy({ id: channel.bannerId }) : null;
const isFollowing = meId ? await this.channelFollowingsRepository.exist({ const isFollowing = meId ? await this.channelFollowingsRepository.exists({
where: { where: {
followerId: meId, followerId: meId,
followeeId: channel.id, followeeId: channel.id,
}, },
}) : false; }) : false;
const isFavorited = meId ? await this.channelFavoritesRepository.exist({ const isFavorited = meId ? await this.channelFavoritesRepository.exists({
where: { where: {
userId: meId, userId: meId,
channelId: channel.id, channelId: channel.id,

View file

@ -46,7 +46,7 @@ export class ClipEntityService {
description: clip.description, description: clip.description,
isPublic: clip.isPublic, isPublic: clip.isPublic,
favoritedCount: await this.clipFavoritesRepository.countBy({ clipId: clip.id }), favoritedCount: await this.clipFavoritesRepository.countBy({ clipId: clip.id }),
isFavorited: meId ? await this.clipFavoritesRepository.exist({ where: { clipId: clip.id, userId: meId } }) : undefined, isFavorited: meId ? await this.clipFavoritesRepository.exists({ where: { clipId: clip.id, userId: meId } }) : undefined,
}); });
} }

View file

@ -47,7 +47,7 @@ export class FlashEntityService {
summary: flash.summary, summary: flash.summary,
script: flash.script, script: flash.script,
likedCount: flash.likedCount, likedCount: flash.likedCount,
isLiked: meId ? await this.flashLikesRepository.exist({ where: { flashId: flash.id, userId: meId } }) : undefined, isLiked: meId ? await this.flashLikesRepository.exists({ where: { flashId: flash.id, userId: meId } }) : undefined,
}); });
} }

View file

@ -53,7 +53,7 @@ export class GalleryPostEntityService {
tags: post.tags.length > 0 ? post.tags : undefined, tags: post.tags.length > 0 ? post.tags : undefined,
isSensitive: post.isSensitive, isSensitive: post.isSensitive,
likedCount: post.likedCount, likedCount: post.likedCount,
isLiked: meId ? await this.galleryLikesRepository.exist({ where: { postId: post.id, userId: meId } }) : undefined, isLiked: meId ? await this.galleryLikesRepository.exists({ where: { postId: post.id, userId: meId } }) : undefined,
}); });
} }

View file

@ -108,7 +108,7 @@ export class NoteEntityService implements OnModuleInit {
hide = false; hide = false;
} else { } else {
// フォロワーかどうか // フォロワーかどうか
const isFollowing = await this.followingsRepository.exist({ const isFollowing = await this.followingsRepository.exists({
where: { where: {
followeeId: packedNote.userId, followeeId: packedNote.userId,
followerId: meId, followerId: meId,

View file

@ -104,7 +104,7 @@ export class PageEntityService {
eyeCatchingImage: page.eyeCatchingImageId ? await this.driveFileEntityService.pack(page.eyeCatchingImageId) : null, eyeCatchingImage: page.eyeCatchingImageId ? await this.driveFileEntityService.pack(page.eyeCatchingImageId) : null,
attachedFiles: this.driveFileEntityService.packMany((await Promise.all(attachedFiles)).filter((x): x is MiDriveFile => x != null)), attachedFiles: this.driveFileEntityService.packMany((await Promise.all(attachedFiles)).filter((x): x is MiDriveFile => x != null)),
likedCount: page.likedCount, likedCount: page.likedCount,
isLiked: meId ? await this.pageLikesRepository.exist({ where: { pageId: page.id, userId: meId } }) : undefined, isLiked: meId ? await this.pageLikesRepository.exists({ where: { pageId: page.id, userId: meId } }) : undefined,
}); });
} }

View file

@ -152,43 +152,43 @@ export class UserEntityService implements OnModuleInit {
followerId: me, followerId: me,
followeeId: target, followeeId: target,
}), }),
this.followingsRepository.exist({ this.followingsRepository.exists({
where: { where: {
followerId: target, followerId: target,
followeeId: me, followeeId: me,
}, },
}), }),
this.followRequestsRepository.exist({ this.followRequestsRepository.exists({
where: { where: {
followerId: me, followerId: me,
followeeId: target, followeeId: target,
}, },
}), }),
this.followRequestsRepository.exist({ this.followRequestsRepository.exists({
where: { where: {
followerId: target, followerId: target,
followeeId: me, followeeId: me,
}, },
}), }),
this.blockingsRepository.exist({ this.blockingsRepository.exists({
where: { where: {
blockerId: me, blockerId: me,
blockeeId: target, blockeeId: target,
}, },
}), }),
this.blockingsRepository.exist({ this.blockingsRepository.exists({
where: { where: {
blockerId: target, blockerId: target,
blockeeId: me, blockeeId: me,
}, },
}), }),
this.mutingsRepository.exist({ this.mutingsRepository.exists({
where: { where: {
muterId: me, muterId: me,
muteeId: target, muteeId: target,
}, },
}), }),
this.renoteMutingsRepository.exist({ this.renoteMutingsRepository.exists({
where: { where: {
muterId: me, muterId: me,
muteeId: target, muteeId: target,
@ -215,7 +215,7 @@ export class UserEntityService implements OnModuleInit {
/* /*
const myAntennas = (await this.antennaService.getAntennas()).filter(a => a.userId === userId); const myAntennas = (await this.antennaService.getAntennas()).filter(a => a.userId === userId);
const isUnread = (myAntennas.length > 0 ? await this.antennaNotesRepository.exist({ const isUnread = (myAntennas.length > 0 ? await this.antennaNotesRepository.exists({
where: { where: {
antennaId: In(myAntennas.map(x => x.id)), antennaId: In(myAntennas.map(x => x.id)),
read: false, read: false,

View file

@ -163,12 +163,12 @@ export class SignupApiService {
} }
if (instance.emailRequiredForSignup) { if (instance.emailRequiredForSignup) {
if (await this.usersRepository.exist({ where: { usernameLower: username.toLowerCase(), host: IsNull() } })) { if (await this.usersRepository.exists({ where: { usernameLower: username.toLowerCase(), host: IsNull() } })) {
throw new FastifyReplyError(400, 'DUPLICATED_USERNAME'); throw new FastifyReplyError(400, 'DUPLICATED_USERNAME');
} }
// Check deleted username duplication // Check deleted username duplication
if (await this.usedUsernamesRepository.exist({ where: { username: username.toLowerCase() } })) { if (await this.usedUsernamesRepository.exists({ where: { username: username.toLowerCase() } })) {
throw new FastifyReplyError(400, 'USED_USERNAME'); throw new FastifyReplyError(400, 'USED_USERNAME');
} }

View file

@ -55,7 +55,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw e; throw e;
}); });
const exist = await this.promoNotesRepository.exist({ where: { noteId: note.id } }); const exist = await this.promoNotesRepository.exists({ where: { noteId: note.id } });
if (exist) { if (exist) {
throw new ApiError(meta.errors.alreadyPromoted); throw new ApiError(meta.errors.alreadyPromoted);

View file

@ -62,7 +62,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const accessToken = secureRndstr(32); const accessToken = secureRndstr(32);
// Fetch exist access token // Fetch exist access token
const exist = await this.accessTokensRepository.exist({ const exist = await this.accessTokensRepository.exists({
where: { where: {
appId: session.appId, appId: session.appId,
userId: me.id, userId: me.id,

View file

@ -88,7 +88,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
// Check if already blocking // Check if already blocking
const exist = await this.blockingsRepository.exist({ const exist = await this.blockingsRepository.exists({
where: { where: {
blockerId: blocker.id, blockerId: blocker.id,
blockeeId: blockee.id, blockeeId: blockee.id,

View file

@ -88,7 +88,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
// Check not blocking // Check not blocking
const exist = await this.blockingsRepository.exist({ const exist = await this.blockingsRepository.exists({
where: { where: {
blockerId: blocker.id, blockerId: blocker.id,
blockeeId: blockee.id, blockeeId: blockee.id,

View file

@ -62,7 +62,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new ApiError(meta.errors.noSuchClip); throw new ApiError(meta.errors.noSuchClip);
} }
const exist = await this.clipFavoritesRepository.exist({ const exist = await this.clipFavoritesRepository.exists({
where: { where: {
clipId: clip.id, clipId: clip.id,
userId: me.id, userId: me.id,

View file

@ -38,7 +38,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private driveFilesRepository: DriveFilesRepository, private driveFilesRepository: DriveFilesRepository,
) { ) {
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
const exist = await this.driveFilesRepository.exist({ const exist = await this.driveFilesRepository.exists({
where: { where: {
md5: ps.md5, md5: ps.md5,
userId: me.id, userId: me.id,

View file

@ -70,7 +70,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
// if already liked // if already liked
const exist = await this.flashLikesRepository.exist({ const exist = await this.flashLikesRepository.exists({
where: { where: {
flashId: flash.id, flashId: flash.id,
userId: me.id, userId: me.id,

View file

@ -101,7 +101,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
// Check if already following // Check if already following
const exist = await this.followingsRepository.exist({ const exist = await this.followingsRepository.exists({
where: { where: {
followerId: follower.id, followerId: follower.id,
followeeId: followee.id, followeeId: followee.id,

View file

@ -85,7 +85,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
// Check not following // Check not following
const exist = await this.followingsRepository.exist({ const exist = await this.followingsRepository.exists({
where: { where: {
followerId: follower.id, followerId: follower.id,
followeeId: followee.id, followeeId: followee.id,

View file

@ -72,7 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
// if already liked // if already liked
const exist = await this.galleryLikesRepository.exist({ const exist = await this.galleryLikesRepository.exists({
where: { where: {
postId: post.id, postId: post.id,
userId: me.id, userId: me.id,

View file

@ -71,7 +71,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
private downloadService: DownloadService, private downloadService: DownloadService,
) { ) {
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
const userExist = await this.usersRepository.exist({ where: { id: me.id } }); const userExist = await this.usersRepository.exists({ where: { id: me.id } });
if (!userExist) throw new ApiError(meta.errors.noSuchUser); if (!userExist) throw new ApiError(meta.errors.noSuchUser);
const file = await this.driveFilesRepository.findOneBy({ id: ps.fileId }); const file = await this.driveFilesRepository.findOneBy({ id: ps.fileId });
if (file === null) throw new ApiError(meta.errors.noSuchFile); if (file === null) throw new ApiError(meta.errors.noSuchFile);

View file

@ -34,7 +34,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
) { ) {
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
if (ps.tokenId) { if (ps.tokenId) {
const tokenExist = await this.accessTokensRepository.exist({ where: { id: ps.tokenId } }); const tokenExist = await this.accessTokensRepository.exists({ where: { id: ps.tokenId } });
if (tokenExist) { if (tokenExist) {
await this.accessTokensRepository.delete({ await this.accessTokensRepository.delete({
@ -43,7 +43,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
} }
} else if (ps.token) { } else if (ps.token) {
const tokenExist = await this.accessTokensRepository.exist({ where: { token: ps.token } }); const tokenExist = await this.accessTokensRepository.exists({ where: { token: ps.token } });
if (tokenExist) { if (tokenExist) {
await this.accessTokensRepository.delete({ await this.accessTokensRepository.delete({

View file

@ -83,7 +83,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
// Check if already muting // Check if already muting
const exist = await this.mutingsRepository.exist({ const exist = await this.mutingsRepository.exists({
where: { where: {
muterId: muter.id, muterId: muter.id,
muteeId: mutee.id, muteeId: mutee.id,

View file

@ -260,7 +260,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Check blocking // Check blocking
if (renote.userId !== me.id) { if (renote.userId !== me.id) {
const blockExist = await this.blockingsRepository.exist({ const blockExist = await this.blockingsRepository.exists({
where: { where: {
blockerId: renote.userId, blockerId: renote.userId,
blockeeId: me.id, blockeeId: me.id,
@ -308,7 +308,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Check blocking // Check blocking
if (reply.userId !== me.id) { if (reply.userId !== me.id) {
const blockExist = await this.blockingsRepository.exist({ const blockExist = await this.blockingsRepository.exists({
where: { where: {
blockerId: reply.userId, blockerId: reply.userId,
blockeeId: me.id, blockeeId: me.id,

View file

@ -67,7 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
// if already favorited // if already favorited
const exist = await this.noteFavoritesRepository.exist({ const exist = await this.noteFavoritesRepository.exists({
where: { where: {
noteId: note.id, noteId: note.id,
userId: me.id, userId: me.id,

View file

@ -70,7 +70,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
// if already liked // if already liked
const exist = await this.pageLikesRepository.exist({ const exist = await this.pageLikesRepository.exists({
where: { where: {
pageId: page.id, pageId: page.id,
userId: me.id, userId: me.id,

View file

@ -49,7 +49,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw err; throw err;
}); });
const exist = await this.promoReadsRepository.exist({ const exist = await this.promoReadsRepository.exists({
where: { where: {
noteId: note.id, noteId: note.id,
userId: me.id, userId: me.id,

View file

@ -101,7 +101,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (me == null) { if (me == null) {
throw new ApiError(meta.errors.forbidden); throw new ApiError(meta.errors.forbidden);
} else if (me.id !== user.id) { } else if (me.id !== user.id) {
const isFollowing = await this.followingsRepository.exist({ const isFollowing = await this.followingsRepository.exists({
where: { where: {
followeeId: user.id, followeeId: user.id,
followerId: me.id, followerId: me.id,

View file

@ -109,7 +109,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (me == null) { if (me == null) {
throw new ApiError(meta.errors.forbidden); throw new ApiError(meta.errors.forbidden);
} else if (me.id !== user.id) { } else if (me.id !== user.id) {
const isFollowing = await this.followingsRepository.exist({ const isFollowing = await this.followingsRepository.exists({
where: { where: {
followeeId: user.id, followeeId: user.id,
followerId: me.id, followerId: me.id,

View file

@ -90,7 +90,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private roleService: RoleService, private roleService: RoleService,
) { ) {
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
const listExist = await this.userListsRepository.exist({ const listExist = await this.userListsRepository.exists({
where: { where: {
id: ps.listId, id: ps.listId,
isPublic: true, isPublic: true,
@ -121,7 +121,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}); });
if (currentUser.id !== me.id) { if (currentUser.id !== me.id) {
const blockExist = await this.blockingsRepository.exist({ const blockExist = await this.blockingsRepository.exists({
where: { where: {
blockerId: currentUser.id, blockerId: currentUser.id,
blockeeId: me.id, blockeeId: me.id,
@ -132,7 +132,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
} }
const exist = await this.userListMembershipsRepository.exist({ const exist = await this.userListMembershipsRepository.exists({
where: { where: {
userListId: userList.id, userListId: userList.id,
userId: currentUser.id, userId: currentUser.id,

View file

@ -47,7 +47,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
private idService: IdService, private idService: IdService,
) { ) {
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
const userListExist = await this.userListsRepository.exist({ const userListExist = await this.userListsRepository.exists({
where: { where: {
id: ps.listId, id: ps.listId,
isPublic: true, isPublic: true,
@ -58,7 +58,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
throw new ApiError(meta.errors.noSuchList); throw new ApiError(meta.errors.noSuchList);
} }
const exist = await this.userListFavoritesRepository.exist({ const exist = await this.userListFavoritesRepository.exists({
where: { where: {
userId: me.id, userId: me.id,
userListId: ps.listId, userListId: ps.listId,

View file

@ -104,7 +104,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Check blocking // Check blocking
if (user.id !== me.id) { if (user.id !== me.id) {
const blockExist = await this.blockingsRepository.exist({ const blockExist = await this.blockingsRepository.exists({
where: { where: {
blockerId: user.id, blockerId: user.id,
blockeeId: me.id, blockeeId: me.id,
@ -115,7 +115,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
} }
const exist = await this.userListMembershipsRepository.exist({ const exist = await this.userListMembershipsRepository.exists({
where: { where: {
userListId: userList.id, userListId: userList.id,
userId: user.id, userId: user.id,

View file

@ -74,7 +74,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
userListId: ps.listId, userListId: ps.listId,
}); });
if (me !== null) { if (me !== null) {
additionalProperties.isLiked = await this.userListFavoritesRepository.exist({ additionalProperties.isLiked = await this.userListFavoritesRepository.exists({
where: { where: {
userId: me.id, userId: me.id,
userListId: ps.listId, userListId: ps.listId,

View file

@ -45,7 +45,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
private userListFavoritesRepository: UserListFavoritesRepository, private userListFavoritesRepository: UserListFavoritesRepository,
) { ) {
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
const userListExist = await this.userListsRepository.exist({ const userListExist = await this.userListsRepository.exists({
where: { where: {
id: ps.listId, id: ps.listId,
isPublic: true, isPublic: true,

View file

@ -43,7 +43,7 @@ class UserListChannel extends Channel {
this.withRenotes = params.withRenotes ?? true; this.withRenotes = params.withRenotes ?? true;
// Check existence and owner // Check existence and owner
const listExist = await this.userListsRepository.exist({ const listExist = await this.userListsRepository.exists({
where: { where: {
id: this.listId, id: this.listId,
userId: this.user!.id, userId: this.user!.id,