Revert "feat: test1"
Deploy to Staging / deploy (push) Has been cancelled
Lint Backend / lint-backend (push) Has been cancelled
Playwright Tests / changes (push) Has been cancelled
Test Backend / test-backend (push) Has been cancelled
Test Docker Compose / test-docker-compose (push) Has been cancelled
Playwright Tests / test-playwright (1, 4) (push) Has been cancelled
Playwright Tests / test-playwright (2, 4) (push) Has been cancelled
Playwright Tests / test-playwright (3, 4) (push) Has been cancelled
Playwright Tests / test-playwright (4, 4) (push) Has been cancelled
Playwright Tests / merge-playwright-reports (push) Has been cancelled
Playwright Tests / alls-green-playwright (push) Has been cancelled
Issue Manager / issue-manager (push) Has been cancelled

This reverts commit fd9aa1f00d.
This commit is contained in:
mazxd
2025-03-25 22:05:00 +08:00
parent e7a9a8adec
commit db6f713ba6
8 changed files with 1539 additions and 1942 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ STACK_NAME=BaiPanSou
BACKEND_CORS_ORIGINS="http://localhost,http://localhost:5173,https://localhost,https://localhost:5173,http://localhost.tiangolo.com" BACKEND_CORS_ORIGINS="http://localhost,http://localhost:5173,https://localhost,https://localhost:5173,http://localhost.tiangolo.com"
SECRET_KEY=baomihua200712 SECRET_KEY=baomihua200712
FIRST_SUPERUSER=mzaxd0712@gmail.com FIRST_SUPERUSER=mzaxd0712@gmail.com
FIRST_SUPERUSER_PASSWORD=baomihua8434386 FIRST_SUPERUSER_PASSWORD=200712
# Emails # Emails
SMTP_HOST= SMTP_HOST=
-9
View File
@@ -1,9 +0,0 @@
from fastapi import APIRouter
from app.api.v1.endpoints import auth, users, utils, todos
api_router = APIRouter()
api_router.include_router(auth.router, prefix="/auth", tags=["auth"])
api_router.include_router(users.router, prefix="/users", tags=["users"])
api_router.include_router(utils.router, prefix="/utils", tags=["utils"])
api_router.include_router(todos.router, prefix="/todos", tags=["todos"])
-75
View File
@@ -1,75 +0,0 @@
from typing import List
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from app.api import deps
from app.schemas.todo import Todo, TodoCreate, TodoUpdate
from app.models.todo import Todo as TodoModel
from app.crud.todo import todo
router = APIRouter()
@router.get("/", response_model=List[Todo])
def read_todos(
db: Session = Depends(deps.get_db),
skip: int = 0,
limit: int = 100,
):
"""
Retrieve todos.
"""
return todo.get_multi(db, skip=skip, limit=limit)
@router.post("/", response_model=Todo)
def create_todo(
*,
db: Session = Depends(deps.get_db),
todo_in: TodoCreate,
):
"""
Create new todo.
"""
return todo.create(db=db, obj_in=todo_in)
@router.put("/{id}", response_model=Todo)
def update_todo(
*,
db: Session = Depends(deps.get_db),
id: int,
todo_in: TodoUpdate,
):
"""
Update a todo.
"""
todo_current = todo.get(db=db, id=id)
if not todo_current:
raise HTTPException(status_code=404, detail="Todo not found")
return todo.update(db=db, db_obj=todo_current, obj_in=todo_in)
@router.get("/{id}", response_model=Todo)
def read_todo(
*,
db: Session = Depends(deps.get_db),
id: int,
):
"""
Get todo by ID.
"""
todo_current = todo.get(db=db, id=id)
if not todo_current:
raise HTTPException(status_code=404, detail="Todo not found")
return todo_current
@router.delete("/{id}", response_model=Todo)
def delete_todo(
*,
db: Session = Depends(deps.get_db),
id: int,
):
"""
Delete todo.
"""
todo_current = todo.get(db=db, id=id)
if not todo_current:
raise HTTPException(status_code=404, detail="Todo not found")
return todo.remove(db=db, id=id)
-23
View File
@@ -1,23 +0,0 @@
from typing import List
from fastapi.encoders import jsonable_encoder
from sqlalchemy.orm import Session
from app.crud.base import CRUDBase
from app.models.todo import Todo
from app.schemas.todo import TodoCreate, TodoUpdate
class CRUDTodo(CRUDBase[Todo, TodoCreate, TodoUpdate]):
def create(self, db: Session, *, obj_in: TodoCreate) -> Todo:
obj_in_data = jsonable_encoder(obj_in)
db_obj = self.model(**obj_in_data)
db.add(db_obj)
db.commit()
db.refresh(db_obj)
return db_obj
def get_multi(
self, db: Session, *, skip: int = 0, limit: int = 100
) -> List[Todo]:
return db.query(self.model).offset(skip).limit(limit).all()
todo = CRUDTodo(Todo)
-13
View File
@@ -1,13 +0,0 @@
from sqlalchemy import Column, Integer, String, Boolean, DateTime
from sqlalchemy.sql import func
from app.db.base_class import Base
class Todo(Base):
__tablename__ = "todos"
id = Column(Integer, primary_key=True, index=True)
title = Column(String, index=True)
description = Column(String, nullable=True)
completed = Column(Boolean, default=False)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
-22
View File
@@ -1,22 +0,0 @@
from pydantic import BaseModel
from datetime import datetime
from typing import Optional
class TodoBase(BaseModel):
title: str
description: Optional[str] = None
completed: bool = False
class TodoCreate(TodoBase):
pass
class TodoUpdate(TodoBase):
pass
class Todo(TodoBase):
id: int
created_at: datetime
updated_at: Optional[datetime] = None
class Config:
from_attributes = True
+1536 -1797
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -16,7 +16,7 @@
"@tanstack/react-query": "^5.28.14", "@tanstack/react-query": "^5.28.14",
"@tanstack/react-query-devtools": "^5.28.14", "@tanstack/react-query-devtools": "^5.28.14",
"@tanstack/react-router": "1.19.1", "@tanstack/react-router": "1.19.1",
"axios": "^1.8.4", "axios": "1.7.4",
"form-data": "4.0.0", "form-data": "4.0.0",
"next-themes": "^0.4.4", "next-themes": "^0.4.4",
"react": "^18.2.0", "react": "^18.2.0",
@@ -37,6 +37,6 @@
"@vitejs/plugin-react-swc": "^3.5.0", "@vitejs/plugin-react-swc": "^3.5.0",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"vite": "^6.2.3" "vite": "^5.4.14"
} }
} }