Fixed mutation #378

This commit is contained in:
2023-09-28 10:38:08 +02:00
parent 290b5f38a7
commit 9783424066
4 changed files with 14 additions and 7 deletions

View File

@@ -46,4 +46,5 @@ input ShortRoleNameInput {
roleId: String
roleName: String
position: String
serverId: ID
}

View File

@@ -36,10 +36,15 @@ class ShortRoleNameMutation(QueryABC):
short_role_name = ShortRoleName(
input["shortName"],
input["roleId"],
int(input["roleId"]),
input["position"],
server,
)
result = self._short_role_names.find_short_role_name_by_role_id(short_role_name.role_id)
if result is not None:
raise ValueError("Short name for role already exists")
self._short_role_names.add_short_role_name(short_role_name)
self._db.save_changes()
@@ -47,7 +52,7 @@ class ShortRoleNameMutation(QueryABC):
return (
srn.short_name == short_role_name.short_name
and srn.role_id == short_role_name.role_id
and srn.position == short_role_name.position
and srn.position.value == short_role_name.position
)
return (