Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
CedricCortenraede committed Jun 19, 2024
2 parents 1dcfe2f + bc1f241 commit 9444359
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/api/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

async def init_db(app: Litestar) -> None:
from models.base import Base

# Import models.
import models.country
import models.stream
Expand All @@ -43,7 +43,7 @@ async def init_db(app: Litestar) -> None:
import db.seeders.country_seeder
import db.seeders.stream_tag_seeder
import db.seeders.stream_seeder

async with app.state.db_engine.begin() as connection:
await connection.run_sync(Base.metadata.create_all)

Expand Down Expand Up @@ -118,12 +118,12 @@ def create_app_private() -> Litestar:

app = create_app()
app_private = create_app_private()


if __name__ == "__main__":
# Run the API (for debugging)
# uvicorn.run("main:app", reload=True, reload_dirs="./", port=8002)

subprocess.Popen(
[
"litestar",
Expand Down
2 changes: 1 addition & 1 deletion src/api/api/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class Base(DeclarativeBase):
pass
pass
8 changes: 4 additions & 4 deletions src/api/api/routers/v1/internal_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

class StreamRepository(SQLAlchemyAsyncRepository[Stream]):
model_type = Stream


async def provide_streams_repository(session: AsyncSession) -> StreamRepository:
return StreamRepository(session=session)

Expand All @@ -30,9 +30,9 @@ async def provide_streams_repository(session: AsyncSession) -> StreamRepository:
class internalStreamsController(Controller):
path = "/internal-streams"
tags = ["internal-streams"]

dependencies = {"streams_repository": Provide(provide_streams_repository)}

@get("/streams")
async def get_streams(self, stream_repository: StreamRepository) -> list[Stream]:
return await stream_repository.list()
Expand Down

0 comments on commit 9444359

Please sign in to comment.