updates on various files

This commit is contained in:
ben
2026-08-03 08:45:30 +02:00
parent 344e35b823
commit d5fe16d624
7 changed files with 53 additions and 4 deletions
Binary file not shown.
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
curl -X POST http://127.0.0.1:8000/events -H "Content-Type: application/json" -d '{
"room_id": 1,
"creator_id": 2,
"event_type": "proposal",
"title": "Filmavond",
"description": "Samen een film kijken en snacks halen",
"start_time": "2026-08-15 20:00",
"end_time": "2026-08-15 23:00",
"visibility": "room",
"status": "proposed",
"min_people": 4
}'
+40 -4
View File
@@ -2,9 +2,9 @@
# We had the problem of never agreeing when or where
# we should meet up, and I hope this fixes the problem.
from fastapi import FastAPI
from fastapi import FastAPI, Request
from database import fetch_all
from events.py import create_event
from events import create_event
app = FastAPI(
title="Calendar API",
@@ -31,5 +31,41 @@ def database_status():
"tables": [table["name"] for table in tables]
}
@app.ge("/events")
def create_events():
@app.post("/events")
async def api_create_event(request: Request):
data = await request.json()
print(data)
event_id = create_event(
room_id=data["room_id"],
creator_id=data["creator_id"],
event_type=data["event_type"],
title=data["title"],
description=data["description"],
start_time=data["start_time"],
end_time=data["end_time"],
visibility=data["visibility"],
status=data["status"],
min_people=data["min_people"]
)
return {
"received": data
}
# def give_data():
# event = create_event(
# room_id=,
# creator_id=,
# event_type=,
# title=,
# description=,
# start_time=,
# end_time=,
# visibility=,
# status=,
# min_people=
# )
# print("Nieuw event ID:", event)
Binary file not shown.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
python3 -m uvicorn main:app --reload