Skip to content

Commit

Permalink
Fix post and vote endpoints incorrect import models and schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
dotpep committed Mar 4, 2024
1 parent e22c3c7 commit 3a8481f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Endpoints:
- [x] Conteinerize with Docker & Docker compose
- [x] Configure Nginx and Uvicorn ASGI, Gunicorn workers
- [ ] GitHub action, CI/CD Pipeline
- [ ] Apply Clean Architecture, SOLID principles, Best practices and Common patterns for Backend/API
- [ ] Restructure project
- [ ] Refactor, Apply Clean Architecture, SOLID principles, Best practices and Common patterns for Backend/API
- [x] Restructure project
- [ ] Continue project, add new features, ideas like logging etc.

## How to run locally
Expand Down
2 changes: 0 additions & 2 deletions alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

from alembic import context

#from sqlmodel import SQLModel

#from app.models import *
from app.configs.database import Base
from app.configs.environment import settings

Expand Down
12 changes: 6 additions & 6 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

from app.routers import v1
from app.routers.v1 import post, vote, user, auth

#models.Base.metadata.create_all(bind=engine)

Expand All @@ -18,10 +18,10 @@
)


app.include_router(v1.post.router)
app.include_router(v1.vote.router)
app.include_router(v1.user.router)
app.include_router(v1.auth.router)
app.include_router(post.router)
app.include_router(vote.router)
app.include_router(user.router)
app.include_router(auth.router)

app.get('/', tags=["Welcome Home Page"])(lambda: {
"message": "Welcome to my Social Media API powered by FastAPI, API documentation in '/docs' and `/redoc` endpoint. Successfully CI/CD pipeline deployment!",
Expand All @@ -31,4 +31,4 @@

@app.get('/root', tags=["Welcome Home Page"], status_code=200)
def root():
return {"message": "Hello World"}
return {"message": "Hello Dear Developer"}
2 changes: 1 addition & 1 deletion app/routers/v1/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from sqlalchemy import func

from app.models.post import Post
from app.models.vote import Vote
from app.schemas.user import IUser
from app.schemas.vote import Vote
from app.schemas.post import IPost, ICreatePost, IUpdatePost, IPostVote
from app.configs import database
from app.utils import oauth2
Expand Down
4 changes: 2 additions & 2 deletions app/routers/v1/vote.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from app.models.vote import Vote
from app.models.post import Post
from app.schemas.vote import IVote
from app.schemas.user import IUser
from app.schemas.vote import Vote
from app.configs import database
from app.utils import oauth2

Expand All @@ -24,7 +24,7 @@ def delete_vote():

@router.post('/', status_code=status.HTTP_201_CREATED)
def vote_post(
vote: Vote,
vote: IVote,
db: Session = Depends(database.get_db),
current_user: IUser = Depends(oauth2.get_current_user)
):
Expand Down
2 changes: 1 addition & 1 deletion app/schemas/vote.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pydantic import BaseModel


class Vote(BaseModel):
class IVote(BaseModel):
post_id: int
is_voted: bool

0 comments on commit 3a8481f

Please sign in to comment.