zrb 1.0.0b1__py3-none-any.whl → 1.0.0b2__py3-none-any.whl
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.
- zrb/__main__.py +0 -3
- zrb/builtin/__init__.py +3 -0
- zrb/builtin/group.py +1 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/config.py +1 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_task.py +66 -21
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/add_entity_util.py +67 -41
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module/service/my_entity/my_entity_service.py +69 -15
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module/service/my_entity/my_entity_service_factory.py +2 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module/service/my_entity/repository/my_entity_db_repository.py +0 -10
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module/service/my_entity/repository/my_entity_repository.py +37 -16
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/module/my_module/service/my_entity/repository/my_entity_repository_factory.py +2 -2
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/app_template/schema/my_entity.py +16 -6
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/client_method.py +57 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/gateway_subroute.py +63 -28
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/add_module_task.py +1 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/my_module_api_client.py +6 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/{any_client.py → my_module_client.py} +1 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/my_module_client_factory.py +11 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/my_module_direct_client.py +5 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/route.py +1 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/module_task_definition.py +2 -2
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/task.py +4 -4
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/util.py +47 -20
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/app_factory.py +29 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/base_db_repository.py +185 -101
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/base_service.py +99 -108
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/{db_engine.py → db_engine_factory.py} +1 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/error.py +12 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/logger_factory.py +10 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/parser_factory.py +7 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/util/app.py +47 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/util/parser.py +105 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/util/user_agent.py +58 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/config.py +1 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/main.py +1 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/auth_api_client.py +16 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/auth_client.py +163 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/auth_client_factory.py +9 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/auth_direct_client.py +15 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration/versions/3093c7336477_add_auth_tables.py +160 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration_metadata.py +18 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/route.py +5 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/permission/__init__.py +0 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/permission/permission_service.py +117 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/permission/permission_service_factory.py +11 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/permission/repository/permission_db_repository.py +26 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/permission/repository/permission_repository.py +61 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/permission/repository/permission_repository_factory.py +13 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/role/__init__.py +0 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/role/repository/role_db_repository.py +75 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/role/repository/role_repository.py +59 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/role/repository/role_repository_factory.py +13 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/role/role_service.py +105 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/role/role_service_factory.py +7 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/repository/user_db_repository.py +42 -13
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/repository/user_repository.py +38 -17
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/repository/user_repository_factory.py +2 -2
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/user_service.py +69 -17
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/service/user/user_service_factory.py +2 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/route.py +1 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/subroute/auth.py +198 -28
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/gateway/util/view.py +1 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/requirements.txt +1 -1
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/permission.py +17 -5
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/role.py +50 -4
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/session.py +52 -0
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/schema/user.py +30 -5
- zrb/builtin/random.py +61 -0
- zrb/cmd/cmd_val.py +6 -5
- zrb/runner/cli.py +10 -1
- zrb/runner/web_util/token.py +7 -3
- zrb/task/base_task.py +24 -2
- zrb/task/cmd_task.py +7 -5
- zrb/util/cmd/command.py +1 -0
- zrb/util/file.py +7 -1
- {zrb-1.0.0b1.dist-info → zrb-1.0.0b2.dist-info}/METADATA +1 -1
- {zrb-1.0.0b1.dist-info → zrb-1.0.0b2.dist-info}/RECORD +80 -61
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/entity/template/any_client_method.py +0 -27
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/api_client.py +0 -6
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/direct_client.py +0 -5
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/_zrb/module/template/app_template/module/my_module/client/factory.py +0 -9
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/app.py +0 -57
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/any_client.py +0 -33
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/api_client.py +0 -7
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/direct_client.py +0 -6
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/factory.py +0 -9
- zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/migration/versions/3093c7336477_add_user_table.py +0 -37
- /zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/{view.py → util/view.py} +0 -0
- {zrb-1.0.0b1.dist-info → zrb-1.0.0b2.dist-info}/WHEEL +0 -0
- {zrb-1.0.0b1.dist-info → zrb-1.0.0b2.dist-info}/entry_points.txt +0 -0
@@ -1,57 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
from contextlib import asynccontextmanager
|
3
|
-
|
4
|
-
from fastapi import FastAPI, HTTPException
|
5
|
-
from fastapi.openapi.docs import get_swagger_ui_html
|
6
|
-
from fastapi.responses import FileResponse
|
7
|
-
from fastapi.staticfiles import StaticFiles
|
8
|
-
from my_app_name.common.db_engine import engine
|
9
|
-
from my_app_name.config import (
|
10
|
-
APP_GATEWAY_FAVICON_PATH,
|
11
|
-
APP_GATEWAY_TITLE,
|
12
|
-
APP_GATEWAY_VIEW_PATH,
|
13
|
-
APP_MODE,
|
14
|
-
APP_MODULES,
|
15
|
-
APP_VERSION,
|
16
|
-
)
|
17
|
-
from sqlmodel import SQLModel
|
18
|
-
|
19
|
-
|
20
|
-
@asynccontextmanager
|
21
|
-
async def lifespan(app: FastAPI):
|
22
|
-
SQLModel.metadata.create_all(engine)
|
23
|
-
yield
|
24
|
-
|
25
|
-
|
26
|
-
app_title = (
|
27
|
-
APP_GATEWAY_TITLE
|
28
|
-
if APP_MODE == "monolith"
|
29
|
-
else f"{APP_GATEWAY_TITLE} - {', '.join(APP_MODULES)}"
|
30
|
-
)
|
31
|
-
app = FastAPI(
|
32
|
-
title=app_title,
|
33
|
-
version=APP_VERSION,
|
34
|
-
lifespan=lifespan,
|
35
|
-
docs_url=None,
|
36
|
-
)
|
37
|
-
|
38
|
-
_STATIC_DIR = os.path.join(APP_GATEWAY_VIEW_PATH, "static")
|
39
|
-
app.mount("/static", StaticFiles(directory=_STATIC_DIR), name="static")
|
40
|
-
|
41
|
-
|
42
|
-
# Serve static files
|
43
|
-
@app.get("/static/{file_path:path}", include_in_schema=False)
|
44
|
-
async def static_files(file_path: str):
|
45
|
-
full_path = os.path.join(_STATIC_DIR, file_path)
|
46
|
-
if os.path.isfile(full_path):
|
47
|
-
return FileResponse(full_path)
|
48
|
-
raise HTTPException(status_code=404, detail="File not found")
|
49
|
-
|
50
|
-
|
51
|
-
@app.get("/docs", include_in_schema=False)
|
52
|
-
async def swagger_ui_html():
|
53
|
-
return get_swagger_ui_html(
|
54
|
-
openapi_url="/openapi.json",
|
55
|
-
title=app_title,
|
56
|
-
swagger_favicon_url=APP_GATEWAY_FAVICON_PATH,
|
57
|
-
)
|
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/any_client.py
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
|
-
|
3
|
-
from my_app_name.schema.user import (
|
4
|
-
UserCreateWithAudit,
|
5
|
-
UserResponse,
|
6
|
-
UserUpdateWithAudit,
|
7
|
-
)
|
8
|
-
|
9
|
-
|
10
|
-
class AnyClient(ABC):
|
11
|
-
@abstractmethod
|
12
|
-
async def get_user_by_id(self, user_id: str) -> UserResponse:
|
13
|
-
pass
|
14
|
-
|
15
|
-
@abstractmethod
|
16
|
-
async def get_all_users(self) -> list[UserResponse]:
|
17
|
-
pass
|
18
|
-
|
19
|
-
@abstractmethod
|
20
|
-
async def create_user(
|
21
|
-
self, data: UserCreateWithAudit | list[UserCreateWithAudit]
|
22
|
-
) -> UserResponse | list[UserResponse]:
|
23
|
-
pass
|
24
|
-
|
25
|
-
@abstractmethod
|
26
|
-
async def update_user(
|
27
|
-
self, user_id: str, data: UserUpdateWithAudit
|
28
|
-
) -> UserResponse:
|
29
|
-
pass
|
30
|
-
|
31
|
-
@abstractmethod
|
32
|
-
async def delete_user(self, user_id: str) -> UserResponse:
|
33
|
-
pass
|
zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/module/auth/client/api_client.py
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
from my_app_name.config import APP_AUTH_BASE_URL
|
2
|
-
from my_app_name.module.auth.client.any_client import AnyClient
|
3
|
-
from my_app_name.module.auth.service.user.user_service_factory import user_service
|
4
|
-
|
5
|
-
|
6
|
-
class APIClient(user_service.as_api_client(base_url=APP_AUTH_BASE_URL), AnyClient):
|
7
|
-
pass
|
@@ -1,9 +0,0 @@
|
|
1
|
-
from my_app_name.config import APP_COMMUNICATION
|
2
|
-
from my_app_name.module.auth.client.any_client import AnyClient
|
3
|
-
from my_app_name.module.auth.client.api_client import APIClient
|
4
|
-
from my_app_name.module.auth.client.direct_client import DirectClient
|
5
|
-
|
6
|
-
if APP_COMMUNICATION == "direct":
|
7
|
-
client: AnyClient = DirectClient()
|
8
|
-
elif APP_COMMUNICATION == "api":
|
9
|
-
client: AnyClient = APIClient()
|
@@ -1,37 +0,0 @@
|
|
1
|
-
"""Add user table
|
2
|
-
|
3
|
-
Revision ID: 3093c7336477
|
4
|
-
Revises:
|
5
|
-
Create Date: 2024-11-20 05:57:01.684118
|
6
|
-
|
7
|
-
"""
|
8
|
-
|
9
|
-
from typing import Sequence, Union
|
10
|
-
|
11
|
-
import sqlalchemy as sa
|
12
|
-
import sqlmodel
|
13
|
-
from alembic import op
|
14
|
-
|
15
|
-
# revision identifiers, used by Alembic.
|
16
|
-
revision: str = "3093c7336477"
|
17
|
-
down_revision: Union[str, None] = None
|
18
|
-
branch_labels: Union[str, Sequence[str], None] = None
|
19
|
-
depends_on: Union[str, Sequence[str], None] = None
|
20
|
-
|
21
|
-
|
22
|
-
def upgrade() -> None:
|
23
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
24
|
-
op.create_table(
|
25
|
-
"user",
|
26
|
-
sa.Column("id", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
27
|
-
sa.Column("username", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
28
|
-
sa.Column("password", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
29
|
-
sa.PrimaryKeyConstraint("id"),
|
30
|
-
)
|
31
|
-
# ### end Alembic commands ###
|
32
|
-
|
33
|
-
|
34
|
-
def downgrade() -> None:
|
35
|
-
# ### commands auto generated by Alembic - please adjust! ###
|
36
|
-
op.drop_table("user")
|
37
|
-
# ### end Alembic commands ###
|
/zrb/builtin/project/add/fastapp/fastapp_template/my_app_name/common/{view.py → util/view.py}
RENAMED
File without changes
|
File without changes
|
File without changes
|