use string for status

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2024-01-13 21:11:28 +01:00
parent 39b574a47d
commit 31619fb5aa
No known key found for this signature in database
4 changed files with 27 additions and 22 deletions

View File

@ -1,4 +1,4 @@
# Generated by Django 5.0.1 on 2024-01-13 19:38 # Generated by Django 5.0.1 on 2024-01-13 20:14
import uuid import uuid
@ -33,8 +33,13 @@ class Migration(migrations.Migration):
("finish_timestamp", models.DateTimeField(auto_now=True)), ("finish_timestamp", models.DateTimeField(auto_now=True)),
( (
"status", "status",
models.PositiveIntegerField( models.TextField(
choices=[(1, "Successful"), (2, "Warning"), (4, "Error"), (8, "Unknown")] choices=[
("unknown", "Unknown"),
("successful", "Successful"),
("warning", "Warning"),
("error", "Error"),
]
), ),
), ),
("description", models.TextField(null=True)), ("description", models.TextField(null=True)),

View File

@ -585,13 +585,13 @@ class NotificationWebhookMapping(PropertyMapping):
verbose_name_plural = _("Webhook Mappings") verbose_name_plural = _("Webhook Mappings")
class TaskStatus(models.IntegerChoices): class TaskStatus(models.TextChoices):
"""Possible states of tasks""" """Possible states of tasks"""
SUCCESSFUL = 1 UNKNOWN = "unknown"
WARNING = 2 SUCCESSFUL = "successful"
ERROR = 4 WARNING = "warning"
UNKNOWN = 8 ERROR = "error"
class SystemTask(SerializerModel, ExpiringModel): class SystemTask(SerializerModel, ExpiringModel):
@ -604,7 +604,7 @@ class SystemTask(SerializerModel, ExpiringModel):
start_timestamp = models.DateTimeField(auto_now_add=True) start_timestamp = models.DateTimeField(auto_now_add=True)
finish_timestamp = models.DateTimeField(auto_now=True) finish_timestamp = models.DateTimeField(auto_now=True)
status = models.PositiveIntegerField(choices=TaskStatus.choices) status = models.TextField(choices=TaskStatus.choices)
description = models.TextField(null=True) description = models.TextField(null=True)
messages = models.JSONField() messages = models.JSONField()

View File

@ -3265,10 +3265,10 @@
"status": { "status": {
"type": "string", "type": "string",
"enum": [ "enum": [
"UNKNOWN",
"SUCCESSFUL", "SUCCESSFUL",
"WARNING", "WARNING",
"ERROR", "ERROR"
"UNKNOWN"
], ],
"title": "Status" "title": "Status"
}, },

View File

@ -6871,17 +6871,17 @@ paths:
- in: query - in: query
name: status name: status
schema: schema:
type: integer type: string
enum: enum:
- 1 - error
- 2 - successful
- 4 - unknown
- 8 - warning
description: |- description: |-
* `1` - Successful * `unknown` - Unknown
* `2` - Warning * `successful` - Successful
* `4` - Error * `warning` - Warning
* `8` - Unknown * `error` - Error
- in: query - in: query
name: uid name: uid
schema: schema:
@ -42744,16 +42744,16 @@ components:
- uuid - uuid
SystemTaskStatusEnum: SystemTaskStatusEnum:
enum: enum:
- UNKNOWN
- SUCCESSFUL - SUCCESSFUL
- WARNING - WARNING
- ERROR - ERROR
- UNKNOWN
type: string type: string
description: |- description: |-
* `UNKNOWN` - UNKNOWN
* `SUCCESSFUL` - SUCCESSFUL * `SUCCESSFUL` - SUCCESSFUL
* `WARNING` - WARNING * `WARNING` - WARNING
* `ERROR` - ERROR * `ERROR` - ERROR
* `UNKNOWN` - UNKNOWN
TOTPDevice: TOTPDevice:
type: object type: object
description: Serializer for totp authenticator devices description: Serializer for totp authenticator devices