0.1.4 models update

This commit is contained in:
2026-07-22 16:12:10 +03:00
parent 588bff725b
commit 8e66161ddd
12 changed files with 386 additions and 18 deletions
+9
View File
@@ -0,0 +1,9 @@
from typing import Annotated
from src.models.pydantic_models.model import Base
from pydantic import Field
from uuid import UUID
class AccountantCreate(Base):
name:Annotated[str, Field(...,max_length=64,description="name of the accountant setting")]
database_key:Annotated[UUID, Field(..., description="database key from the 1C server")]
+26
View File
@@ -0,0 +1,26 @@
from datetime import datetime
from typing import Annotated
from uuid import UUID
from src.models.pydantic_models.model import Base
from pydantic import Field
class ReportCreate(Base):
filename:Annotated[str,Field(..., min_length=2, max_length=255, description="name of the report")]
doc_date:Annotated[datetime, Field(..., description="ts of the report")]
status:Annotated[str, Field(..., max_length=64, description="status of the report (uploaded,finalized, failed)")]
user:Annotated[UUID, Field(..., description="id of the user author")]
market:Annotated[str, Field(..., max_length=64,description="name of the market")]
class ReportOut(Base):
filename:Annotated[str,Field(..., min_length=2, max_length=255, description="name of the report")]
doc_date:Annotated[datetime, Field(..., description="ts of the report")]
status:Annotated[str, Field(..., max_length=64, description="status of the report (uploaded,finalized, failed)")]
user:Annotated[UUID, Field(..., description="id of the user author")]
market:Annotated[str, Field(..., max_length=64, description="name of the market")]
class MarketCreate(Base):
name:Annotated[str, Field(..., max_length=64,description="certificate or declaration")]
class MarketOut(Base):
name:Annotated[str, Field(..., max_length=64,description="certificate or declaration")]
+35
View File
@@ -0,0 +1,35 @@
from decimal import Decimal
from src.models.pydantic_models.model import Base
from pydantic import Field
from typing import Annotated
class NomenclatureCreate(Base):
article:Annotated[str, Field(...,min_length=5,max_length=16, description="name of the article")]
price:Annotated[Decimal, Field(..., max_digits=12, description="price of the article")]
tnvd:Annotated[int, Field(..., max_digits=10, description="tnvd from the Markirovka.crpt")]
status:Annotated[bool, Field(..., description="status of the article")]
doc_type:Annotated[str, Field(..., description="document type (declaration or certificate)")]
fabric:Annotated[str, Field(..., description="fabric of the product")]
class NomenclatureOut(Base):
article:Annotated[str, Field(..., min_length=5,max_length=16, description="name of the article")]
price:Annotated[Decimal, Field(..., max_digits=12,description="price of the article")]
tnvd:Annotated[int, Field(..., max_digits=10,description="tnvd from the Markirovka.crpt")]
status:Annotated[bool, Field(..., description="status of the article")]
doc_type:Annotated[str, Field(...,max_length=64, description="document type (declaration or certificate)")]
fabric:Annotated[str, Field(...,max_length=64, description="fabric of the product")]
class DocumentTypeCreate(Base):
name:Annotated[str, Field(...,max_length=64, description="certificate or declaration")]
class DocumentTypeOut(Base):
name:Annotated[str, Field(..., max_length=64,description="certificate or declaration")]
class FabricCreate(Base):
name:Annotated[str, Field(..., max_length=64,description="certificate or declaration")]
class FabricOut(Base):
name:Annotated[str, Field(..., max_length=64,description="certificate or declaration")]
+11 -13
View File
@@ -40,8 +40,7 @@ class UserUpdate(Base):
permissions:Annotated[list[str]|None, Field(None, description="permissions of the user")]
permission_groups:Annotated[list[str]|None, Field(None, description="permissions groups of the user")]
class Permissions(Base):
id:int
class PermissionsCreate(Base):
permission:Annotated[str, Field(..., max_length=30, description="permission name")]
@@ -49,8 +48,8 @@ class PermissionsOut(Base):
permission:Annotated[str, Field(..., max_length=30, description="permission name")]
class PermissionsGroups(Base):
id:int
class PermissionsGroupsCreate(Base):
group:Annotated[str, Field(..., max_length=255, description="group name for the permissions")]
@@ -59,21 +58,20 @@ class PermissionsGroupsOut(Base):
group:Annotated[str, Field(..., max_length=255, description="group name for the permissions")]
class RefreshTokens(Base):
class RefreshTokensCreate(Base):
user_id:Annotated[UUID, Field(..., description="foreign key for the user")]
token_hash:Annotated[str, Field(..., description="token hash")]
device_info:Annotated[str, Field(..., description="User device info")]
ip_address:Annotated[str, Field(..., description="ip v4/v6 of the user")]
token_hash:Annotated[str, Field(...,max_length=255, description="token hash")]
device_info:Annotated[str, Field(...,max_length=255, description="User device info")]
ip_address:Annotated[str, Field(...,max_length=45, description="ip v4/v6 of the user")]
is_revoked:Annotated[bool|None, Field(None, description="revoke token if logout was made")]
expires_at:Annotated[datetime, Field(..., description="when token is going to be expired")]
class RefreshTokensOut(Base):
id:int
user_id:Annotated[UUID, Field(..., description="foreign key for the user")]
token_hash:Annotated[str, Field(..., description="token hash")]
device_info:Annotated[str, Field(..., description="User device info")]
ip_address:Annotated[str, Field(..., description="ip v4/v6 of the user")]
token_hash:Annotated[str, Field(..., max_length=255,description="token hash")]
device_info:Annotated[str, Field(..., max_length=255, description="User device info")]
ip_address:Annotated[str, Field(...,max_length=45, description="ip v4/v6 of the user")]
is_revoked:Annotated[bool|None, Field(None, description="revoke token if logout was made")]
expires_at:Annotated[datetime, Field(..., description="when token is going to be expired")]