Enhance backend functionality and frontend UI
- Updated main.py to include authentication for brand, model, and OTA routers. - Added new OTA schemas in schemas.py for version management. - Enhanced model retrieval with sorting options in models.py. - Improved model update functionality to support multipart/form-data uploads. - Updated frontend layout and styles for a more modern look, including new font integration. - Implemented login route and authentication checks in router/index.js. - Added sorting capabilities in model table and improved file handling in model view. - Updated requirements.txt to include PyJWT for token management.
This commit is contained in:
@@ -52,3 +52,55 @@ class ModelResponse(ModelBase):
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
# OTA Schemas
|
||||
class OtaBase(BaseModel):
|
||||
verCode: int = Field(..., description="版本号(整数)")
|
||||
verName: str = Field(..., min_length=1, max_length=20, description="版本名称")
|
||||
url: str = Field(..., max_length=255, description="升级包 URL")
|
||||
md5: str = Field(..., min_length=32, max_length=32, description="升级包 MD5")
|
||||
force: Optional[int] = Field(0, ge=0, le=1, description="是否强升;0-否")
|
||||
desc: Optional[str] = Field(None, max_length=255, description="描述")
|
||||
model: Optional[str] = Field(None, max_length=100, description="对应的设备型号")
|
||||
hw: Optional[int] = Field(0, description="硬件版本号")
|
||||
target: Optional[int] = Field(0, ge=0, le=1, description="是否定向,1-是,0-否")
|
||||
beta: Optional[int] = Field(0, ge=0, le=1, description="是否灰度,1-是,0-否")
|
||||
pawVerCode: Optional[int] = Field(0, description="配对版本号")
|
||||
pawVerName: Optional[str] = Field("", max_length=20, description="配对版本名称")
|
||||
pawUrl: Optional[str] = Field("", max_length=255, description="配对版本 URL")
|
||||
pawMd5: Optional[str] = Field("", min_length=32, max_length=32, description="配对版本 MD5")
|
||||
startTime: Optional[datetime] = Field(None, description="升级开始时间")
|
||||
endTime: Optional[datetime] = Field(None, description="升级结束时间")
|
||||
status: Optional[int] = Field(1, ge=0, le=1, description="是否可用")
|
||||
|
||||
|
||||
class OtaCreate(OtaBase):
|
||||
pass
|
||||
|
||||
|
||||
class OtaUpdate(BaseModel):
|
||||
verCode: Optional[int] = Field(None, description="版本号(整数)")
|
||||
verName: Optional[str] = Field(None, min_length=1, max_length=20, description="版本名称")
|
||||
url: Optional[str] = Field(None, max_length=255, description="升级包 URL")
|
||||
md5: Optional[str] = Field(None, min_length=32, max_length=32, description="升级包 MD5")
|
||||
force: Optional[int] = Field(None, ge=0, le=1, description="是否强升;0-否")
|
||||
desc: Optional[str] = Field(None, max_length=255, description="描述")
|
||||
model: Optional[str] = Field(None, max_length=100, description="对应的设备型号")
|
||||
hw: Optional[int] = Field(None, description="硬件版本号")
|
||||
target: Optional[int] = Field(None, ge=0, le=1, description="是否定向,1-是,0-否")
|
||||
beta: Optional[int] = Field(None, ge=0, le=1, description="是否灰度,1-是,0-否")
|
||||
pawVerCode: Optional[int] = Field(None, description="配对版本号")
|
||||
pawVerName: Optional[str] = Field(None, max_length=20, description="配对版本名称")
|
||||
pawUrl: Optional[str] = Field(None, max_length=255, description="配对版本 URL")
|
||||
pawMd5: Optional[str] = Field(None, min_length=32, max_length=32, description="配对版本 MD5")
|
||||
startTime: Optional[datetime] = Field(None, description="升级开始时间")
|
||||
endTime: Optional[datetime] = Field(None, description="升级结束时间")
|
||||
status: Optional[int] = Field(None, ge=0, le=1, description="是否可用")
|
||||
|
||||
|
||||
class OtaResponse(OtaBase):
|
||||
id: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
Reference in New Issue
Block a user