[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2024-07-10 19:40:35 +00:00
parent 9b97b1ddf6
commit add85dc29f
7 changed files with 6459 additions and 4838 deletions
+12 -60
View File
@@ -45,11 +45,7 @@ class User(ormar.Model):
totp_secret: str = ormar.String(max_length=32, min_length=32, nullable=True, default=None) totp_secret: str = ormar.String(max_length=32, min_length=32, nullable=True, default=None)
storage_used: int = ormar.BigInteger(nullable=False, default=0, minimum=0) storage_used: int = ormar.BigInteger(nullable=False, default=0, minimum=0)
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(database=database, metadata=metadata, tablename="users")
database=database,
metadata=metadata,
tablename="users"
)
class FidoCredentials(ormar.Model): class FidoCredentials(ormar.Model):
@@ -59,22 +55,14 @@ class FidoCredentials(ormar.Model):
sign_count: int = ormar.Integer() sign_count: int = ormar.Integer()
user: Optional[User] = ormar.ForeignKey(User, ondelete=ReferentialAction.CASCADE) user: Optional[User] = ormar.ForeignKey(User, ondelete=ReferentialAction.CASCADE)
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(database=database, metadata=metadata, tablename="fido_credentials")
database=database,
metadata=metadata,
tablename="fido_credentials"
)
class ApiKey(ormar.Model): class ApiKey(ormar.Model):
key: str = ormar.String(max_length=48, min_length=48, primary_key=True) key: str = ormar.String(max_length=48, min_length=48, primary_key=True)
user: Optional[User] = ormar.ForeignKey(User, ondelete=ReferentialAction.CASCADE) user: Optional[User] = ormar.ForeignKey(User, ondelete=ReferentialAction.CASCADE)
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(database=database, metadata=metadata, tablename="api_keys")
database=database,
metadata=metadata,
tablename="api_keys"
)
class UserSession(ormar.Model): class UserSession(ormar.Model):
@@ -90,11 +78,7 @@ class UserSession(ormar.Model):
user_agent: str = ormar.String(max_length=255, nullable=True) user_agent: str = ormar.String(max_length=255, nullable=True)
last_seen: datetime = ormar.DateTime(default=datetime.now()) last_seen: datetime = ormar.DateTime(default=datetime.now())
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(database=database, metadata=metadata, tablename="user_sessions")
database=database,
metadata=metadata,
tablename="user_sessions"
)
class ABCDQuizAnswer(BaseModel): class ABCDQuizAnswer(BaseModel):
@@ -187,21 +171,13 @@ class Quiz(ormar.Model):
views: int = ormar.Integer(nullable=False, default=0, server_default="0") views: int = ormar.Integer(nullable=False, default=0, server_default="0")
mod_rating: int | None = ormar.SmallInteger(nullable=True) mod_rating: int | None = ormar.SmallInteger(nullable=True)
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(tablename="quiz", metadata=metadata, database=database)
tablename = "quiz",
metadata = metadata,
database = database
)
class InstanceData(ormar.Model): class InstanceData(ormar.Model):
instance_id: uuid.UUID = ormar.UUID(primary_key=True, default=uuid.uuid4(), nullable=False, unique=True) instance_id: uuid.UUID = ormar.UUID(primary_key=True, default=uuid.uuid4(), nullable=False, unique=True)
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(tablename="instance_data", metadata=metadata, database=database)
tablename = "instance_data",
metadata = metadata,
database = database
)
class Token(BaseModel): class Token(BaseModel):
@@ -310,11 +286,7 @@ class GameResults(ormar.Model):
description: str = ormar.Text(nullable=False) description: str = ormar.Text(nullable=False)
questions: Json[list[QuizQuestion]] = ormar.JSON(nullable=False) questions: Json[list[QuizQuestion]] = ormar.JSON(nullable=False)
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(database=database, metadata=metadata, tablename="game_results")
database=database,
metadata=metadata,
tablename="game_results"
)
class QuizTivityInput(BaseModel): class QuizTivityInput(BaseModel):
@@ -329,11 +301,7 @@ class QuizTivity(ormar.Model):
user: User | None = ormar.ForeignKey(User, ondelete=ReferentialAction.CASCADE) user: User | None = ormar.ForeignKey(User, ondelete=ReferentialAction.CASCADE)
pages: list[QuizTivityPage] = ormar.JSON(nullable=False) pages: list[QuizTivityPage] = ormar.JSON(nullable=False)
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(tablename="quiztivitys", metadata=metadata, database=database)
tablename = "quiztivitys",
metadata = metadata,
database = database
)
class QuizTivityShare(ormar.Model): class QuizTivityShare(ormar.Model):
@@ -343,11 +311,7 @@ class QuizTivityShare(ormar.Model):
quiztivity: QuizTivity | None = ormar.ForeignKey(QuizTivity, ondelete=ReferentialAction.CASCADE) quiztivity: QuizTivity | None = ormar.ForeignKey(QuizTivity, ondelete=ReferentialAction.CASCADE)
user: User | None = ormar.ForeignKey(User, ondelete=ReferentialAction.CASCADE) user: User | None = ormar.ForeignKey(User, ondelete=ReferentialAction.CASCADE)
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(database=database, metadata=metadata, tablename="quiztivityshares")
database=database,
metadata=metadata,
tablename="quiztivityshares"
)
class OnlyId(BaseModel): class OnlyId(BaseModel):
@@ -392,11 +356,7 @@ class StorageItem(ormar.Model):
server: str | None = ormar.Text(default=None, nullable=True) server: str | None = ormar.Text(default=None, nullable=True)
imported: bool = ormar.Boolean(default=False, nullable=True) imported: bool = ormar.Boolean(default=False, nullable=True)
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(database=database, metadata=metadata, tablename="storage_items")
database=database,
metadata=metadata,
tablename="storage_items"
)
class PublicStorageItem(BaseModel): class PublicStorageItem(BaseModel):
@@ -480,11 +440,7 @@ class Controller(ormar.Model):
os_version: str | None = ormar.Text(nullable=True) os_version: str | None = ormar.Text(nullable=True)
wanted_os_version: str = ormar.Text(nullable=True, default=None) wanted_os_version: str = ormar.Text(nullable=True, default=None)
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(tablename="controller", metadata=metadata, database=database)
tablename = "controller",
metadata = metadata,
database = database
)
class Rating(ormar.Model): class Rating(ormar.Model):
@@ -494,8 +450,4 @@ class Rating(ormar.Model):
created_at: datetime = ormar.DateTime(nullable=False, server_default=func.now()) created_at: datetime = ormar.DateTime(nullable=False, server_default=func.now())
quiz: uuid.UUID | Quiz = ormar.ForeignKey(Quiz) quiz: uuid.UUID | Quiz = ormar.ForeignKey(Quiz)
ormar_config = ormar.OrmarConfig( ormar_config = ormar.OrmarConfig(database=database, metadata=metadata, tablename="rating")
database=database,
metadata=metadata,
tablename="rating"
)
+3 -3
View File
@@ -114,7 +114,7 @@ async def start_login(data: StartLoginInput):
step_2: set[StartLoginResponseTypes] = set() step_2: set[StartLoginResponseTypes] = set()
webauthn_data = None webauthn_data = None
webauthn_challenge = None webauthn_challenge = None
print("\"webauthn_challenge = None\" call completed...") print('"webauthn_challenge = None" call completed...')
print("user.verified: " + str(user.verified)) print("user.verified: " + str(user.verified))
if user is None or not user.verified: if user is None or not user.verified:
step_1.add(StartLoginResponseTypes.PASSWORD) step_1.add(StartLoginResponseTypes.PASSWORD)
@@ -122,7 +122,7 @@ async def start_login(data: StartLoginInput):
print("Okay. User is not None or unverified...") print("Okay. User is not None or unverified...")
if user.password is not None: if user.password is not None:
step_1.add(StartLoginResponseTypes.PASSWORD) step_1.add(StartLoginResponseTypes.PASSWORD)
''' TODO Find out why fidocredentialss is causing problems """ TODO Find out why fidocredentialss is causing problems
if len(user.fidocredentialss) > 0: if len(user.fidocredentialss) > 0:
if user.require_password is True: if user.require_password is True:
step_2.add(StartLoginResponseTypes.PASSKEY) step_2.add(StartLoginResponseTypes.PASSKEY)
@@ -137,7 +137,7 @@ async def start_login(data: StartLoginInput):
) )
webauthn_challenge = base64.b64encode(webauthn_data.challenge).decode("utf-8") webauthn_challenge = base64.b64encode(webauthn_data.challenge).decode("utf-8")
webauthn_data = options_to_json(webauthn_data) webauthn_data = options_to_json(webauthn_data)
''' """
print("Moving past commented code, the long string one...") print("Moving past commented code, the long string one...")
if user.totp_secret is not None: if user.totp_secret is not None:
if user.require_password: if user.require_password:
+2232 -561
View File
File diff suppressed because it is too large Load Diff
+1 -3
View File
@@ -31,7 +31,7 @@ const config = {
}, },
build: { build: {
sourcemap: true sourcemap: true
}, }
/* Trying /* Trying
@@ -40,8 +40,6 @@ const config = {
} }
end trying*/ end trying*/
}; };
export default config; export default config;