fix: character search duplicates because of account_access (#19)
This commit is contained in:
parent
216904fd6e
commit
08009a575c
4 changed files with 10 additions and 10 deletions
|
|
@ -23,6 +23,7 @@ export interface IColumnJoin {
|
||||||
column2: string;
|
column2: string;
|
||||||
database2?: string;
|
database2?: string;
|
||||||
kind: "INNER" | "FULL OUTER" | "LEFT" | "RIGHT";
|
kind: "INNER" | "FULL OUTER" | "LEFT" | "RIGHT";
|
||||||
|
where?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DataTablesSsp {
|
export class DataTablesSsp {
|
||||||
|
|
@ -130,8 +131,9 @@ export class DataTablesSsp {
|
||||||
|
|
||||||
private join() {
|
private join() {
|
||||||
for (const join of this.joins) {
|
for (const join of this.joins) {
|
||||||
const db2 = join.database2 ? "`" + join.database2 + "`." : "";
|
const db2 = join.database2 ? `\`${join.database2}\`.` : "";
|
||||||
this.joinSql += `${join.kind} JOIN ${db2}\`${join.table2}\` ON ${db2}\`${join.table2}\`.\`${join.column2}\` = \`${join.table1}\`.\`${join.column1}\`\n`;
|
const where = join.where ? ` ${join.where}` : "";
|
||||||
|
this.joinSql += `${join.kind} JOIN ${db2}\`${join.table2}\` ON ${db2}\`${join.table2}\`.\`${join.column2}\` = \`${join.table1}\`.\`${join.column1}\`${where}\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
|
||||||
|
|
@ -315,10 +315,10 @@ export class CharacterController {
|
||||||
FROM \`characters\`
|
FROM \`characters\`
|
||||||
LEFT JOIN \`guild_member\` ON \`guild_member\`.\`guid\` = \`characters\`.\`guid\`
|
LEFT JOIN \`guild_member\` ON \`guild_member\`.\`guid\` = \`characters\`.\`guid\`
|
||||||
LEFT JOIN \`guild\` ON \`guild\`.\`guildid\` = \`guild_member\`.\`guildid\`
|
LEFT JOIN \`guild\` ON \`guild\`.\`guildid\` = \`guild_member\`.\`guildid\`
|
||||||
LEFT JOIN \`${realm.authDatabase}\`.\`account_access\` ON \`account_access\`.\`id\` = \`characters\`.\`account\`
|
LEFT JOIN \`${realm.authDatabase}\`.\`account_access\` ON \`account_access\`.\`id\` = \`characters\`.\`account\` AND \`account_access\`.\`RealmID\` IN (-1, ${realm.realmId}) AND \`account_access\`.\`gmlevel\` > 0
|
||||||
WHERE
|
WHERE
|
||||||
${where}
|
${where}
|
||||||
AND (\`account_access\`.\`id\` IS NULL OR \`account_access\`.\`RealmID\` NOT IN (-1, ${realm.realmId}) OR \`account_access\`.\`gmlevel\` = 0 OR ? = 0)
|
AND (\`account_access\`.\`id\` IS NULL OR ? = 0)
|
||||||
`,
|
`,
|
||||||
values: [character, this.armory.config.hideGameMasters ? 1 : 0],
|
values: [character, this.armory.config.hideGameMasters ? 1 : 0],
|
||||||
timeout: this.armory.config.dbQueryTimeout,
|
timeout: this.armory.config.dbQueryTimeout,
|
||||||
|
|
|
||||||
|
|
@ -79,10 +79,9 @@ export class GuildController {
|
||||||
column2: "id",
|
column2: "id",
|
||||||
database2: realm.authDatabase,
|
database2: realm.authDatabase,
|
||||||
kind: "LEFT",
|
kind: "LEFT",
|
||||||
|
where: `AND \`account_access\`.\`RealmID\` IN (-1, ${realm.realmId}) AND \`account_access\`.\`gmlevel\` > 0`,
|
||||||
});
|
});
|
||||||
ssp = ssp.where(
|
ssp = ssp.where("`account_access`.`id` IS NULL");
|
||||||
`\`account_access\`.\`id\` IS NULL OR \`account_access\`.\`RealmID\` NOT IN (-1, ${realm.realmId}) OR \`account_access\`.\`gmlevel\` = 0`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await ssp.where("`guildid` = ?", guildId).where("`deleteInfos_Account` IS NULL").run(this.armory.config.dbQueryTimeout);
|
const result = await ssp.where("`guildid` = ?", guildId).where("`deleteInfos_Account` IS NULL").run(this.armory.config.dbQueryTimeout);
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,9 @@ export class IndexController {
|
||||||
column2: "id",
|
column2: "id",
|
||||||
database2: realm.authDatabase,
|
database2: realm.authDatabase,
|
||||||
kind: "LEFT",
|
kind: "LEFT",
|
||||||
|
where: `AND \`account_access\`.\`RealmID\` IN (-1, ${realm.realmId}) AND \`account_access\`.\`gmlevel\` > 0`,
|
||||||
});
|
});
|
||||||
ssp = ssp.where(
|
ssp = ssp.where("`account_access`.`id` IS NULL");
|
||||||
`\`account_access\`.\`id\` IS NULL OR \`account_access\`.\`RealmID\` NOT IN (-1, ${realm.realmId}) OR \`account_access\`.\`gmlevel\` = 0`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await ssp.where("`deleteInfos_Account` IS NULL").run(this.armory.config.dbQueryTimeout);
|
const result = await ssp.where("`deleteInfos_Account` IS NULL").run(this.armory.config.dbQueryTimeout);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue