Skip to content

Commit

Permalink
OXDEV-7697: Sort queries, mutations and fields and add some descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelOxid authored and Sieg committed Dec 20, 2023
1 parent c1bce75 commit 4358472
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 96 deletions.
54 changes: 27 additions & 27 deletions src/Module/Controller/ModuleSettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
17 changes: 10 additions & 7 deletions src/Shared/DataType/SettingType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use TheCodingMachine\GraphQLite\Annotations\Field;
use TheCodingMachine\GraphQLite\Annotations\Type;

/**
* Contains type information of a setting
*/
#[Type]
final class SettingType
{
Expand All @@ -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;
}
}
66 changes: 33 additions & 33 deletions src/Shop/Controller/ShopSettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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);
}
}
Loading

0 comments on commit 4358472

Please sign in to comment.