36 lines
726 B
Python
36 lines
726 B
Python
# Python backend for a calender for my friend group.
|
|
# 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 database import fetch_all
|
|
from events.py import create_event
|
|
|
|
app = FastAPI(
|
|
title="Calendar API",
|
|
description="Room based agenda system",
|
|
version="0.1"
|
|
)
|
|
|
|
|
|
@app.get("/")
|
|
def home():
|
|
return {
|
|
"status": "online",
|
|
"service": "Calendar API"
|
|
}
|
|
|
|
|
|
@app.get("/database")
|
|
def database_status():
|
|
tables = fetch_all(
|
|
"SELECT name FROM sqlite_master WHERE type='table';"
|
|
)
|
|
|
|
return {
|
|
"tables": [table["name"] for table in tables]
|
|
}
|
|
|
|
@app.ge("/events")
|
|
def create_events():
|