Added validation to the database models
This commit is contained in:
parent
671286dc39
commit
972c5577f4
@ -11,10 +11,14 @@ class MasterPass(sqlmodel.SQLModel, table=True):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
salt: bytes = sqlmodel.Field(
|
salt: bytes = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False)
|
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False),
|
||||||
|
max_length=64,
|
||||||
|
min_length=64,
|
||||||
)
|
)
|
||||||
password_hash: bytes = sqlmodel.Field(
|
password_hash: bytes = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(sqlmodel.BINARY(128), nullable=False)
|
sa_column=sqlmodel.Column(sqlmodel.BINARY(128), nullable=False),
|
||||||
|
max_length=128,
|
||||||
|
min_length=128,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -22,13 +26,17 @@ class Account(sqlmodel.SQLModel, table=True):
|
|||||||
__tablename__ = "accounts"
|
__tablename__ = "accounts"
|
||||||
__table_args__ = (sqlmodel.PrimaryKeyConstraint("user_id", "name"),)
|
__table_args__ = (sqlmodel.PrimaryKeyConstraint("user_id", "name"),)
|
||||||
user_id: int = sqlmodel.Field()
|
user_id: int = sqlmodel.Field()
|
||||||
name: str = sqlmodel.Field(max_length=255)
|
name: str = sqlmodel.Field(max_length=256)
|
||||||
salt: bytes = sqlmodel.Field(
|
salt: bytes = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False)
|
sa_column=sqlmodel.Column(sqlmodel.BINARY(64), nullable=False),
|
||||||
|
max_length=64,
|
||||||
|
min_length=64,
|
||||||
)
|
)
|
||||||
enc_login: bytes = sqlmodel.Field(
|
enc_login: bytes = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False)
|
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False),
|
||||||
|
max_length=256,
|
||||||
)
|
)
|
||||||
enc_password: bytes = sqlmodel.Field(
|
enc_password: bytes = sqlmodel.Field(
|
||||||
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False)
|
sa_column=sqlmodel.Column(sqlmodel.VARBINARY(256), nullable=False),
|
||||||
|
max_length=256,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user