def tortoise_implementation(): [ os.remove(f"./db.sqlite3{s}") for s in ["", "-wal", "-shm"] if os.path.exists(f"./db.sqlite3{s}") ] app = FastAPI(on_shutdown=[on_shutdown]) Tortoise.init(config=TORTOISE_ORM) Tortoise.generate_schemas() router_settings = [ dict( schema=Potato, db_model=PotatoModel, prefix="potato", paginate=PAGINATION_SIZE, ), dict( schema=Carrot, db_model=CarrotModel, create_schema=CarrotCreate, update_schema=CarrotUpdate, prefix="carrot", tags=CUSTOM_TAGS, ), ] return app, TortoiseCRUDRouter, router_settings
def tortoise_implementation(): [ os.remove(f'./db.sqlite3{s}') for s in ['', '-wal', '-shm'] if os.path.exists(f'./db.sqlite3{s}') ] app = FastAPI(on_shutdown=[on_shutdown]) Tortoise.init(config=TORTOISE_ORM) Tortoise.generate_schemas() app.include_router( TortoiseCRUDRouter(schema=Potato, db_model=PotatoModel, prefix='potato', paginate=PAGINATION_SIZE)) app.include_router( TortoiseCRUDRouter(schema=Carrot, db_model=CarrotModel, create_schema=CarrotCreate, update_schema=CarrotUpdate, prefix='carrot')) return app