修正了若干问题

This commit is contained in:
carry 2025-02-19 14:41:49 +08:00
parent 001bc4e52b
commit d78af84c66
4 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,5 @@
# 使用Python官方镜像
FROM python:3.9-slim
FROM python:3.11-slim
# 设置工作目录
WORKDIR /app
@ -8,7 +8,7 @@ WORKDIR /app
COPY requirements.txt .
# 安装依赖
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
# 复制项目文件
COPY . .

View File

@ -1,3 +1,5 @@
pydantic<2.0
asyncmy>=0.2.10
fastapi>=0.95.2
python-dotenv>=1.0.0
sqlalchemy>=2.0.15
@ -6,4 +8,5 @@ bcrypt>=4.0.1
pyjwt>=2.6.0
pytest>=7.3.1
requests>=2.28.2
cryptography>=42.0.2
uvicorn[standard]>=0.21.1

View File

@ -1,6 +1,6 @@
from datetime import datetime
from enum import Enum
from pydantic import BaseModel, Field, model_validator
from pydantic import BaseModel, Field, root_validator
from typing import Optional
# 用户角色枚举
@ -27,7 +27,7 @@ class UserUpdate(BaseModel):
description: Optional[str] = Field(None, max_length=255, description="用户描述")
# 可选:确保至少更新一个字段
@model_validator(mode='before')
@root_validator
def validate_at_least_one_field(cls, values):
if not any(values.values()):
raise ValueError("至少需要更新一个字段")

View File

@ -8,7 +8,8 @@ WORKDIR /app
COPY package*.json ./
# 安装依赖
RUN npm install
RUN npm config set registry https://registry.npmmirror.com && \
npm install
# 复制项目文件
COPY . .