mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 20:11:30 +00:00
chore: PR cleanup
This commit is contained in:
parent
74b108aeed
commit
2226b266f0
|
@ -27,4 +27,4 @@ async def get_token_header(
|
||||||
|
|
||||||
def get_api_version() -> str:
|
def get_api_version() -> str:
|
||||||
"""Get API version"""
|
"""Get API version"""
|
||||||
return "3.3.0+configs"
|
return "3.3.0"
|
||||||
|
|
|
@ -41,6 +41,41 @@ class SetServiceConfigurationInput:
|
||||||
|
|
||||||
service_id: str
|
service_id: str
|
||||||
configuration: strawberry.scalars.JSON
|
configuration: strawberry.scalars.JSON
|
||||||
|
"""Yes, it is a JSON scalar, which is supposed to be a Map<str, Union[str, int, bool]>.
|
||||||
|
I can't define it as a proper type because GraphQL doesn't support unions in input types.
|
||||||
|
There is a @oneOf directive, but it doesn't fit this usecase.
|
||||||
|
|
||||||
|
Other option would have been doing something like this:
|
||||||
|
```python
|
||||||
|
@strawberry.type
|
||||||
|
class StringConfigurationInputField:
|
||||||
|
fieldId: str
|
||||||
|
value: str
|
||||||
|
|
||||||
|
@strawberry.type
|
||||||
|
class BoolConfigurationInputField:
|
||||||
|
fieldId: str
|
||||||
|
value: bool
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
@strawberry.input
|
||||||
|
class SetServiceConfigurationInput:
|
||||||
|
service_id: str
|
||||||
|
stringFields: List[StringConfigurationInputField]
|
||||||
|
boolFields: List[BoolConfigurationInputField]
|
||||||
|
enumFields: List[EnumConfigurationInputField]
|
||||||
|
intFields: List[IntConfigurationInputField]
|
||||||
|
```
|
||||||
|
|
||||||
|
But it would be very painful to maintain and will break compatibility with
|
||||||
|
every change.
|
||||||
|
|
||||||
|
Be careful when parsing it. Probably it will be wise to add a parser/validator
|
||||||
|
later when we get a new Pydantic integration in Strawberry.
|
||||||
|
|
||||||
|
-- Inex, 26.07.2024
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
@strawberry.input
|
@strawberry.input
|
||||||
|
|
|
@ -381,7 +381,7 @@ class Service(ABC):
|
||||||
try:
|
try:
|
||||||
ensure_folder_ownership(binds)
|
ensure_folder_ownership(binds)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
# We have logged it via write_to_log and we additionally log it here in the error field
|
# We have logged it via print and we additionally log it here in the error field
|
||||||
# We are continuing anyway but Job has no warning field
|
# We are continuing anyway but Job has no warning field
|
||||||
Jobs.update(
|
Jobs.update(
|
||||||
job,
|
job,
|
||||||
|
|
Loading…
Reference in a new issue