support-organizer/backend/src/models/requestentry.py

35 lines
1.4 KiB
Python
Raw Normal View History

2023-10-02 18:18:21 +00:00
from enum import Enum
import marshmallow as ma
class ModifiersEnum(Enum):
NONE = 0
ESPORTS = 1
SUPER = 2
HYPER = 3
class BaseField(ma.Schema):
id = ma.fields.Integer(description="Atlas Academy id")
image = ma.fields.Url(description="URL to atlas image")
class ServantField(BaseField):
name = ma.fields.String(description="Name of servant", example="Scáthach")
level = ma.fields.Integer(description="Servant level", example=120)
modifiers = ma.fields.List(ma.fields.Enum(ModifiersEnum), example=ModifiersEnum.HYPER)
class CeField(BaseField):
name = ma.fields.String(description="Name of CE", example="Holy Night Supper")
mlb = ma.fields.Boolean(description="If the CE should be MLB or not", example=True)
class RequestFieldContent(ma.Schema):
servant = ma.fields.Nested(ServantField)
ce = ma.fields.Nested(CeField)
class RequestPostData(ma.Schema):
username = ma.fields.String(description="Username of the requesting person", example="Firq")
description = ma.fields.String(description="Short description for what the request is used", example="DB 7T attempts with Scathach")
friendcode = ma.fields.String(description="Friendcode of the requesting person", example="000,000,000")
request = ma.fields.Nested(RequestFieldContent)
class RequestDatabaseEntry(RequestPostData):
uuid = ma.fields.String(description="UUID v4 of the request")