Remove __pycache__ from repo

This commit is contained in:
d3m0k1d
2025-11-23 15:26:41 +03:00
parent e1b13d6557
commit fa982725e1
11 changed files with 48 additions and 8 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -5,11 +5,11 @@ import os
dotenv.load_dotenv()
PG_USER = dotenv.get_key(".env", "PG_USER")
PG_PASSWORD = dotenv.get_key(".env", "PG_PASSWORD")
PG_HOST = dotenv.get_key(".env", "PG_HOST")
PG_PORT = dotenv.get_key(".env", "PG_PORT")
PG_DB = dotenv.get_key(".env", "PG_DB")
PG_USER = dotenv.get_key(".env", "POSTGRES_USER")
PG_PASSWORD = dotenv.get_key(".env", "POSTGRES_PASSWORD")
PG_HOST = dotenv.get_key(".env", "POSTGRES_HOST")
PG_PORT = dotenv.get_key(".env", "POSTGRES_PORT")
PG_DB = dotenv.get_key(".env", "POSTGRES_DB")
DATABASE_URL = (
f"postgresql+asyncpg://{PG_USER}:{PG_PASSWORD}@{PG_HOST}:{PG_PORT}/{PG_DB}"
@@ -31,6 +31,7 @@ async_session_maker = async_sessionmaker(
class Base(DeclarativeBase):
pass
async def get_async_session():
async with async_session_maker() as session:
yield session
@@ -39,4 +40,3 @@ async def get_async_session():
async def init_db():
async with engine.begin() as conn:
await conn.run_sync(Base.metadata.create_all)

9
backend/app/init_db.py Normal file
View File

@@ -0,0 +1,9 @@
from app.db_engine import init_db
from app.models.posts import Post
if __name__ == "__main__":
import asyncio
asyncio.run(init_db())

View File

Binary file not shown.

View File

View File

View File

@@ -0,0 +1,30 @@
from pydantic import BaseModel, Field
from typing import Optional
class PostCreate(BaseModel):
title: str = Field(min_length=3, max_length=150)
content: str = Field(min_length=10)
images: Optional[str] = Field()
class Config:
orm_mode = True
class PostRead(BaseModel):
id: int = Field()
title: str = Field(min_length=3, max_length=150)
content: str = Field(min_length=10)
images: str = Field()
class Config:
orm_mode = True
class PostUpdate(BaseModel):
title: str = Field(min_length=3, max_length=150)
content: str = Field(min_length=10)
images: Optional[str] = Field()
class Config:
orm_mode = True

View File

@@ -1,6 +1,7 @@
services:
postgres:
image: postgres:18-alpine3.22
restart: always
ports:
- "5432:5432"
environment: