3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-18 07:35:02 +00:00

Dashboard work and related

This commit is contained in:
Dragory 2019-06-23 19:18:41 +03:00
parent 5279ab06fa
commit 1ecce52973
44 changed files with 637 additions and 272 deletions

View file

@ -21,21 +21,25 @@ export class AllowedGuilds extends BaseRepository {
async isAllowed(guildId) {
const count = await this.allowedGuilds.count({
where: {
guild_id: guildId,
id: guildId,
},
});
return count !== 0;
}
getForDashboardUser(userId) {
getForApiUser(userId) {
return this.allowedGuilds
.createQueryBuilder("allowed_guilds")
.innerJoin(
"dashboard_users",
"dashboard_users",
"dashboard_users.guild_id = allowed_guilds.guild_id AND dashboard_users.user_id = :userId",
"api_permissions",
"api_permissions",
"api_permissions.guild_id = allowed_guilds.id AND api_permissions.user_id = :userId",
{ userId },
)
.getMany();
}
updateInfo(id, name, icon) {
return this.allowedGuilds.update({ id }, { name, icon });
}
}