minor refactoring of models/schemas
This commit is contained in:
parent
932f2bdda6
commit
ccfe1fe19f
19
models.py
19
models.py
@ -4,17 +4,20 @@ from flask_restx import fields
|
|||||||
chartype_field = fields.String(
|
chartype_field = fields.String(
|
||||||
required=True,
|
required=True,
|
||||||
default="human",
|
default="human",
|
||||||
description='Character type. Allowed values: "human", "humanoid", "mutant", "cyborg"')
|
description='Character type. Allowed values: "human", "humanoid", "mutant", "cyborg"'
|
||||||
|
)
|
||||||
|
|
||||||
# Mutations Model
|
conscore_field = fields.Integer(
|
||||||
mutation_model = {
|
|
||||||
'conscore': fields.Integer(
|
|
||||||
required=True,
|
required=True,
|
||||||
default=3,
|
default=10,
|
||||||
min=3,
|
min=3,
|
||||||
max=18,
|
max=18,
|
||||||
description='The characters constitution score'
|
description='The characters constitution score'
|
||||||
),
|
)
|
||||||
|
|
||||||
|
# Mutations Model
|
||||||
|
mutation_model = {
|
||||||
|
'conscore': conscore_field,
|
||||||
'intscore': fields.Integer(
|
'intscore': fields.Integer(
|
||||||
required=True,
|
required=True,
|
||||||
default=3,
|
default=3,
|
||||||
@ -36,13 +39,13 @@ ability_model = {
|
|||||||
'ability': fields.String(
|
'ability': fields.String(
|
||||||
required=False,
|
required=False,
|
||||||
default="all",
|
default="all",
|
||||||
description='The ability to roll. Not required. Defaults "generic"'),
|
description='The ability to roll. Not required. Defaults to "all".'),
|
||||||
}
|
}
|
||||||
|
|
||||||
# Hp model
|
# Hp model
|
||||||
hp_model = {
|
hp_model = {
|
||||||
'chartype': chartype_field,
|
'chartype': chartype_field,
|
||||||
'conscore': fields.Integer(required=True, description='Conscore')
|
'conscore': conscore_field
|
||||||
}
|
}
|
||||||
|
|
||||||
ma_model = {
|
ma_model = {
|
||||||
|
22
schemas.py
22
schemas.py
@ -6,28 +6,26 @@ chartype_field = fields.String(
|
|||||||
description='The characters type of being'
|
description='The characters type of being'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
conscore_field = fields.Integer(
|
||||||
|
required=True,
|
||||||
|
default=10,
|
||||||
|
validate=validate.Range(min=3, max=18),
|
||||||
|
description='The constitution score of the character'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class MutationSchema(Schema):
|
class MutationSchema(Schema):
|
||||||
conscore = fields.Integer(
|
conscore = conscore_field
|
||||||
required=True,
|
|
||||||
validate=validate.Range(min=3, max=18),
|
|
||||||
description='The characters constitution score'
|
|
||||||
)
|
|
||||||
intscore = fields.Integer(
|
intscore = fields.Integer(
|
||||||
required=True,
|
required=True,
|
||||||
validate=validate.Range(min=3, max=21),
|
validate=validate.Range(min=3, max=18),
|
||||||
description='The characters intelligence score'
|
description='The characters intelligence score'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HPSchema(Schema):
|
class HPSchema(Schema):
|
||||||
chartype = chartype_field
|
chartype = chartype_field
|
||||||
conscore = fields.Integer(
|
conscore = conscore_field
|
||||||
required=True,
|
|
||||||
default=10,
|
|
||||||
validate=validate.Range(min=3, max=24),
|
|
||||||
description='The constitution score of the character'
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DiceSchema(Schema):
|
class DiceSchema(Schema):
|
||||||
|
Loading…
Reference in New Issue
Block a user