mirror of
https://github.com/creyD/apilog.git
synced 2026-04-12 19:30:29 +02:00
Compare commits
1 Commits
fa196bd88a
...
1.4.1-reno
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26d7ffc4fa |
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -60,7 +60,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.13
|
||||
python-version: 3.12
|
||||
cache: 'pip' # caching pip dependencies
|
||||
- name: Setup tests (install dependencies, run migrations)
|
||||
run: |
|
||||
@@ -91,7 +91,7 @@ jobs:
|
||||
git config --local user.name "creyD"
|
||||
|
||||
- name: Git Version
|
||||
uses: codacy/git-version@2.8.7
|
||||
uses: codacy/git-version@2.8.0
|
||||
id: git_version
|
||||
with:
|
||||
minor-identifier: "feat:"
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
# apilog
|
||||
|
||||
Tiny logging API server, for taking logs via HTTP POST requests.
|
||||
|
||||
## TODO
|
||||
|
||||
[ ] Application Patch
|
||||
[ ] Team CRUD
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
from uuid import UUID
|
||||
|
||||
from creyPY.fastapi.crud import create_obj_from_data
|
||||
from creyPY.fastapi.crud import (
|
||||
create_obj_from_data,
|
||||
)
|
||||
from creyPY.fastapi.db.session import get_db
|
||||
from creyPY.fastapi.pagination import Page, paginate
|
||||
from fastapi import APIRouter, Depends, HTTPException, Security
|
||||
from pydantic.json_schema import SkipJsonSchema
|
||||
from sqlalchemy import select
|
||||
from fastapi import APIRouter, Depends, Security, HTTPException
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.models.app import Application
|
||||
from app.schema.app import AppIN, AppOUT
|
||||
from pydantic.json_schema import SkipJsonSchema
|
||||
from app.services.auth import verify
|
||||
from app.schema.app import AppIN, AppOUT
|
||||
from app.models.app import Application
|
||||
from creyPY.fastapi.pagination import Page
|
||||
from uuid import UUID
|
||||
from fastapi_pagination.ext.sqlalchemy import paginate
|
||||
from sqlalchemy import select
|
||||
|
||||
router = APIRouter(prefix="/app", tags=["apps"])
|
||||
|
||||
@@ -25,7 +26,7 @@ async def create_app(
|
||||
data,
|
||||
Application,
|
||||
db,
|
||||
additional_data={"created_by_id": sub},
|
||||
additonal_data={"created_by_id": sub},
|
||||
)
|
||||
return AppOUT.model_validate(obj)
|
||||
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
from datetime import datetime
|
||||
from typing import Callable
|
||||
from uuid import UUID
|
||||
|
||||
from creyPY.fastapi.crud import create_obj_from_data
|
||||
from creyPY.fastapi.db.session import get_db
|
||||
from creyPY.fastapi.crud import (
|
||||
create_obj_from_data,
|
||||
)
|
||||
from creyPY.fastapi.order_by import order_by
|
||||
from creyPY.fastapi.pagination import Page, paginate
|
||||
from fastapi import APIRouter, Depends, HTTPException, Security
|
||||
from typing import Callable
|
||||
from sqlalchemy.sql.selectable import Select
|
||||
from creyPY.fastapi.db.session import get_db
|
||||
from fastapi import APIRouter, Depends, Security, HTTPException
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy import select
|
||||
from app.services.auth import verify
|
||||
from app.schema.entry import LogIN, LogOUT
|
||||
from app.models.entry import LogEntry
|
||||
from fastapi_pagination.ext.sqlalchemy import paginate
|
||||
from creyPY.fastapi.pagination import Page
|
||||
from uuid import UUID
|
||||
from pydantic.json_schema import SkipJsonSchema
|
||||
from fastapi_filters import FilterValues, create_filters
|
||||
from fastapi_filters.ext.sqlalchemy import apply_filters
|
||||
from pydantic.json_schema import SkipJsonSchema
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy.sql.selectable import Select
|
||||
|
||||
from app.models.entry import LogEntry, LogType, TransactionType
|
||||
from app.schema.entry import LogIN, LogOUT
|
||||
from app.services.auth import verify
|
||||
from app.models.entry import LogType, TransactionType
|
||||
from datetime import datetime
|
||||
|
||||
router = APIRouter(prefix="/log", tags=["logging"])
|
||||
|
||||
@@ -31,7 +33,7 @@ async def create_log(
|
||||
data,
|
||||
LogEntry,
|
||||
db,
|
||||
additional_data={"created_by_id": sub},
|
||||
additonal_data={"created_by_id": sub},
|
||||
)
|
||||
return LogOUT.model_validate(obj)
|
||||
|
||||
|
||||
8
app/services/db/session.py
Normal file
8
app/services/db/session.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from sqlalchemy_utils import create_database, database_exists
|
||||
|
||||
|
||||
def create_if_not_exists(db_name: str):
|
||||
from creyPY.fastapi.db.session import SQLALCHEMY_DATABASE_URL
|
||||
|
||||
if not database_exists(SQLALCHEMY_DATABASE_URL + db_name):
|
||||
create_database(SQLALCHEMY_DATABASE_URL + db_name)
|
||||
@@ -2,7 +2,6 @@ import os
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
from creyPY.fastapi.db.helpers import create_if_not_exists
|
||||
from creyPY.fastapi.db.session import SQLALCHEMY_DATABASE_URL, get_db, name
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
@@ -10,6 +9,7 @@ from alembic import command
|
||||
from alembic.config import Config
|
||||
from app.models.app import Application
|
||||
from app.models.entry import LogEntry
|
||||
from app.services.db.session import create_if_not_exists
|
||||
|
||||
|
||||
def delete_old_logs(sess: Session | None = None):
|
||||
|
||||
@@ -3,21 +3,21 @@ x-restart-policy: &restart_policy
|
||||
restart: unless-stopped
|
||||
|
||||
services:
|
||||
apilog_worker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
<<: *restart_policy
|
||||
container_name: api_worker
|
||||
environment:
|
||||
- POSTGRES_HOST=apilog_db
|
||||
- POSTGRES_PORT=5432
|
||||
- POSTGRES_USER=root
|
||||
- POSTGRES_PASSWORD=password
|
||||
- POSTGRES_DB=apilog
|
||||
depends_on:
|
||||
apilog_db:
|
||||
condition: service_healthy
|
||||
# apilog_worker:
|
||||
# build:
|
||||
# context: .
|
||||
# dockerfile: Dockerfile
|
||||
# <<: *restart_policy
|
||||
# container_name: api_worker
|
||||
# environment:
|
||||
# - POSTGRES_HOST=apilog_db
|
||||
# - POSTGRES_PORT=5432
|
||||
# - POSTGRES_USER=root
|
||||
# - POSTGRES_PASSWORD=password
|
||||
# - POSTGRES_DB=apilog
|
||||
# depends_on:
|
||||
# apilog_db:
|
||||
# condition: service_healthy
|
||||
|
||||
apilog_db:
|
||||
image: postgres
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
annotated-types==0.7.0
|
||||
anyio==4.13.0
|
||||
certifi==2025.11.12
|
||||
creyPY[postgres]==3.0.0
|
||||
fastapi==0.135.2
|
||||
fastapi-pagination==0.15.12
|
||||
anyio==4.8.0
|
||||
certifi==2024.8.30
|
||||
creyPY==1.2.5
|
||||
fastapi==0.115.5
|
||||
fastapi-pagination==0.12.31
|
||||
h11==0.14.0
|
||||
httpcore==1.0.8
|
||||
httpcore==1.0.6
|
||||
httpx==0.28.1
|
||||
idna==3.11
|
||||
psycopg==3.3.3
|
||||
psycopg-binary==3.3.3
|
||||
psycopg-pool==3.3.0
|
||||
pydantic==2.12.5
|
||||
idna==3.10
|
||||
psycopg==3.2.4
|
||||
psycopg-binary==3.2.4
|
||||
psycopg-pool==3.2.3
|
||||
pydantic==2.9.2
|
||||
pydantic_core==2.23.4
|
||||
python-dotenv==1.2.2
|
||||
python-dotenv==1.0.1
|
||||
sniffio==1.3.1
|
||||
SQLAlchemy==2.0.48
|
||||
starlette==0.52.1
|
||||
typing_extensions==4.15.0
|
||||
SQLAlchemy==2.0.35
|
||||
starlette==0.40.0
|
||||
typing_extensions==4.12.2
|
||||
|
||||
Mako==1.3.10 # Alembic
|
||||
MarkupSafe==3.0.3 # Alembic
|
||||
alembic==1.18.4 # Alembic
|
||||
Mako==1.3.5 # Alembic
|
||||
MarkupSafe==3.0.1 # Alembic
|
||||
alembic==1.14.1 # Alembic
|
||||
|
||||
SQLAlchemy-Utils==0.41.2 # SQLAlchemy
|
||||
|
||||
click==8.3.2 # Uvicorn
|
||||
uvicorn==0.41.0 # Uvicorn
|
||||
click==8.1.8 # Uvicorn
|
||||
uvicorn==0.31.1 # Uvicorn
|
||||
|
||||
iniconfig==2.3.0 # pytest
|
||||
packaging==25.0 # pytest
|
||||
pluggy==1.6.0 # pytest
|
||||
pytest==8.4.2 # pytest
|
||||
iniconfig==2.0.0 # pytest
|
||||
packaging==24.1 # pytest
|
||||
pluggy==1.5.0 # pytest
|
||||
pytest==8.3.4 # pytest
|
||||
|
||||
fastapi-filters==0.3.3 # Filters
|
||||
fastapi-filters==0.2.9 # Filters
|
||||
|
||||
APScheduler==3.11.2 # Scheduler for deletion
|
||||
tzlocal==5.3.1 # Scheduler for deletion
|
||||
APScheduler==3.11.0 # Scheduler for deletion
|
||||
tzlocal==5.2 # Scheduler for deletion
|
||||
|
||||
Reference in New Issue
Block a user