updates on various files
This commit is contained in:
Binary file not shown.
Binary file not shown.
+1
-1
@@ -74,4 +74,4 @@ if __name__ == "__main__":
|
||||
for table in tables:
|
||||
print("-", table["name"])
|
||||
else:
|
||||
print("Geen tabellen gevonden.")
|
||||
print("Geen tabellen gevonden.")
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
from database import execute
|
||||
|
||||
def create_event(
|
||||
room_id,
|
||||
creator_id,
|
||||
event_type,
|
||||
title,
|
||||
description,
|
||||
start_time,
|
||||
end_time,
|
||||
visibility,
|
||||
status,
|
||||
min_people
|
||||
):
|
||||
query = """
|
||||
INSERT INTO events (
|
||||
room_id,
|
||||
creator_id,
|
||||
type,
|
||||
title,
|
||||
description,
|
||||
start_time,
|
||||
end_time,
|
||||
visibility,
|
||||
status,
|
||||
min_people
|
||||
)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
"""
|
||||
|
||||
event_id = execute(
|
||||
query,
|
||||
(
|
||||
room_id,
|
||||
creator_id,
|
||||
event_type,
|
||||
title,
|
||||
description,
|
||||
start_time,
|
||||
end_time,
|
||||
visibility,
|
||||
status,
|
||||
min_people
|
||||
)
|
||||
)
|
||||
|
||||
return event_id
|
||||
|
||||
|
||||
# voorbeeld create_event. alleen voor deocumentatie,
|
||||
# als je echt een event toe wil voegen, moet je data
|
||||
# uit de fastapi halen.
|
||||
#
|
||||
#
|
||||
# event = create_event(
|
||||
# room_id=2,
|
||||
# creator_id=3,
|
||||
# event_type="proposal",
|
||||
# title="Kaas eten",
|
||||
# description="We gaan met z'n allen kaas eten.",
|
||||
# start_time="2026-08-10 19:00",
|
||||
# end_time="2026-08-10 21:00",
|
||||
# visibility="room",
|
||||
# status="proposed",
|
||||
# min_people=4
|
||||
# )
|
||||
|
||||
# print("Nieuw event ID:", event)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
from fastapi import FastAPI
|
||||
from database import fetch_all
|
||||
from events.py import create_event
|
||||
|
||||
app = FastAPI(
|
||||
title="Calendar API",
|
||||
@@ -30,3 +31,5 @@ def database_status():
|
||||
"tables": [table["name"] for table in tables]
|
||||
}
|
||||
|
||||
@app.ge("/events")
|
||||
def create_events():
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
INSERT INTO users (username, password_hash)
|
||||
VALUES
|
||||
('ben', 'hash1'),
|
||||
('jan', 'hash2'),
|
||||
('piet', 'hash3');
|
||||
|
||||
|
||||
INSERT INTO rooms (name, owner_id, invite_code)
|
||||
VALUES
|
||||
('Vriendengroep', 1, 'ABC123'),
|
||||
('Projectgroep', 2, 'XYZ789');
|
||||
|
||||
|
||||
INSERT INTO room_members (room_id, user_id, role)
|
||||
VALUES
|
||||
(1, 1, 'owner'),
|
||||
(1, 2, 'member'),
|
||||
(1, 3, 'member'),
|
||||
(2, 2, 'owner');
|
||||
|
||||
|
||||
INSERT INTO events (
|
||||
room_id,
|
||||
creator_id,
|
||||
type,
|
||||
title,
|
||||
description,
|
||||
start_time,
|
||||
end_time,
|
||||
visibility,
|
||||
status,
|
||||
min_people
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
1,
|
||||
1,
|
||||
'proposal',
|
||||
'Bowlen',
|
||||
'Avondje bowlen',
|
||||
'2026-08-10 19:00',
|
||||
'2026-08-10 22:00',
|
||||
'room',
|
||||
'proposed',
|
||||
3
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO event_signups (event_id, user_id, status)
|
||||
VALUES
|
||||
(1, 1, 'going'),
|
||||
(1, 2, 'going');
|
||||
Reference in New Issue
Block a user