Fixed mutations #162

This commit is contained in:
Sven Heidemann 2023-02-08 19:24:07 +01:00
parent e9559dec08
commit b33c5dc9bf
7 changed files with 21 additions and 19 deletions

View File

@ -28,8 +28,8 @@ type AutoRoleMutation {
}
input AutoRoleInput {
id: ID!
channelId: String!
messageId: String!
serverId: ID!
id: ID
channelId: String
messageId: String
serverId: ID
}

View File

@ -25,8 +25,8 @@ type AutoRoleRuleMutation {
}
input AutoRoleRuleInput {
id: ID!
emojiName: String!
roleId: String!
autoRoleId: ID!
id: ID
emojiName: String
roleId: String
autoRoleId: ID
}

View File

@ -25,9 +25,9 @@ type LevelMutation {
input LevelInput {
id: ID
name: String!
color: String!
minXp: Int!
permissions: String!
serverId: ID!
name: String
color: String
minXp: Int
permissions: String
serverId: ID
}

View File

@ -33,6 +33,6 @@ type UserMutation {
}
input UserInput {
id: ID!
xp: Int!
id: ID
xp: Int
}

View File

@ -35,7 +35,7 @@ class AutoRoleMutation(QueryABC):
and x.discord_message_id == input["messageId"]
)
return self._auto_roles.get_auto_roles_by_server_id(auto_role.server.server_id).where(get_new)
return self._auto_roles.get_auto_roles_by_server_id(auto_role.server.server_id).where(get_new).last()
def resolve_update_auto_role(self, *_, input: dict):
auto_role = self._auto_roles.get_auto_role_by_id(input["id"])

View File

@ -37,8 +37,10 @@ class AutoRoleRuleMutation(QueryABC):
and x.role_id == input["roleId"]
)
return self._auto_roles.get_auto_role_rules_by_auto_role_id(auto_role_rule.auto_role.auto_role_id).where(
get_new
return (
self._auto_roles.get_auto_role_rules_by_auto_role_id(auto_role_rule.auto_role.auto_role_id)
.where(get_new)
.last()
)
def resolve_update_auto_role_rule(self, *_, input: dict):

View File

@ -42,7 +42,7 @@ class LevelMutation(QueryABC):
and l.permissions == level.permissions
)
return self._levels.get_levels_by_server_id(level.server.server_id).where(get_new_level)
return self._levels.get_levels_by_server_id(level.server.server_id).where(get_new_level).last()
def resolve_update_level(self, *_, input: dict):
level = self._levels.get_level_by_id(input["id"])