3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-16 22:55:03 +00:00

Global cases

This commit is contained in:
iamshoXy 2024-01-18 21:37:58 +01:00
parent d24e39b4ec
commit b019feefdf

View file

@ -24,7 +24,6 @@ export class GuildCases extends BaseGuildRepository {
return this.cases.find({ return this.cases.find({
relations: this.getRelations(), relations: this.getRelations(),
where: { where: {
guild_id: this.guildId,
id: In(ids), id: In(ids),
}, },
}); });
@ -34,7 +33,6 @@ export class GuildCases extends BaseGuildRepository {
return this.cases.findOne({ return this.cases.findOne({
relations: this.getRelations(), relations: this.getRelations(),
where: { where: {
guild_id: this.guildId,
id, id,
}, },
}); });
@ -44,7 +42,6 @@ export class GuildCases extends BaseGuildRepository {
return this.cases.findOne({ return this.cases.findOne({
relations: this.getRelations(), relations: this.getRelations(),
where: { where: {
guild_id: this.guildId,
case_number: caseNumber, case_number: caseNumber,
}, },
}); });
@ -54,7 +51,6 @@ export class GuildCases extends BaseGuildRepository {
return this.cases.findOne({ return this.cases.findOne({
relations: this.getRelations(), relations: this.getRelations(),
where: { where: {
guild_id: this.guildId,
mod_id: modId, mod_id: modId,
}, },
order: { order: {
@ -67,7 +63,6 @@ export class GuildCases extends BaseGuildRepository {
return this.cases.findOne({ return this.cases.findOne({
relations: this.getRelations(), relations: this.getRelations(),
where: { where: {
guild_id: this.guildId,
audit_log_id: auditLogId, audit_log_id: auditLogId,
}, },
}); });
@ -77,7 +72,6 @@ export class GuildCases extends BaseGuildRepository {
return this.cases.find({ return this.cases.find({
relations: this.getRelations(), relations: this.getRelations(),
where: { where: {
guild_id: this.guildId,
user_id: userId, user_id: userId,
}, },
}); });
@ -87,7 +81,6 @@ export class GuildCases extends BaseGuildRepository {
return this.cases.find({ return this.cases.find({
relations: this.getRelations(), relations: this.getRelations(),
where: { where: {
guild_id: this.guildId,
user_id: userId, user_id: userId,
}, },
skip, skip,
@ -101,7 +94,6 @@ export class GuildCases extends BaseGuildRepository {
async getTotalCasesByModId(modId: string): Promise<number> { async getTotalCasesByModId(modId: string): Promise<number> {
return this.cases.count({ return this.cases.count({
where: { where: {
guild_id: this.guildId,
mod_id: modId, mod_id: modId,
is_hidden: false, is_hidden: false,
}, },
@ -112,7 +104,6 @@ export class GuildCases extends BaseGuildRepository {
return this.cases.find({ return this.cases.find({
relations: this.getRelations(), relations: this.getRelations(),
where: { where: {
guild_id: this.guildId,
mod_id: modId, mod_id: modId,
is_hidden: false, is_hidden: false,
}, },
@ -158,7 +149,6 @@ export class GuildCases extends BaseGuildRepository {
const lastCaseNumberRow = await this.cases const lastCaseNumberRow = await this.cases
.createQueryBuilder() .createQueryBuilder()
.select(["MAX(case_number) AS last_case_number"]) .select(["MAX(case_number) AS last_case_number"])
.where("guild_id = :guildId", { guildId: this.guildId })
.getRawOne(); .getRawOne();
const lastCaseNumber = lastCaseNumberRow?.last_case_number || 0; const lastCaseNumber = lastCaseNumberRow?.last_case_number || 0;