piccolo 1.28.0__tar.gz → 1.29.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {piccolo-1.28.0 → piccolo-1.29.0}/PKG-INFO +1 -1
- piccolo-1.29.0/piccolo/__init__.py +1 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/new.py +1 -1
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_blacksheep_app.py.jinja +57 -29
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_esmerald_app.py.jinja +48 -21
- piccolo-1.29.0/piccolo/apps/asgi/commands/templates/app/_falcon_app.py.jinja +115 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_fastapi_app.py.jinja +51 -24
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_litestar_app.py.jinja +34 -10
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_quart_app.py.jinja +38 -15
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_sanic_app.py.jinja +34 -11
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/playground/commands/run.py +43 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/column_types.py +2 -2
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/table.py +14 -6
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/testing/model_builder.py +4 -2
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/testing/random_builder.py +12 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo.egg-info/PKG-INFO +1 -1
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/m2m/base.py +18 -47
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_metaclass.py +7 -3
- piccolo-1.29.0/tests/table/test_str.py +46 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_update.py +15 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/testing/test_random_builder.py +5 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/test_pydantic.py +116 -98
- piccolo-1.28.0/piccolo/__init__.py +0 -1
- piccolo-1.28.0/piccolo/apps/asgi/commands/templates/app/_falcon_app.py.jinja +0 -60
- piccolo-1.28.0/tests/table/test_str.py +0 -38
- {piccolo-1.28.0 → piccolo-1.29.0}/LICENSE +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/README.md +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/app/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/app/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/app/commands/new.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/app/commands/show_all.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/app/commands/templates/piccolo_app.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/app/commands/templates/tables.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/app/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/README.md.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_lilya_app.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_starlette_app.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/app.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/conftest.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/__init__.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/_blacksheep_endpoints.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/_esmerald_endpoints.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/_falcon_endpoints.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/_lilya_endpoints.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/_litestar_endpoints.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/_quart_endpoints.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/_sanic_endpoints.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/_starlette_endpoints.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/endpoints.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/piccolo_app.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/piccolo_migrations/README.md +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/tables.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/templates/base.html.jinja_raw +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/home/templates/home.html.jinja_raw +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/main.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/piccolo_conf.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/piccolo_conf_test.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/requirements.txt.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/static/favicon.ico +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/static/main.css +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/fixtures/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/fixtures/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/fixtures/commands/dump.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/fixtures/commands/load.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/fixtures/commands/shared.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/fixtures/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/meta/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/meta/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/meta/commands/version.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/meta/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/auto/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/auto/diffable_table.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/auto/migration_manager.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/auto/operations.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/auto/schema_differ.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/auto/schema_snapshot.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/auto/serialisation.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/auto/serialisation_legacy.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/commands/backwards.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/commands/base.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/commands/check.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/commands/clean.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/commands/forwards.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/commands/new.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/commands/templates/migration.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/migrations/tables.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/playground/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/playground/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/playground/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/project/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/project/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/project/commands/new.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/project/commands/templates/piccolo_conf.py.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/project/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/schema/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/schema/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/schema/commands/exceptions.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/schema/commands/generate.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/schema/commands/graph.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/schema/commands/templates/graphviz.dot.jinja +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/schema/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/shell/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/shell/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/shell/commands/run.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/shell/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/sql_shell/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/sql_shell/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/sql_shell/commands/run.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/sql_shell/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/tester/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/tester/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/tester/commands/run.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/tester/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/commands/change_password.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/commands/change_permissions.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/commands/create.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/commands/list.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/piccolo_migrations/2019-11-14T21-52-21.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/piccolo_migrations/2020-06-11T21-38-55.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/piccolo_migrations/2021-04-30T16-14-15.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/piccolo_migrations/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/user/tables.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/base.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/choices.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/combination.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/defaults/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/defaults/base.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/defaults/date.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/defaults/interval.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/defaults/time.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/defaults/timestamp.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/defaults/timestamptz.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/defaults/uuid.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/indexes.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/m2m.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/operators/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/operators/base.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/operators/comparison.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/operators/math.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/operators/string.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/readable.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/columns/reference.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/conf/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/conf/apps.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/custom_types.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/engine/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/engine/base.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/engine/cockroach.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/engine/exceptions.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/engine/finder.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/engine/postgres.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/engine/sqlite.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/main.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/py.typed +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/base.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/constraints.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/functions/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/functions/aggregate.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/functions/array.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/functions/base.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/functions/datetime.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/functions/math.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/functions/string.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/functions/type_conversion.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/alter.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/count.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/create.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/create_index.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/delete.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/drop_index.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/exists.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/indexes.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/insert.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/objects.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/raw.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/refresh.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/select.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/table_exists.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/methods/update.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/mixins.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/operators/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/operators/json.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/query/proxy.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/querystring.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/schema.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/table_reflection.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/testing/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/testing/test_case.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/dictionary.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/encoding.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/graphlib/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/graphlib/_graphlib.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/lazy_loader.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/list.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/naming.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/objects.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/printing.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/pydantic.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/repr.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/sql_values.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/sync.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo/utils/warnings.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo.egg-info/SOURCES.txt +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo.egg-info/dependency_links.txt +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo.egg-info/entry_points.txt +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo.egg-info/requires.txt +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/piccolo.egg-info/top_level.txt +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/profiling/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/profiling/run_profile.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/pyproject.toml +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/setup.cfg +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/setup.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/app/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/app/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/app/commands/test_new.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/app/commands/test_show_all.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/asgi/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/asgi/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/asgi/commands/test_new.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/fixtures/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/fixtures/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/fixtures/commands/test_dump_load.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/fixtures/commands/test_shared.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/meta/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/meta/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/meta/commands/test_version.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/auto/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/auto/integration/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/auto/integration/test_migrations.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/auto/test_diffable_table.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/auto/test_migration_manager.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/auto/test_schema_differ.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/auto/test_schema_snapshot.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/auto/test_serialisation.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/commands/test_base.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/commands/test_check.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/commands/test_clean.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/commands/test_forwards_backwards.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/commands/test_migrations/2020-03-31T20-38-22.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/commands/test_migrations/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/commands/test_new.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/migrations/test_migration.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/project/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/project/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/project/commands/test_new.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/schema/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/shell/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/shell/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/shell/commands/test_run.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/sql_shell/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/sql_shell/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/sql_shell/commands/test_run.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/tester/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/user/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/user/commands/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/user/commands/test_change_password.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/user/commands/test_change_permissions.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/user/commands/test_create.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/user/commands/test_list.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/apps/user/test_tables.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/m2m/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/m2m/test_m2m.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/m2m/test_m2m_schema.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_array.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_base.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_bigint.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_boolean.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_bytea.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_choices.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_combination.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_date.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_db_column_name.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_defaults.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_double_precision.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_get_sql_value.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_integer.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_interval.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_json.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_jsonb.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_numeric.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_primary_key.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_readable.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_real.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_reference.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_reserved_column_names.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_smallint.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_time.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_timestamp.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_timestamptz.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_uuid.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/columns/test_varchar.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/conf/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/conf/example.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/conf/test_apps.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/engine/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/engine/test_extra_nodes.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/engine/test_logging.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/engine/test_nested_transaction.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/engine/test_pool.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/engine/test_transaction.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/engine/test_version_parsing.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/example_apps/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/example_apps/mega/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/example_apps/mega/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/example_apps/mega/piccolo_migrations/2021-09-20T21-23-25-698988.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/example_apps/mega/piccolo_migrations/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/example_apps/mega/tables.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/example_apps/music/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/example_apps/music/piccolo_app.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/example_apps/music/tables.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/example_apps/music/tables_detailed.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/functions/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/functions/base.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/functions/test_datetime.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/functions/test_functions.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/functions/test_math.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/functions/test_string.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/functions/test_type_conversion.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/mixins/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/mixins/test_columns_delegate.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/mixins/test_order_by_delegate.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/operators/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/operators/test_json.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/test_await.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/test_camelcase.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/test_freeze.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/test_gather.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/test_querystring.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/query/test_slots.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/instance/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/instance/test_create.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/instance/test_get_related.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/instance/test_get_related_readable.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/instance/test_instantiate.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/instance/test_remove.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/instance/test_save.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/instance/test_to_dict.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_all_columns.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_alter.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_batch.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_callback.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_constructor.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_count.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_create.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_create_db_tables.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_create_table_class.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_delete.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_drop_db_tables.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_exists.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_from_dict.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_indexes.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_inheritance.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_insert.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_join.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_join_on.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_objects.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_output.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_raw.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_ref.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_refresh.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_repr.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_select.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_table_exists.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/table/test_update_self.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/test_main.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/test_schema.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/testing/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/testing/test_model_builder.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/testing/test_test_case.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/__init__.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/test_dictionary.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/test_encoding.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/test_lazy_loader.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/test_list.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/test_naming.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/test_printing.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/test_sql_values.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/test_sync.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/test_table_reflection.py +0 -0
- {piccolo-1.28.0 → piccolo-1.29.0}/tests/utils/test_warnings.py +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
__VERSION__ = "1.29.0"
|
@@ -12,7 +12,7 @@ SERVERS = ["uvicorn", "Hypercorn", "granian"]
|
|
12
12
|
ROUTER_DEPENDENCIES = {
|
13
13
|
"starlette": ["starlette"],
|
14
14
|
"fastapi": ["fastapi"],
|
15
|
-
"blacksheep": ["blacksheep"],
|
15
|
+
"blacksheep": ["blacksheep[full]"],
|
16
16
|
"litestar": ["litestar"],
|
17
17
|
"esmerald": ["esmerald"],
|
18
18
|
"lilya": ["lilya"],
|
{piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_blacksheep_app.py.jinja
RENAMED
@@ -1,10 +1,9 @@
|
|
1
|
-
|
1
|
+
from typing import Any
|
2
2
|
|
3
|
+
from blacksheep.exceptions import HTTPException
|
3
4
|
from blacksheep.server import Application
|
4
5
|
from blacksheep.server.bindings import FromJSON
|
5
|
-
from blacksheep.server.openapi.v3 import OpenAPIHandler
|
6
|
-
from blacksheep.server.responses import json
|
7
|
-
from openapidocs.v3 import Info
|
6
|
+
from blacksheep.server.openapi.v3 import OpenAPIHandler, Info
|
8
7
|
from piccolo.engine import engine_finder
|
9
8
|
from piccolo_admin.endpoints import create_admin
|
10
9
|
from piccolo_api.crud.serializers import create_pydantic_model
|
@@ -34,38 +33,67 @@ app.serve_files("static", root_path="/static")
|
|
34
33
|
app.router.add_get("/", home)
|
35
34
|
|
36
35
|
|
37
|
-
TaskModelIn:
|
38
|
-
|
39
|
-
|
36
|
+
TaskModelIn: Any = create_pydantic_model(
|
37
|
+
table=Task,
|
38
|
+
model_name="TaskModelIn",
|
40
39
|
)
|
41
|
-
|
42
|
-
table=Task,
|
40
|
+
TaskModelOut: Any = create_pydantic_model(
|
41
|
+
table=Task,
|
42
|
+
include_default_columns=True,
|
43
|
+
model_name="TaskModelOut",
|
43
44
|
)
|
45
|
+
TaskModelPartial: Any = (
|
46
|
+
create_pydantic_model(
|
47
|
+
table=Task,
|
48
|
+
model_name="TaskModelPartial",
|
49
|
+
all_optional=True,
|
50
|
+
),
|
51
|
+
)
|
52
|
+
|
53
|
+
|
54
|
+
# Check if the record is None. Use for query callback
|
55
|
+
def check_record_not_found(result: dict[str, Any]) -> dict[str, Any]:
|
56
|
+
if result is None:
|
57
|
+
raise HTTPException(status=404)
|
58
|
+
return result
|
44
59
|
|
45
60
|
|
46
61
|
@app.router.get("/tasks/")
|
47
|
-
async def tasks() ->
|
48
|
-
|
62
|
+
async def tasks() -> list[TaskModelOut]:
|
63
|
+
tasks = await Task.select().order_by(Task._meta.primary_key, ascending=False)
|
64
|
+
return [TaskModelOut(**task) for task in tasks]
|
65
|
+
|
66
|
+
|
67
|
+
@app.router.get("/tasks/{task_id}/")
|
68
|
+
async def single_task(task_id: int) -> TaskModelOut:
|
69
|
+
task = (
|
70
|
+
await Task.select()
|
71
|
+
.where(Task._meta.primary_key == task_id)
|
72
|
+
.first()
|
73
|
+
.callback(check_record_not_found)
|
74
|
+
)
|
75
|
+
return TaskModelOut(**task)
|
49
76
|
|
50
77
|
|
51
78
|
@app.router.post("/tasks/")
|
52
79
|
async def create_task(task_model: FromJSON[TaskModelIn]) -> TaskModelOut:
|
53
|
-
task = Task(**task_model.value.
|
80
|
+
task = Task(**task_model.value.model_dump())
|
54
81
|
await task.save()
|
55
82
|
return TaskModelOut(**task.to_dict())
|
56
83
|
|
57
84
|
|
58
85
|
@app.router.put("/tasks/{task_id}/")
|
59
86
|
async def put_task(task_id: int, task_model: FromJSON[TaskModelIn]) -> TaskModelOut:
|
60
|
-
task =
|
61
|
-
|
62
|
-
|
87
|
+
task = (
|
88
|
+
await Task.objects()
|
89
|
+
.get(Task._meta.primary_key == task_id)
|
90
|
+
.callback(check_record_not_found)
|
91
|
+
)
|
63
92
|
|
64
|
-
for key, value in task_model.value.
|
93
|
+
for key, value in task_model.value.model_dump().items():
|
65
94
|
setattr(task, key, value)
|
66
95
|
|
67
96
|
await task.save()
|
68
|
-
|
69
97
|
return TaskModelOut(**task.to_dict())
|
70
98
|
|
71
99
|
|
@@ -73,29 +101,29 @@ async def put_task(task_id: int, task_model: FromJSON[TaskModelIn]) -> TaskModel
|
|
73
101
|
async def patch_task(
|
74
102
|
task_id: int, task_model: FromJSON[TaskModelPartial]
|
75
103
|
) -> TaskModelOut:
|
76
|
-
task =
|
77
|
-
|
78
|
-
|
104
|
+
task = (
|
105
|
+
await Task.objects()
|
106
|
+
.get(Task._meta.primary_key == task_id)
|
107
|
+
.callback(check_record_not_found)
|
108
|
+
)
|
79
109
|
|
80
|
-
for key, value in task_model.value.
|
110
|
+
for key, value in task_model.value.model_dump().items():
|
81
111
|
if value is not None:
|
82
112
|
setattr(task, key, value)
|
83
113
|
|
84
114
|
await task.save()
|
85
|
-
|
86
115
|
return TaskModelOut(**task.to_dict())
|
87
116
|
|
88
117
|
|
89
118
|
@app.router.delete("/tasks/{task_id}/")
|
90
|
-
async def delete_task(task_id: int):
|
91
|
-
task =
|
92
|
-
|
93
|
-
|
94
|
-
|
119
|
+
async def delete_task(task_id: int) -> None:
|
120
|
+
task = (
|
121
|
+
await Task.objects()
|
122
|
+
.get(Task._meta.primary_key == task_id)
|
123
|
+
.callback(check_record_not_found)
|
124
|
+
)
|
95
125
|
await task.remove()
|
96
126
|
|
97
|
-
return json({})
|
98
|
-
|
99
127
|
|
100
128
|
async def open_database_connection_pool(application):
|
101
129
|
try:
|
{piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_esmerald_app.py.jinja
RENAMED
@@ -1,12 +1,12 @@
|
|
1
|
-
|
1
|
+
from typing import Any
|
2
2
|
from pathlib import Path
|
3
3
|
|
4
4
|
from esmerald import (
|
5
5
|
APIView,
|
6
6
|
Esmerald,
|
7
7
|
Gateway,
|
8
|
+
HTTPException,
|
8
9
|
Include,
|
9
|
-
JSONResponse,
|
10
10
|
delete,
|
11
11
|
get,
|
12
12
|
post,
|
@@ -38,45 +38,72 @@ async def close_database_connection_pool():
|
|
38
38
|
print("Unable to connect to the database")
|
39
39
|
|
40
40
|
|
41
|
-
TaskModelIn:
|
42
|
-
|
43
|
-
|
41
|
+
TaskModelIn: Any = create_pydantic_model(
|
42
|
+
table=Task,
|
43
|
+
model_name="TaskModelIn",
|
44
44
|
)
|
45
|
+
TaskModelOut: Any = create_pydantic_model(
|
46
|
+
table=Task,
|
47
|
+
include_default_columns=True,
|
48
|
+
model_name="TaskModelOut",
|
49
|
+
)
|
50
|
+
|
51
|
+
|
52
|
+
# Check if the record is None. Use for query callback
|
53
|
+
def check_record_not_found(result: dict[str, Any]) -> dict[str, Any]:
|
54
|
+
if result is None:
|
55
|
+
raise HTTPException(
|
56
|
+
detail="Record not found",
|
57
|
+
status_code=404,
|
58
|
+
)
|
59
|
+
return result
|
45
60
|
|
46
61
|
|
47
62
|
class TaskAPIView(APIView):
|
48
63
|
path: str = "/"
|
49
|
-
tags: str = ["Task"]
|
64
|
+
tags: list[str] = ["Task"]
|
50
65
|
|
51
66
|
@get("/")
|
52
|
-
async def tasks(self) ->
|
53
|
-
|
67
|
+
async def tasks(self) -> list[TaskModelOut]:
|
68
|
+
tasks = await Task.select().order_by(Task._meta.primary_key, ascending=False)
|
69
|
+
return [TaskModelOut(**task) for task in tasks]
|
70
|
+
|
71
|
+
@get("/{task_id}")
|
72
|
+
async def single_task(self, task_id: int) -> TaskModelOut:
|
73
|
+
task = (
|
74
|
+
await Task.select()
|
75
|
+
.where(Task._meta.primary_key == task_id)
|
76
|
+
.first()
|
77
|
+
.callback(check_record_not_found)
|
78
|
+
)
|
79
|
+
return TaskModelOut(**task)
|
54
80
|
|
55
81
|
@post("/")
|
56
82
|
async def create_task(self, payload: TaskModelIn) -> TaskModelOut:
|
57
|
-
task = Task(**payload.
|
83
|
+
task = Task(**payload.model_dump())
|
58
84
|
await task.save()
|
59
|
-
return task.to_dict()
|
85
|
+
return TaskModelOut(**task.to_dict())
|
60
86
|
|
61
87
|
@put("/{task_id}")
|
62
88
|
async def update_task(self, payload: TaskModelIn, task_id: int) -> TaskModelOut:
|
63
|
-
task =
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
89
|
+
task = (
|
90
|
+
await Task.objects()
|
91
|
+
.get(Task._meta.primary_key == task_id)
|
92
|
+
.callback(check_record_not_found)
|
93
|
+
)
|
94
|
+
for key, value in payload.model_dump().items():
|
68
95
|
setattr(task, key, value)
|
69
96
|
|
70
97
|
await task.save()
|
71
|
-
|
72
|
-
return task.to_dict()
|
98
|
+
return TaskModelOut(**task.to_dict())
|
73
99
|
|
74
100
|
@delete("/{task_id}")
|
75
101
|
async def delete_task(self, task_id: int) -> None:
|
76
|
-
task =
|
77
|
-
|
78
|
-
|
79
|
-
|
102
|
+
task = (
|
103
|
+
await Task.objects()
|
104
|
+
.get(Task._meta.primary_key == task_id)
|
105
|
+
.callback(check_record_not_found)
|
106
|
+
)
|
80
107
|
await task.remove()
|
81
108
|
|
82
109
|
|
@@ -0,0 +1,115 @@
|
|
1
|
+
import os
|
2
|
+
from typing import Any
|
3
|
+
|
4
|
+
import falcon.asgi
|
5
|
+
from hypercorn.middleware import DispatcherMiddleware
|
6
|
+
from piccolo.engine import engine_finder
|
7
|
+
from piccolo_admin.endpoints import create_admin
|
8
|
+
|
9
|
+
from home.endpoints import HomeEndpoint
|
10
|
+
from home.piccolo_app import APP_CONFIG
|
11
|
+
from home.tables import Task
|
12
|
+
|
13
|
+
|
14
|
+
async def open_database_connection_pool():
|
15
|
+
try:
|
16
|
+
engine = engine_finder()
|
17
|
+
await engine.start_connection_pool()
|
18
|
+
except Exception:
|
19
|
+
print("Unable to connect to the database")
|
20
|
+
|
21
|
+
|
22
|
+
async def close_database_connection_pool():
|
23
|
+
try:
|
24
|
+
engine = engine_finder()
|
25
|
+
await engine.close_connection_pool()
|
26
|
+
except Exception:
|
27
|
+
print("Unable to connect to the database")
|
28
|
+
|
29
|
+
|
30
|
+
# Check if the record is None. Use for query callback
|
31
|
+
def check_record_not_found(result: dict[str, Any]) -> dict[str, Any]:
|
32
|
+
if result is None:
|
33
|
+
raise falcon.HTTPNotFound()
|
34
|
+
return result
|
35
|
+
|
36
|
+
|
37
|
+
class LifespanMiddleware:
|
38
|
+
async def process_startup(
|
39
|
+
self, scope: dict[str, Any], event: dict[str, Any]
|
40
|
+
) -> None:
|
41
|
+
await open_database_connection_pool()
|
42
|
+
|
43
|
+
async def process_shutdown(
|
44
|
+
self, scope: dict[str, Any], event: dict[str, Any]
|
45
|
+
) -> None:
|
46
|
+
await close_database_connection_pool()
|
47
|
+
|
48
|
+
|
49
|
+
class TaskCollectionResource:
|
50
|
+
async def on_get(self, req, resp):
|
51
|
+
tasks = await Task.select().order_by(Task._meta.primary_key, ascending=False)
|
52
|
+
resp.media = tasks
|
53
|
+
|
54
|
+
async def on_post(self, req, resp):
|
55
|
+
data = await req.media
|
56
|
+
task = Task(**data)
|
57
|
+
await task.save()
|
58
|
+
resp.status = falcon.HTTP_201
|
59
|
+
resp.media = task.to_dict()
|
60
|
+
|
61
|
+
|
62
|
+
class TaskItemResource:
|
63
|
+
async def on_get(self, req, resp, task_id):
|
64
|
+
task = (
|
65
|
+
await Task.select()
|
66
|
+
.where(Task._meta.primary_key == task_id)
|
67
|
+
.first()
|
68
|
+
.callback(check_record_not_found)
|
69
|
+
)
|
70
|
+
resp.status = falcon.HTTP_200
|
71
|
+
resp.media = task
|
72
|
+
|
73
|
+
async def on_put(self, req, resp, task_id):
|
74
|
+
task = (
|
75
|
+
await Task.objects()
|
76
|
+
.get(Task._meta.primary_key == task_id)
|
77
|
+
.callback(check_record_not_found)
|
78
|
+
)
|
79
|
+
|
80
|
+
data = await req.media
|
81
|
+
for key, value in data.items():
|
82
|
+
setattr(task, key, value)
|
83
|
+
|
84
|
+
await task.save()
|
85
|
+
resp.status = falcon.HTTP_200
|
86
|
+
resp.media = task.to_dict()
|
87
|
+
|
88
|
+
async def on_delete(self, req, resp, task_id):
|
89
|
+
task = (
|
90
|
+
await Task.objects()
|
91
|
+
.get(Task._meta.primary_key == task_id)
|
92
|
+
.callback(check_record_not_found)
|
93
|
+
)
|
94
|
+
resp.status = falcon.HTTP_204
|
95
|
+
await task.remove()
|
96
|
+
|
97
|
+
|
98
|
+
app: Any = falcon.asgi.App(middleware=LifespanMiddleware())
|
99
|
+
app.add_static_route("/static", directory=os.path.abspath("static"))
|
100
|
+
app.add_route("/", HomeEndpoint())
|
101
|
+
app.add_route("/tasks/", TaskCollectionResource())
|
102
|
+
app.add_route("/tasks/{task_id:int}", TaskItemResource())
|
103
|
+
|
104
|
+
|
105
|
+
# enable the admin application using DispatcherMiddleware
|
106
|
+
app = DispatcherMiddleware( # type: ignore
|
107
|
+
{
|
108
|
+
"/admin": create_admin(
|
109
|
+
tables=APP_CONFIG.table_classes,
|
110
|
+
# Required when running under HTTPS:
|
111
|
+
# allowed_hosts=['my_site.com']
|
112
|
+
),
|
113
|
+
"": app,
|
114
|
+
}
|
115
|
+
)
|
{piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_fastapi_app.py.jinja
RENAMED
@@ -1,8 +1,8 @@
|
|
1
|
-
import typing as t
|
2
1
|
from contextlib import asynccontextmanager
|
2
|
+
from typing import Any
|
3
3
|
|
4
|
-
from fastapi import FastAPI
|
5
|
-
from fastapi.
|
4
|
+
from fastapi import FastAPI, status
|
5
|
+
from fastapi.exceptions import HTTPException
|
6
6
|
from piccolo.engine import engine_finder
|
7
7
|
from piccolo_admin.endpoints import create_admin
|
8
8
|
from piccolo_api.crud.serializers import create_pydantic_model
|
@@ -54,47 +54,74 @@ app = FastAPI(
|
|
54
54
|
)
|
55
55
|
|
56
56
|
|
57
|
-
TaskModelIn:
|
57
|
+
TaskModelIn: Any = create_pydantic_model(
|
58
58
|
table=Task,
|
59
59
|
model_name="TaskModelIn",
|
60
60
|
)
|
61
|
-
|
62
|
-
|
61
|
+
|
62
|
+
TaskModelOut: Any = create_pydantic_model(
|
63
|
+
table=Task,
|
64
|
+
include_default_columns=True,
|
65
|
+
model_name="TaskModelOut",
|
63
66
|
)
|
64
67
|
|
65
68
|
|
66
|
-
|
69
|
+
# Check if the record is None. Use for query callback
|
70
|
+
def check_record_not_found(result: dict[str, Any]) -> dict[str, Any]:
|
71
|
+
if result is None:
|
72
|
+
raise HTTPException(
|
73
|
+
detail="Record not found",
|
74
|
+
status_code=status.HTTP_404_NOT_FOUND,
|
75
|
+
)
|
76
|
+
return result
|
77
|
+
|
78
|
+
|
79
|
+
@app.get("/tasks/", response_model=list[TaskModelOut], tags=["Task"])
|
67
80
|
async def tasks():
|
68
|
-
return await Task.select().order_by(Task.
|
81
|
+
return await Task.select().order_by(Task._meta.primary_key, ascending=False)
|
82
|
+
|
83
|
+
|
84
|
+
@app.get("/tasks/{task_id}/", response_model=TaskModelOut, tags=["Task"])
|
85
|
+
async def single_task(task_id: int):
|
86
|
+
task = (
|
87
|
+
await Task.select()
|
88
|
+
.where(Task._meta.primary_key == task_id)
|
89
|
+
.first()
|
90
|
+
.callback(check_record_not_found)
|
91
|
+
)
|
92
|
+
return task
|
69
93
|
|
70
94
|
|
71
|
-
@app.post("/tasks/", response_model=TaskModelOut)
|
95
|
+
@app.post("/tasks/", response_model=TaskModelOut, tags=["Task"])
|
72
96
|
async def create_task(task_model: TaskModelIn):
|
73
|
-
task = Task(**task_model.
|
97
|
+
task = Task(**task_model.model_dump())
|
74
98
|
await task.save()
|
75
99
|
return task.to_dict()
|
76
100
|
|
77
101
|
|
78
|
-
@app.put("/tasks/{task_id}/", response_model=TaskModelOut)
|
102
|
+
@app.put("/tasks/{task_id}/", response_model=TaskModelOut, tags=["Task"])
|
79
103
|
async def update_task(task_id: int, task_model: TaskModelIn):
|
80
|
-
task =
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
104
|
+
task = (
|
105
|
+
await Task.objects()
|
106
|
+
.get(Task._meta.primary_key == task_id)
|
107
|
+
.callback(check_record_not_found)
|
108
|
+
)
|
109
|
+
for key, value in task_model.model_dump().items():
|
85
110
|
setattr(task, key, value)
|
86
111
|
|
87
112
|
await task.save()
|
88
|
-
|
89
113
|
return task.to_dict()
|
90
114
|
|
91
115
|
|
92
|
-
@app.delete(
|
116
|
+
@app.delete(
|
117
|
+
"/tasks/{task_id}/",
|
118
|
+
status_code=status.HTTP_204_NO_CONTENT,
|
119
|
+
tags=["Task"],
|
120
|
+
)
|
93
121
|
async def delete_task(task_id: int):
|
94
|
-
task =
|
95
|
-
|
96
|
-
|
97
|
-
|
122
|
+
task = (
|
123
|
+
await Task.objects()
|
124
|
+
.get(Task._meta.primary_key == task_id)
|
125
|
+
.callback(check_record_not_found)
|
126
|
+
)
|
98
127
|
await task.remove()
|
99
|
-
|
100
|
-
return JSONResponse({})
|
{piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_litestar_app.py.jinja
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
from typing import Any
|
2
2
|
|
3
3
|
from litestar import Litestar, asgi, delete, get, patch, post
|
4
4
|
from litestar.contrib.jinja import JinjaTemplateEngine
|
@@ -21,11 +21,11 @@ you can use `create_pydantic_model` as in other asgi templates
|
|
21
21
|
|
22
22
|
from piccolo.utils.pydantic import create_pydantic_model
|
23
23
|
|
24
|
-
TaskModelIn:
|
24
|
+
TaskModelIn: Any = create_pydantic_model(
|
25
25
|
table=Task,
|
26
26
|
model_name="TaskModelIn",
|
27
27
|
)
|
28
|
-
TaskModelOut:
|
28
|
+
TaskModelOut: Any = create_pydantic_model(
|
29
29
|
table=Task,
|
30
30
|
include_default_columns=True,
|
31
31
|
model_name="TaskModelOut",
|
@@ -50,12 +50,30 @@ async def admin(scope: "Scope", receive: "Receive", send: "Send") -> None:
|
|
50
50
|
await create_admin(tables=APP_CONFIG.table_classes)(scope, receive, send)
|
51
51
|
|
52
52
|
|
53
|
+
# Check if the record is None. Use for query callback
|
54
|
+
def check_record_not_found(result: dict[str, Any]) -> dict[str, Any]:
|
55
|
+
if result is None:
|
56
|
+
raise NotFoundException(detail="Record not found")
|
57
|
+
return result
|
58
|
+
|
59
|
+
|
53
60
|
@get("/tasks", tags=["Task"])
|
54
|
-
async def tasks() ->
|
61
|
+
async def tasks() -> list[TaskModelOut]:
|
55
62
|
tasks = await Task.select().order_by(Task._meta.primary_key, ascending=False)
|
56
63
|
return [TaskModelOut(**task) for task in tasks]
|
57
64
|
|
58
65
|
|
66
|
+
@get("/tasks/{task_id:int}", tags=["Task"])
|
67
|
+
async def single_task(task_id: int) -> TaskModelOut:
|
68
|
+
task = (
|
69
|
+
await Task.select()
|
70
|
+
.where(Task._meta.primary_key == task_id)
|
71
|
+
.first()
|
72
|
+
.callback(check_record_not_found)
|
73
|
+
)
|
74
|
+
return TaskModelOut(**task)
|
75
|
+
|
76
|
+
|
59
77
|
@post("/tasks", tags=["Task"])
|
60
78
|
async def create_task(data: TaskModelIn) -> TaskModelOut:
|
61
79
|
task = Task(**data.model_dump())
|
@@ -65,9 +83,12 @@ async def create_task(data: TaskModelIn) -> TaskModelOut:
|
|
65
83
|
|
66
84
|
@patch("/tasks/{task_id:int}", tags=["Task"])
|
67
85
|
async def update_task(task_id: int, data: TaskModelIn) -> TaskModelOut:
|
68
|
-
task =
|
69
|
-
|
70
|
-
|
86
|
+
task = (
|
87
|
+
await Task.objects()
|
88
|
+
.get(Task._meta.primary_key == task_id)
|
89
|
+
.callback(check_record_not_found)
|
90
|
+
)
|
91
|
+
|
71
92
|
for key, value in data.model_dump().items():
|
72
93
|
setattr(task, key, value)
|
73
94
|
|
@@ -77,9 +98,11 @@ async def update_task(task_id: int, data: TaskModelIn) -> TaskModelOut:
|
|
77
98
|
|
78
99
|
@delete("/tasks/{task_id:int}", tags=["Task"])
|
79
100
|
async def delete_task(task_id: int) -> None:
|
80
|
-
task =
|
81
|
-
|
82
|
-
|
101
|
+
task = (
|
102
|
+
await Task.objects()
|
103
|
+
.get(Task._meta.primary_key == task_id)
|
104
|
+
.callback(check_record_not_found)
|
105
|
+
)
|
83
106
|
await task.remove()
|
84
107
|
|
85
108
|
|
@@ -104,6 +127,7 @@ app = Litestar(
|
|
104
127
|
admin,
|
105
128
|
home,
|
106
129
|
tasks,
|
130
|
+
single_task,
|
107
131
|
create_task,
|
108
132
|
update_task,
|
109
133
|
delete_task,
|
{piccolo-1.28.0 → piccolo-1.29.0}/piccolo/apps/asgi/commands/templates/app/_quart_app.py.jinja
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
from typing import Any
|
2
2
|
from http import HTTPStatus
|
3
3
|
|
4
4
|
from hypercorn.middleware import DispatcherMiddleware
|
@@ -6,6 +6,7 @@ from piccolo.engine import engine_finder
|
|
6
6
|
from piccolo_admin.endpoints import create_admin
|
7
7
|
from piccolo_api.crud.serializers import create_pydantic_model
|
8
8
|
from quart import Quart
|
9
|
+
from quart.helpers import abort
|
9
10
|
from quart_schema import (
|
10
11
|
Info,
|
11
12
|
QuartSchema,
|
@@ -24,17 +25,24 @@ app = Quart(__name__, static_folder="static")
|
|
24
25
|
QuartSchema(app, info=Info(title="Quart API", version="0.1.0"))
|
25
26
|
|
26
27
|
|
27
|
-
TaskModelIn:
|
28
|
+
TaskModelIn: Any = create_pydantic_model(
|
28
29
|
table=Task,
|
29
30
|
model_name="TaskModelIn",
|
30
31
|
)
|
31
|
-
TaskModelOut:
|
32
|
+
TaskModelOut: Any = create_pydantic_model(
|
32
33
|
table=Task,
|
33
34
|
include_default_columns=True,
|
34
35
|
model_name="TaskModelOut",
|
35
36
|
)
|
36
37
|
|
37
38
|
|
39
|
+
# Check if the record is None. Use for query callback
|
40
|
+
def check_record_not_found(result: dict[str, Any]) -> dict[str, Any]:
|
41
|
+
if result is None:
|
42
|
+
abort(code=HTTPStatus.NOT_FOUND)
|
43
|
+
return result
|
44
|
+
|
45
|
+
|
38
46
|
@app.get("/")
|
39
47
|
@hide
|
40
48
|
def home():
|
@@ -42,10 +50,24 @@ def home():
|
|
42
50
|
|
43
51
|
|
44
52
|
@app.get("/tasks/")
|
45
|
-
@validate_response(
|
53
|
+
@validate_response(list[TaskModelOut])
|
46
54
|
@tag(["Task"])
|
47
55
|
async def tasks():
|
48
|
-
|
56
|
+
tasks = await Task.select().order_by(Task._meta.primary_key, ascending=False)
|
57
|
+
return [TaskModelOut(**task) for task in tasks], HTTPStatus.OK
|
58
|
+
|
59
|
+
|
60
|
+
@app.get("/tasks/<int:task_id>/")
|
61
|
+
@validate_response(TaskModelOut)
|
62
|
+
@tag(["Task"])
|
63
|
+
async def single_task(task_id: int):
|
64
|
+
task = (
|
65
|
+
await Task.select()
|
66
|
+
.where(Task._meta.primary_key == task_id)
|
67
|
+
.first()
|
68
|
+
.callback(check_record_not_found)
|
69
|
+
)
|
70
|
+
return TaskModelOut(**task), HTTPStatus.OK
|
49
71
|
|
50
72
|
|
51
73
|
@app.post("/tasks/")
|
@@ -63,28 +85,29 @@ async def create_task(data: TaskModelIn):
|
|
63
85
|
@validate_response(TaskModelOut)
|
64
86
|
@tag(["Task"])
|
65
87
|
async def update_task(task_id: int, data: TaskModelIn):
|
66
|
-
task =
|
67
|
-
|
68
|
-
|
88
|
+
task = (
|
89
|
+
await Task.objects()
|
90
|
+
.get(Task._meta.primary_key == task_id)
|
91
|
+
.callback(check_record_not_found)
|
92
|
+
)
|
69
93
|
|
70
94
|
for key, value in data.model_dump().items():
|
71
95
|
setattr(task, key, value)
|
72
96
|
|
73
97
|
await task.save()
|
74
98
|
|
75
|
-
return task.to_dict(), HTTPStatus.OK
|
99
|
+
return TaskModelOut(**task.to_dict()), HTTPStatus.OK
|
76
100
|
|
77
101
|
|
78
102
|
@app.delete("/tasks/<int:task_id>/")
|
79
|
-
@validate_response(TaskModelOut)
|
80
103
|
@tag(["Task"])
|
81
104
|
async def delete_task(task_id: int):
|
82
|
-
task =
|
83
|
-
|
84
|
-
|
85
|
-
|
105
|
+
task = (
|
106
|
+
await Task.objects()
|
107
|
+
.get(Task._meta.primary_key == task_id)
|
108
|
+
.callback(check_record_not_found)
|
109
|
+
)
|
86
110
|
await task.remove()
|
87
|
-
|
88
111
|
return {}, HTTPStatus.OK
|
89
112
|
|
90
113
|
|