Skip to content

Commit 8fefd27

Browse files
committed
updated
1 parent 9a22cc1 commit 8fefd27

File tree

4 files changed

+2
-127
lines changed

4 files changed

+2
-127
lines changed

app/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from fastapi import FastAPI
22
from fastapi.middleware.cors import CORSMiddleware
33
from app.config import settings
4-
from app.routers import user, auth, post
4+
from app.routers import user, auth
55

66
app = FastAPI()
77

@@ -20,7 +20,6 @@
2020

2121
app.include_router(auth.router, tags=['Auth'], prefix='/api/auth')
2222
app.include_router(user.router, tags=['Users'], prefix='/api/users')
23-
app.include_router(post.router, tags=['Posts'], prefix='/api/posts')
2423

2524

2625
@app.get('/api/healthchecker')

app/models.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import uuid
22
from .database import Base
3-
from sqlalchemy import TIMESTAMP, Column, ForeignKey, String, Boolean, text
3+
from sqlalchemy import TIMESTAMP, Column, String, Boolean, text
44
from sqlalchemy.dialects.postgresql import UUID
5-
from sqlalchemy.orm import relationship
65

76

87
class User(Base):
@@ -19,20 +18,3 @@ class User(Base):
1918
nullable=False, server_default=text("now()"))
2019
updated_at = Column(TIMESTAMP(timezone=True),
2120
nullable=False, server_default=text("now()"))
22-
23-
24-
class Post(Base):
25-
__tablename__ = 'posts'
26-
id = Column(UUID(as_uuid=True), primary_key=True, nullable=False,
27-
default=uuid.uuid4)
28-
user_id = Column(UUID(as_uuid=True), ForeignKey(
29-
'users.id', ondelete='CASCADE'), nullable=False)
30-
title = Column(String, nullable=False)
31-
content = Column(String, nullable=False)
32-
category = Column(String, nullable=False)
33-
image = Column(String, nullable=False)
34-
created_at = Column(TIMESTAMP(timezone=True),
35-
nullable=False, server_default=text("now()"))
36-
updated_at = Column(TIMESTAMP(timezone=True),
37-
nullable=False, server_default=text("now()"))
38-
user = relationship('User')

app/routers/post.py

Lines changed: 0 additions & 68 deletions
This file was deleted.

app/schemas.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from datetime import datetime
2-
from typing import List
32
import uuid
43
from pydantic import BaseModel, EmailStr, constr
54

@@ -33,40 +32,3 @@ class UserResponse(UserBaseSchema):
3332

3433
class FilteredUserResponse(UserBaseSchema):
3534
pass
36-
37-
38-
class PostBaseSchema(BaseModel):
39-
title: str
40-
content: str
41-
category: str
42-
image: str
43-
user_id: uuid.UUID | None = None
44-
45-
class Config:
46-
orm_mode = True
47-
48-
49-
class CreatePostSchema(PostBaseSchema):
50-
pass
51-
52-
class UpdatePostSchema(BaseModel):
53-
title: str | None = None
54-
content: str | None = None
55-
category: str | None = None
56-
image: str | None = None
57-
58-
class Config:
59-
orm_mode = True
60-
61-
62-
class PostResponse(PostBaseSchema):
63-
id: uuid.UUID
64-
user: FilteredUserResponse
65-
created_at: datetime
66-
updated_at: datetime
67-
68-
69-
class ListPostResponse(BaseModel):
70-
status: str
71-
results: int
72-
posts: List[PostResponse]

0 commit comments

Comments
 (0)