2021-05-05 20:21:04 +00:00
|
|
|
from marshmallow import Schema, fields
|
|
|
|
|
|
|
|
|
|
|
|
class UserSchema(Schema):
|
|
|
|
email = fields.String(description="The user's email.")
|
|
|
|
username = fields.String(description="The user's username.")
|
|
|
|
isAdmin = fields.Boolean(description="True if the user is an administrator.")
|
|
|
|
|
|
|
|
|
|
|
|
class LoginSchema(Schema):
|
|
|
|
access_token = fields.String(description="The access token that authorizes the user to proceed.")
|
|
|
|
expiration = fields.DateTime(description="The expiration date of the authorization code.")
|
|
|
|
user = fields.Nested(UserSchema)
|
|
|
|
|
|
|
|
|
|
|
|
class InputLoginSchema(Schema):
|
|
|
|
email = fields.String(description="The user's email.")
|
|
|
|
password = fields.String(description="The user's password.")
|
|
|
|
|
|
|
|
|
|
|
|
class ErrorSchema(Schema):
|
|
|
|
result = fields.String(description="Contains a string that informs if the procedure was successful.")
|
|
|
|
msg = fields.String(description="Contains a description of the error.")
|
|
|
|
|
|
|
|
|
|
|
|
class SuccesSchema(Schema):
|
|
|
|
result = fields.String(description="Contains a string that informs if the procedure was successful.")
|
|
|
|
data = fields.String(description="The content of the response.")
|
|
|
|
|
|
|
|
|
|
|
|
class EmailParameterSchema(Schema):
|
|
|
|
email = fields.String(description="The target user's email.")
|
|
|
|
|
|
|
|
|
2021-05-05 20:45:36 +00:00
|
|
|
class IntegerParameterSchema(Schema):
|
2021-05-06 09:25:39 +00:00
|
|
|
rid = fields.Integer(description="The target numeric id.")
|
2021-05-05 20:45:36 +00:00
|
|
|
|
|
|
|
|
2021-05-05 20:21:04 +00:00
|
|
|
class CreateUser(Schema):
|
|
|
|
email = fields.String(description="The new user's email.")
|
|
|
|
username = fields.String(description="The new user's username.")
|
2021-05-05 20:45:36 +00:00
|
|
|
password = fields.String(description="The new user's password.")
|
|
|
|
|
|
|
|
|
2021-05-06 15:20:07 +00:00
|
|
|
class ConditionSchema(Schema):
|
|
|
|
id = fields.Integer(description="The condition id.")
|
|
|
|
type = fields.Integer(description="The condition type.")
|
|
|
|
content = fields.String(description="The condition content. Meaning may change according to type.")
|
|
|
|
|
|
|
|
|
2021-05-05 20:45:36 +00:00
|
|
|
class RepositorySchema(Schema):
|
|
|
|
id = fields.Integer(description="The repository id.")
|
|
|
|
name = fields.String(description="The repository name.")
|
|
|
|
start = fields.DateTime(description="The start date of the repository.")
|
2021-05-06 15:20:07 +00:00
|
|
|
is_active = fields.Boolean(description="True if the repository is active.")
|
2021-05-05 20:45:36 +00:00
|
|
|
end = fields.DateTime(description="The end date of the repository")
|
|
|
|
owner = fields.Nested(UserSchema)
|
2021-05-06 15:20:07 +00:00
|
|
|
conditions = fields.Nested(ConditionSchema, many=True)
|
|
|
|
evaluation_mode = fields.Integer(description="The mode with which conditions are evaluated.")
|
2021-05-05 20:45:36 +00:00
|
|
|
|
|
|
|
|
2021-05-06 09:25:39 +00:00
|
|
|
class CreateRepository(Schema):
|
|
|
|
name = fields.String(description="The repository name.")
|
|
|
|
|
|
|
|
|
2021-05-05 20:45:36 +00:00
|
|
|
class RepositoryUpdate(Schema):
|
|
|
|
name = fields.String(description="If present, it changes the name of the repository.")
|
|
|
|
close = fields.String(description="If present, it closes the repository.")
|
2021-05-06 00:57:26 +00:00
|
|
|
open = fields.String(description="If present, it opens the repository.")
|
2021-05-06 15:20:07 +00:00
|
|
|
evaluation_mode = fields.Integer(description="If present, it alters the Condition evaluation mode.")
|
2021-05-06 09:25:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
class CreateCondition(Schema):
|
|
|
|
type = fields.Integer(description="The condition type.")
|
2021-05-06 12:12:11 +00:00
|
|
|
content = fields.String(description="The condition content. Meaning may change according to type.")
|
|
|
|
|
|
|
|
|
|
|
|
class ConditionParameterSchema(Schema):
|
2021-05-06 15:20:07 +00:00
|
|
|
cid = fields.Integer(description="The condition id.")
|