# -*- coding: utf-8 -*-

from typing import List

from database import engine
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from models import Device, Project, Task, TaskWithProject
from sqlmodel import Session, SQLModel, select

# init fastapi
app: FastAPI = FastAPI()

# init CORS
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_methods=["*"])

# mount api endpoint
api: FastAPI = FastAPI(title="Scitizen")
app.mount("/api", api)


@app.on_event("startup")
def on_startup() -> None:
    """Setup event on app.

    It is used to create the database and the tables.
    """

    