selfprivacy-rest-api/selfprivacy_api/graphql/queries/common.py

31 lines
501 B
Python
Raw Permalink Normal View History

2022-06-24 12:26:51 +00:00
"""Common types and enums used by different types of queries."""
from enum import Enum
import datetime
import typing
import strawberry
2022-06-24 18:14:20 +00:00
2022-06-24 12:26:51 +00:00
@strawberry.enum
class Severity(Enum):
"""
Severity of an alert.
"""
2022-06-24 18:14:20 +00:00
2022-06-24 12:26:51 +00:00
INFO = "INFO"
WARNING = "WARNING"
ERROR = "ERROR"
CRITICAL = "CRITICAL"
SUCCESS = "SUCCESS"
2022-06-24 18:14:20 +00:00
2022-06-24 12:26:51 +00:00
@strawberry.type
class Alert:
"""
Alert type.
"""
2022-06-24 18:14:20 +00:00
2022-06-24 12:26:51 +00:00
severity: Severity
title: str
message: str
timestamp: typing.Optional[datetime.datetime]