From 667f59cd1e9f43568ee064784e5d79c86a200270 Mon Sep 17 00:00:00 2001 From: marcelmanzel Date: Tue, 19 Dec 2023 16:29:17 +0100 Subject: [PATCH] OXDEV-7697: Sort queries, mutations and fields and add some descriptions --- .../Controller/ModuleSettingController.php | 54 +++++++-------- src/Shared/DataType/SettingType.php | 17 +++-- src/Shop/Controller/ShopSettingController.php | 66 +++++++++---------- .../Controller/ThemeSettingController.php | 58 ++++++++-------- 4 files changed, 99 insertions(+), 96 deletions(-) diff --git a/src/Module/Controller/ModuleSettingController.php b/src/Module/Controller/ModuleSettingController.php index 16871b0..e28c3c9 100644 --- a/src/Module/Controller/ModuleSettingController.php +++ b/src/Module/Controller/ModuleSettingController.php @@ -35,101 +35,101 @@ public function __construct( #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function moduleSettingInteger(string $name, string $moduleId): IntegerSetting + public function moduleSettingBoolean(string $name, string $moduleId): BooleanSetting { - return $this->moduleSettingService->getIntegerSetting($name, $moduleId); + return $this->moduleSettingService->getBooleanSetting($name, $moduleId); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function moduleSettingFloat(string $name, string $moduleId): FloatSetting + public function moduleSettingCollection(string $name, string $moduleId): StringSetting { - return $this->moduleSettingService->getFloatSetting($name, $moduleId); + return $this->moduleSettingService->getCollectionSetting($name, $moduleId); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function moduleSettingBoolean(string $name, string $moduleId): BooleanSetting + public function moduleSettingFloat(string $name, string $moduleId): FloatSetting { - return $this->moduleSettingService->getBooleanSetting($name, $moduleId); + return $this->moduleSettingService->getFloatSetting($name, $moduleId); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function moduleSettingString(string $name, string $moduleId): StringSetting + public function moduleSettingInteger(string $name, string $moduleId): IntegerSetting { - return $this->moduleSettingService->getStringSetting($name, $moduleId); + return $this->moduleSettingService->getIntegerSetting($name, $moduleId); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function moduleSettingCollection(string $name, string $moduleId): StringSetting + public function moduleSettingString(string $name, string $moduleId): StringSetting { - return $this->moduleSettingService->getCollectionSetting($name, $moduleId); + return $this->moduleSettingService->getStringSetting($name, $moduleId); } - #[Mutation] + /** + * @return SettingType[] + */ + #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function moduleSettingIntegerChange(string $name, int $value, string $moduleId): IntegerSetting + public function moduleSettings(string $moduleId): array { - return $this->moduleSettingService->changeIntegerSetting($name, $value, $moduleId); + return $this->moduleSettingService->getSettingsList($moduleId); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function moduleSettingFloatChange(string $name, float $value, string $moduleId): FloatSetting + public function moduleSettingBooleanChange(string $name, bool $value, string $moduleId): BooleanSetting { - return $this->moduleSettingService->changeFloatSetting($name, $value, $moduleId); + return $this->moduleSettingService->changeBooleanSetting($name, $value, $moduleId); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function moduleSettingBooleanChange(string $name, bool $value, string $moduleId): BooleanSetting + public function moduleSettingCollectionChange(string $name, string $value, string $moduleId): StringSetting { - return $this->moduleSettingService->changeBooleanSetting($name, $value, $moduleId); + return $this->moduleSettingService->changeCollectionSetting($name, $value, $moduleId); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function moduleSettingStringChange(string $name, string $value, string $moduleId): StringSetting + public function moduleSettingFloatChange(string $name, float $value, string $moduleId): FloatSetting { - return $this->moduleSettingService->changeStringSetting($name, $value, $moduleId); + return $this->moduleSettingService->changeFloatSetting($name, $value, $moduleId); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function moduleSettingCollectionChange(string $name, string $value, string $moduleId): StringSetting + public function moduleSettingIntegerChange(string $name, int $value, string $moduleId): IntegerSetting { - return $this->moduleSettingService->changeCollectionSetting($name, $value, $moduleId); + return $this->moduleSettingService->changeIntegerSetting($name, $value, $moduleId); } - /** - * @return SettingType[] - */ - #[Query] + #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function moduleSettings(string $moduleId): array + public function moduleSettingStringChange(string $name, string $value, string $moduleId): StringSetting { - return $this->moduleSettingService->getSettingsList($moduleId); + return $this->moduleSettingService->changeStringSetting($name, $value, $moduleId); } } diff --git a/src/Shared/DataType/SettingType.php b/src/Shared/DataType/SettingType.php index 796db03..abe3c11 100644 --- a/src/Shared/DataType/SettingType.php +++ b/src/Shared/DataType/SettingType.php @@ -13,6 +13,9 @@ use TheCodingMachine\GraphQLite\Annotations\Field; use TheCodingMachine\GraphQLite\Annotations\Type; +/** + * Contains type information of a setting + */ #[Type] final class SettingType { @@ -28,18 +31,18 @@ public function getName(): string return $this->name; } - #[Field] - public function getType(): string - { - return $this->type; - } - /** * @SuppressWarnings(PHPMD.StaticAccess) */ - #[Field] + #[Field(description: 'This indicates if the type is supported by our queries and mutations')] public function isSupported(): bool { return FieldType::validateFieldType($this->getType()); } + + #[Field] + public function getType(): string + { + return $this->type; + } } diff --git a/src/Shop/Controller/ShopSettingController.php b/src/Shop/Controller/ShopSettingController.php index 33ba015..bdaeae7 100644 --- a/src/Shop/Controller/ShopSettingController.php +++ b/src/Shop/Controller/ShopSettingController.php @@ -35,81 +35,84 @@ public function __construct( #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingInteger(string $name): IntegerSetting + public function shopSettingAssocCollection(string $name): StringSetting { - return $this->shopSettingService->getIntegerSetting($name); + return $this->shopSettingService->getAssocCollectionSetting($name); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingFloat(string $name): FloatSetting + public function shopSettingBoolean(string $name): BooleanSetting { - return $this->shopSettingService->getFloatSetting($name); + return $this->shopSettingService->getBooleanSetting($name); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingBoolean(string $name): BooleanSetting + public function shopSettingCollection(string $name): StringSetting { - return $this->shopSettingService->getBooleanSetting($name); + return $this->shopSettingService->getCollectionSetting($name); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingString(string $name): StringSetting + public function shopSettingFloat(string $name): FloatSetting { - return $this->shopSettingService->getStringSetting($name); + return $this->shopSettingService->getFloatSetting($name); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingSelect(string $name): StringSetting + public function shopSettingInteger(string $name): IntegerSetting { - return $this->shopSettingService->getSelectSetting($name); + return $this->shopSettingService->getIntegerSetting($name); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingCollection(string $name): StringSetting + public function shopSettingSelect(string $name): StringSetting { - return $this->shopSettingService->getCollectionSetting($name); + return $this->shopSettingService->getSelectSetting($name); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingAssocCollection(string $name): StringSetting + public function shopSettingString(string $name): StringSetting { - return $this->shopSettingService->getAssocCollectionSetting($name); + return $this->shopSettingService->getStringSetting($name); } - #[Mutation] + /** + * @return SettingType[] + */ + #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingIntegerChange(string $name, int $value): IntegerSetting + public function shopSettings(): array { - return $this->shopSettingService->changeIntegerSetting($name, $value); + return $this->shopSettingService->getSettingsList(); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingFloatChange(string $name, float $value): FloatSetting + public function shopSettingAssocCollectionChange(string $name, string $value): StringSetting { - return $this->shopSettingService->changeFloatSetting($name, $value); + return $this->shopSettingService->changeAssocCollectionSetting($name, $value); } #[Mutation] @@ -125,47 +128,44 @@ public function shopSettingBooleanChange(string $name, bool $value): BooleanSett #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingStringChange(string $name, string $value): StringSetting + public function shopSettingCollectionChange(string $name, string $value): StringSetting { - return $this->shopSettingService->changeStringSetting($name, $value); + return $this->shopSettingService->changeCollectionSetting($name, $value); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingSelectChange(string $name, string $value): StringSetting + public function shopSettingFloatChange(string $name, float $value): FloatSetting { - return $this->shopSettingService->changeSelectSetting($name, $value); + return $this->shopSettingService->changeFloatSetting($name, $value); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingCollectionChange(string $name, string $value): StringSetting + public function shopSettingIntegerChange(string $name, int $value): IntegerSetting { - return $this->shopSettingService->changeCollectionSetting($name, $value); + return $this->shopSettingService->changeIntegerSetting($name, $value); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettingAssocCollectionChange(string $name, string $value): StringSetting + public function shopSettingSelectChange(string $name, string $value): StringSetting { - return $this->shopSettingService->changeAssocCollectionSetting($name, $value); + return $this->shopSettingService->changeSelectSetting($name, $value); } - /** - * @return SettingType[] - */ - #[Query] + #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function shopSettings(): array + public function shopSettingStringChange(string $name, string $value): StringSetting { - return $this->shopSettingService->getSettingsList(); + return $this->shopSettingService->changeStringSetting($name, $value); } } diff --git a/src/Theme/Controller/ThemeSettingController.php b/src/Theme/Controller/ThemeSettingController.php index c719bf8..12f9305 100644 --- a/src/Theme/Controller/ThemeSettingController.php +++ b/src/Theme/Controller/ThemeSettingController.php @@ -35,63 +35,63 @@ public function __construct( #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingInteger(string $name, string $themeId): IntegerSetting + public function themeSettingAssocCollection(string $name, string $themeId): StringSetting { - return $this->themeSettingService->getIntegerSetting($name, $themeId); + return $this->themeSettingService->getAssocCollectionSetting($name, $themeId); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingFloat(string $name, string $themeId): FloatSetting + public function themeSettingBoolean(string $name, string $themeId): BooleanSetting { - return $this->themeSettingService->getFloatSetting($name, $themeId); + return $this->themeSettingService->getBooleanSetting($name, $themeId); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingBoolean(string $name, string $themeId): BooleanSetting + public function themeSettingCollection(string $name, string $themeId): StringSetting { - return $this->themeSettingService->getBooleanSetting($name, $themeId); + return $this->themeSettingService->getCollectionSetting($name, $themeId); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingString(string $name, string $themeId): StringSetting + public function themeSettingFloat(string $name, string $themeId): FloatSetting { - return $this->themeSettingService->getStringSetting($name, $themeId); + return $this->themeSettingService->getFloatSetting($name, $themeId); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingSelect(string $name, string $themeId): StringSetting + public function themeSettingInteger(string $name, string $themeId): IntegerSetting { - return $this->themeSettingService->getSelectSetting($name, $themeId); + return $this->themeSettingService->getIntegerSetting($name, $themeId); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingCollection(string $name, string $themeId): StringSetting + public function themeSettingSelect(string $name, string $themeId): StringSetting { - return $this->themeSettingService->getCollectionSetting($name, $themeId); + return $this->themeSettingService->getSelectSetting($name, $themeId); } #[Query] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingAssocCollection(string $name, string $themeId): StringSetting + public function themeSettingString(string $name, string $themeId): StringSetting { - return $this->themeSettingService->getAssocCollectionSetting($name, $themeId); + return $this->themeSettingService->getStringSetting($name, $themeId); } /** @@ -110,62 +110,62 @@ public function themeSettings(string $themeId): array #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingIntegerChange(string $name, int $value, string $themeId): IntegerSetting + public function themeSettingAssocCollectionChange(string $name, string $value, string $themeId): StringSetting { - return $this->themeSettingService->changeIntegerSetting($name, $value, $themeId); + return $this->themeSettingService->changeAssocCollectionSetting($name, $value, $themeId); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingFloatChange(string $name, float $value, string $themeId): FloatSetting + public function themeSettingBooleanChange(string $name, bool $value, string $themeId): BooleanSetting { - return $this->themeSettingService->changeFloatSetting($name, $value, $themeId); + return $this->themeSettingService->changeBooleanSetting($name, $value, $themeId); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingBooleanChange(string $name, bool $value, string $themeId): BooleanSetting + public function themeSettingCollectionChange(string $name, string $value, string $themeId): StringSetting { - return $this->themeSettingService->changeBooleanSetting($name, $value, $themeId); + return $this->themeSettingService->changeCollectionSetting($name, $value, $themeId); } + #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingStringChange(string $name, string $value, string $themeId): StringSetting + public function themeSettingFloatChange(string $name, float $value, string $themeId): FloatSetting { - return $this->themeSettingService->changeStringSetting($name, $value, $themeId); + return $this->themeSettingService->changeFloatSetting($name, $value, $themeId); } - #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingSelectChange(string $name, string $value, string $themeId): StringSetting + public function themeSettingIntegerChange(string $name, int $value, string $themeId): IntegerSetting { - return $this->themeSettingService->changeSelectSetting($name, $value, $themeId); + return $this->themeSettingService->changeIntegerSetting($name, $value, $themeId); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingCollectionChange(string $name, string $value, string $themeId): StringSetting + public function themeSettingSelectChange(string $name, string $value, string $themeId): StringSetting { - return $this->themeSettingService->changeCollectionSetting($name, $value, $themeId); + return $this->themeSettingService->changeSelectSetting($name, $value, $themeId); } #[Mutation] #[Logged] #[HideIfUnauthorized] #[Right('CHANGE_CONFIGURATION')] - public function themeSettingAssocCollectionChange(string $name, string $value, string $themeId): StringSetting + public function themeSettingStringChange(string $name, string $value, string $themeId): StringSetting { - return $this->themeSettingService->changeAssocCollectionSetting($name, $value, $themeId); + return $this->themeSettingService->changeStringSetting($name, $value, $themeId); } }