diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 12:42:01 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 12:42:01 +1000 |
commit | c3591a82334669b87499c6bed3cb6d697bdc1acc (patch) | |
tree | 7b476130155cc9a98a5143fed4533efc212080ad /src | |
parent | Refactor to mono-repo + upgrade packages (diff) | |
download | server-c3591a82334669b87499c6bed3cb6d697bdc1acc.tar.xz |
'Fix' distinct alias typeorm issue
Diffstat (limited to 'src')
-rw-r--r-- | src/util/entities/Channel.ts | 5 | ||||
-rw-r--r-- | src/util/entities/Member.ts | 2 | ||||
-rw-r--r-- | src/util/util/Permissions.ts | 10 |
3 files changed, 7 insertions, 10 deletions
diff --git a/src/util/entities/Channel.ts b/src/util/entities/Channel.ts index 577b627e..2200bfa3 100644 --- a/src/util/entities/Channel.ts +++ b/src/util/entities/Channel.ts @@ -245,11 +245,10 @@ export class Channel extends BaseClass { static async createDMChannel(recipients: string[], creator_user_id: string, name?: string) { recipients = recipients.unique().filter((x) => x !== creator_user_id); - //@ts-ignore some typeorm typescript issue - const otherRecipientsUsers = await User.find({ where: recipients.map((x) => ({ id: x })) }); - // TODO: check config for max number of recipients /** if you want to disallow note to self channels, uncomment the conditional below + + const otherRecipientsUsers = await User.find({ where: recipients.map((x) => ({ id: x })) }); if (otherRecipientsUsers.length !== recipients.length) { throw new HTTPError("Recipient/s not found"); } diff --git a/src/util/entities/Member.ts b/src/util/entities/Member.ts index d7bcefea..7d1346ba 100644 --- a/src/util/entities/Member.ts +++ b/src/util/entities/Member.ts @@ -165,7 +165,6 @@ export class Member extends BaseClassWithoutId { static async addRole(user_id: string, guild_id: string, role_id: string) { const [member, role] = await Promise.all([ - // @ts-ignore Member.findOneOrFail({ where: { id: user_id, guild_id }, relations: ["user", "roles"], // we don't want to load the role objects just the ids @@ -192,7 +191,6 @@ export class Member extends BaseClassWithoutId { static async removeRole(user_id: string, guild_id: string, role_id: string) { const [member] = await Promise.all([ - // @ts-ignore Member.findOneOrFail({ where: { id: user_id, guild_id }, relations: ["user", "roles"], // we don't want to load the role objects just the ids diff --git a/src/util/util/Permissions.ts b/src/util/util/Permissions.ts index e5459ab5..a432af76 100644 --- a/src/util/util/Permissions.ts +++ b/src/util/util/Permissions.ts @@ -244,12 +244,12 @@ export async function getPermission( member = await Member.findOneOrFail({ where: { guild_id, id: user_id }, relations: ["roles", ...(opts.member_relations || [])], - select: [ - "id", - "roles", + // select: [ + // "id", // TODO: Bug in typeorm? adding these selects breaks the query. + // "roles", // @ts-ignore - ...(opts.member_select || []), - ], + // ...(opts.member_select || []), + // ], }); } |