Prepared auto role rules #134

This commit is contained in:
Sven Heidemann 2023-02-20 18:53:02 +01:00
parent a2dcbbc465
commit 10d79f8c2c
4 changed files with 58 additions and 3 deletions

View File

@ -24,6 +24,7 @@ export interface AutoRoleRule extends Data {
id?: number; id?: number;
emojiName?: string; emojiName?: string;
roleId?: string; roleId?: string;
roleName?: string;
autoRole?: AutoRole; autoRole?: AutoRole;
} }

View File

@ -16,7 +16,7 @@ export class Mutations {
`; `;
static createAutoRole = ` static createAutoRole = `
mutation updateAutoRole($serverId: ID, $channelId: String, $messageId: String) { mutation createAutoRole($serverId: ID, $channelId: String, $messageId: String) {
autoRole { autoRole {
createAutoRole(input: { serverId: $serverId, channelId: $channelId, messageId: $messageId }) { createAutoRole(input: { serverId: $serverId, channelId: $channelId, messageId: $messageId }) {
id id
@ -29,7 +29,7 @@ export class Mutations {
`; `;
static deleteAutoRole = ` static deleteAutoRole = `
mutation updateAutoRole($id: ID) { mutation deleteAutoRole($id: ID) {
autoRole { autoRole {
deleteAutoRole(id: $id) { deleteAutoRole(id: $id) {
id id
@ -40,4 +40,30 @@ export class Mutations {
} }
} }
`; `;
static createAutoRoleRule = `
mutation createAutoRoleRule($autoRoleId: ID, $emojiName: String, roleId: String) {
autoRoleRule {
createAutoRoleRule(input: { autoRoleId: $autoRoleId, emojiName: $emojiName, roleId: $roleId }) {
id
emojiName
roleId
roleName
}
}
}
`;
static deleteAutoRoleRule = `
mutation deleteAutoRoleRule($id: ID) {
autoRoleRule {
deleteAutoRoleRule(id: $id) {
id
emojiName
roleId
roleName
}
}
}
`;
} }

View File

@ -175,4 +175,27 @@ export class Queries {
} }
} }
`; `;
static autoRoleRulesQuery = `
query AutoRoleRuleQuery($serverId: ID, $autoRoleId: ID, $filter: AutoRoleFilter, $page: Page, $sort: Sort) {
servers(filter: {id: $serverId} {
autoRoles(filter: {id: $autoRoleId}) {
autoRoleRuleCount
autoRoleRules(filter: $filter, page: $page, sort: $sort) {
id
emojiName
roleId
roleName
autoRole {
id
}
createdAt
modifiedAt
}
}
}
}
`;
} }

View File

@ -1,6 +1,6 @@
import { Server } from "../data/server.model"; import { Server } from "../data/server.model";
import { User } from "../data/user.model"; import { User } from "../data/user.model";
import { AutoRole } from "../data/auto_role.model"; import { AutoRole, AutoRoleRule } from "../data/auto_role.model";
import { Guild } from "../data/discord.model"; import { Guild } from "../data/discord.model";
import { Level } from "../data/level.model"; import { Level } from "../data/level.model";
@ -28,3 +28,8 @@ export interface AutoRoleQuery {
autoRoles: AutoRole[]; autoRoles: AutoRole[];
} }
export interface AutoRoleRuleQuery {
autoRoleRuleCount: number;
autoRoleRules: AutoRoleRule[];
}