insert slop page endpoint

This commit is contained in:
Jack Case
2025-10-19 17:26:17 +00:00
parent b9a41fd294
commit f1c5204d4c
3 changed files with 43 additions and 6 deletions

View File

@@ -7,12 +7,12 @@
- get reports for given domains/pages
- post report
"""
import uvicorn
from fastapi import FastAPI
from sqlalchemy import create_engine
from slopserver.models import Domain, Path, User
from slopserver.models import SlopReport
from slopserver.db import select_slop
from slopserver.db import select_slop, insert_slop
app = FastAPI()
@@ -20,9 +20,12 @@ temp_engine = create_engine("postgresql+psycopg://slop-farmer@192.168.1.163/slop
@app.post("/report/")
async def report_slop(report: SlopReport):
pass
insert_slop(report.slop_urls, temp_engine)
@app.post("/check/")
async def check_slop(check: SlopReport):
slop_results = select_slop(check.slop_urls, temp_engine)
return slop_results
return slop_results
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)