From 0ccb6403a3aa66ef0ca9b37c1a9caee2d04d367c Mon Sep 17 00:00:00 2001 From: inter Date: Mon, 8 Sep 2025 16:36:14 +0800 Subject: [PATCH] Add File --- backend/apps/system/models/user.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 backend/apps/system/models/user.py diff --git a/backend/apps/system/models/user.py b/backend/apps/system/models/user.py new file mode 100644 index 0000000..078f02d --- /dev/null +++ b/backend/apps/system/models/user.py @@ -0,0 +1,23 @@ + +from typing import Optional +from sqlmodel import BigInteger, SQLModel, Field + +from common.core.models import SnowflakeBase +from common.core.security import default_md5_pwd +from common.utils.time import get_timestamp + + + +class BaseUserPO(SQLModel): + account: str = Field(max_length=255, unique=True) + oid: int = Field(nullable=False, sa_type=BigInteger(), default=0) + name: str = Field(max_length=255, unique=True) + password: str = Field(default_factory=default_md5_pwd, max_length=255) + email: str = Field(max_length=255) + status: int = Field(default=0, nullable=False) + create_time: int = Field(default_factory=get_timestamp, sa_type=BigInteger(), nullable=False) + language: str = Field(max_length=255, default="zh-CN") + +class UserModel(SnowflakeBase, BaseUserPO, table=True): + __tablename__ = "sys_user" +