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
@ -33,8 +33,13 @@ class Migration(migrations.Migration):
("finish_timestamp", models.DateTimeField(auto_now=True)),
(
"status",
models.PositiveIntegerField(
choices=[(1, "Successful"), (2, "Warning"), (4, "Error"), (8, "Unknown")]
models.TextField(
choices=[
("unknown", "Unknown"),
("successful", "Successful"),
("warning", "Warning"),
("error", "Error"),
]
),
),
("description", models.TextField(null=True)),

View File

@ -585,13 +585,13 @@ class NotificationWebhookMapping(PropertyMapping):
verbose_name_plural = _("Webhook Mappings")
class TaskStatus(models.IntegerChoices):
class TaskStatus(models.TextChoices):
"""Possible states of tasks"""
SUCCESSFUL = 1
WARNING = 2
ERROR = 4
UNKNOWN = 8
UNKNOWN = "unknown"
SUCCESSFUL = "successful"
WARNING = "warning"
ERROR = "error"
class SystemTask(SerializerModel, ExpiringModel):
@ -604,7 +604,7 @@ class SystemTask(SerializerModel, ExpiringModel):
start_timestamp = models.DateTimeField(auto_now_add=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)
messages = models.JSONField()

View File

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

View File

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