diff --git a/controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/group/GroupService.kt b/controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/group/GroupService.kt index 201933a..8c7ff6e 100644 --- a/controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/group/GroupService.kt +++ b/controller-runtime/src/main/kotlin/app/simplecloud/controller/runtime/group/GroupService.kt @@ -34,6 +34,11 @@ class GroupService( groupRepository.find(request.group.name) ?: throw StatusException(Status.NOT_FOUND.withDescription("This group does not exist")) val group = Group.fromDefinition(request.group) + + if (group.minMemory > group.maxMemory) { + throw StatusException(Status.INVALID_ARGUMENT.withDescription("Minimum memory must be smaller than maximum memory")) + } + try { groupRepository.save(group) } catch (e: Exception) { @@ -47,6 +52,11 @@ class GroupService( throw StatusException(Status.NOT_FOUND.withDescription("This group already exists")) } val group = Group.fromDefinition(request.group) + + if (group.minMemory > group.maxMemory) { + throw StatusException(Status.INVALID_ARGUMENT.withDescription("Minimum memory must be smaller than maximum memory")) + } + try { groupRepository.save(group) } catch (e: Exception) {