[MVPTN-58] feat(CrudTTbreconhecimentoTipo): Conclusão CRUD
This commit is contained in:
parent
57f3971a26
commit
d64cf8c70f
18 changed files with 1619 additions and 41371 deletions
|
|
@ -2,7 +2,7 @@ from abstracts.action import BaseAction
|
|||
from packages.v1.administrativo.schemas.t_tb_reconhecimentotipo_schema import TTbReconhecimentotipoDescricaoSchema
|
||||
from packages.v1.administrativo.repositories.t_tb_reconhecimentotipo.t_tb_reconhecimentotipo_get_by_descricao_repository import GetByDescricaoRepository
|
||||
|
||||
class GetByDescricaoService(BaseAction):
|
||||
class GetByDescricaoAction(BaseAction):
|
||||
"""
|
||||
Serviço responsável por encapsular a lógica de negócio para a operação
|
||||
de busca de um registro na tabela t_tb_reconhecimentotipo por descrição.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from abstracts.action import BaseAction
|
||||
from packages.v1.administrativo.repositories.t_tb_reconhecimentotipo.t_tb_reconhecimentotipo_index_repository import IndexRepository
|
||||
|
||||
class IndexService(BaseAction):
|
||||
class IndexAction(BaseAction):
|
||||
"""
|
||||
Serviço responsável por encapsular a lógica de negócio para a operação
|
||||
de listagem de todos os registros na tabela t_tb_reconhecimentotipo.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from abstracts.action import BaseAction
|
|||
from packages.v1.administrativo.schemas.t_tb_reconhecimentotipo_schema import TTbReconhecimentotipoSaveSchema
|
||||
from packages.v1.administrativo.repositories.t_tb_reconhecimentotipo.t_tb_reconhecimentotipo_save_repository import SaveRepository
|
||||
|
||||
class SaveService(BaseAction):
|
||||
class SaveAction(BaseAction):
|
||||
"""
|
||||
Serviço responsável por encapsular a lógica de negócio para a operação
|
||||
de salvar um novo registro na tabela t_tb_reconhecimentotipo.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from abstracts.action import BaseAction
|
|||
from packages.v1.administrativo.schemas.t_tb_reconhecimentotipo_schema import TTbReconhecimentotipoIdSchema
|
||||
from packages.v1.administrativo.repositories.t_tb_reconhecimentotipo.t_tb_reconhecimentotipo_show_repository import ShowRepository
|
||||
|
||||
class ShowService(BaseAction):
|
||||
class ShowAction(BaseAction):
|
||||
"""
|
||||
Serviço responsável por encapsular a lógica de negócio para a exibição
|
||||
de um registro na tabela t_tb_reconhecimentotipo.
|
||||
|
|
|
|||
|
|
@ -2,24 +2,24 @@ from packages.v1.administrativo.schemas.t_tb_reconhecimentotipo_schema import TT
|
|||
from packages.v1.administrativo.repositories.t_tb_reconhecimentotipo.t_tb_reconhecimentotipo_update_repository import UpdateRepository
|
||||
|
||||
|
||||
class TTbReconhecimentotipoUpdateService:
|
||||
class UpdateAction:
|
||||
"""
|
||||
Service responsável por encapsular a lógica de negócio para a atualização
|
||||
de um registro na tabela t_tb_reconhecimentotipo.
|
||||
"""
|
||||
|
||||
def execute(self, reconhecimentotipo_schema: TTbReconhecimentotipoUpdateSchema):
|
||||
"""
|
||||
Executa a operação de atualização.
|
||||
|
||||
Args:
|
||||
reconhecimentotipo_schema (T_TbReconhecimentotipoUpdateSchema): O esquema com os dados a serem atualizados.
|
||||
|
||||
Returns:
|
||||
O resultado da operação de atualização.
|
||||
def execute(self, reconhecimentotipo_schema: TTbReconhecimentotipoUpdateSchema):
|
||||
"""
|
||||
# Instância o repositório de atualização
|
||||
update_repository = UpdateRepository()
|
||||
Executa a operação de atualização.
|
||||
|
||||
# Chama o método de execução do repositório para realizar a atualização
|
||||
return update_repository.execute(reconhecimentotipo_schema)
|
||||
Args:
|
||||
reconhecimentotipo_schema (T_TbReconhecimentotipoUpdateSchema): O esquema com os dados a serem atualizados.
|
||||
|
||||
Returns:
|
||||
O resultado da operação de atualização.
|
||||
"""
|
||||
# Instância o repositório de atualização
|
||||
update_repository = UpdateRepository()
|
||||
|
||||
# Chama o método de execução do repositório para realizar a atualização
|
||||
return update_repository.execute(reconhecimentotipo_schema)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ from packages.v1.administrativo.schemas.t_tb_reconhecimentotipo_schema import (
|
|||
TTbReconhecimentotipoSchema,
|
||||
TTbReconhecimentotipoSaveSchema,
|
||||
TTbReconhecimentotipoUpdateSchema,
|
||||
TTbReconhecimentotipoIdSchema
|
||||
TTbReconhecimentotipoIdSchema,
|
||||
TTbReconhecimentotipoDescricaoSchema
|
||||
)
|
||||
|
||||
class TTbReconhecimentotipoController:
|
||||
|
|
@ -52,10 +53,10 @@ class TTbReconhecimentotipoController:
|
|||
|
||||
|
||||
# Busca um tipo de reconhecimento pela descrição
|
||||
def get_by_descricao(self, descricao : str):
|
||||
def get_by_descricao(self, reconhecimentotipo_schema : TTbReconhecimentotipoDescricaoSchema):
|
||||
|
||||
#Importação da classe desejada
|
||||
show_service = self.dynamic_import.service('t_tb_reconhecimentotipo_get_by_descricao_service', 'GetByDescricaoService')
|
||||
show_service = self.dynamic_import.service('t_tb_reconhecimentotipo_get_descricao_service', 'GetByDescricaoService')
|
||||
|
||||
# Instância da classe desejada
|
||||
self.show_service = show_service()
|
||||
|
|
@ -63,9 +64,9 @@ class TTbReconhecimentotipoController:
|
|||
# Busca e retorna o tipo de reconhecimento desejado
|
||||
return {
|
||||
'message' : 'Tipo de reconhecimento localizado com sucesso',
|
||||
'data': self.show_service.execute(descricao)
|
||||
}
|
||||
|
||||
'data': self.show_service.execute(reconhecimentotipo_schema, True) #True para retornar a mensagem de erro caso não localize o serviço
|
||||
}
|
||||
|
||||
|
||||
# Cadastra um novo tipo de reconhecimento
|
||||
def save(self, reconhecimentotipo_schema : TTbReconhecimentotipoSaveSchema):
|
||||
|
|
|
|||
|
|
@ -37,8 +37,11 @@ async def index(current_user: dict = Depends(get_current_user)):
|
|||
response_description='Busca um registro em específico')
|
||||
async def get_by_descricao(descricao : str, current_user: dict = Depends(get_current_user)):
|
||||
|
||||
# Cria o schema com os dados recebidos
|
||||
reconhecimentotipo_schema = TTbReconhecimentotipoSchema(descricao=descricao)
|
||||
|
||||
# Busca um tipo de reconhecimento específico pela descrição
|
||||
response = t_tb_reconhecimentotipo_controller.get_by_descricao(descricao)
|
||||
response = t_tb_reconhecimentotipo_controller.get_by_descricao(reconhecimentotipo_schema)
|
||||
|
||||
# Retorna os dados localizados
|
||||
return response
|
||||
|
|
|
|||
|
|
@ -32,6 +32,13 @@ class TTbReconhecimentotipoIdSchema(BaseModel):
|
|||
tb_reconhecimentotipo_id: int
|
||||
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Schema para localizar um tipo especifico pela descrição (GET)
|
||||
# ----------------------------------------------------
|
||||
class TTbReconhecimentotipoDescricaoSchema(BaseModel):
|
||||
descricao: str
|
||||
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Schema para criação de novo tipo (POST)
|
||||
# ----------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from packages.v1.administrativo.schemas.t_tb_reconhecimentotipo_schema import TTbReconhecimentotipoIdSchema
|
||||
from packages.v1.administrativo.actions.t_tb_reconhecimentotipo.t_tb_reconhecimentotipo_delete_action import DeleteAction
|
||||
|
||||
class T_TbReconhecimentotipoDeleteService:
|
||||
class DeleteService:
|
||||
"""
|
||||
Serviço responsável por encapsular a lógica de negócio para a operação
|
||||
de exclusão de um registro na tabela t_tb_reconhecimentotipo.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from fastapi import HTTPException, status
|
|||
from packages.v1.administrativo.schemas.t_tb_reconhecimentotipo_schema import TTbReconhecimentotipoDescricaoSchema
|
||||
from packages.v1.administrativo.actions.t_tb_reconhecimentotipo.t_tb_reconhecimentotipo_get_by_descricao_action import GetByDescricaoAction
|
||||
|
||||
class T_TbReconhecimentotipoGetByDescricaoService:
|
||||
class GetByDescricaoService:
|
||||
"""
|
||||
Serviço responsável por encapsular a lógica de negócio para a operação
|
||||
de busca de um registro na tabela t_tb_reconhecimentotipo pela sua descrição.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from fastapi import HTTPException, status
|
||||
from packages.v1.administrativo.actions.t_tb_reconhecimentotipo.t_tb_reconhecimentotipo_index_action import IndexAction
|
||||
|
||||
class T_TbReconhecimentotipoIndexService:
|
||||
class IndexService:
|
||||
"""
|
||||
Serviço responsável por encapsular a lógica de negócio para a operação
|
||||
de listagem de registros na tabela t_tb_reconhecimentotipo.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
from actions.dynamic_import.dynamic_import import DynamicImport
|
||||
from packages.v1.sequencia.schemas.g_sequencia import GSequenciaSchema
|
||||
from packages.v1.sequencia.services.g_sequencia.generate_service import GenerateService
|
||||
from packages.v1.administrativo.schemas.t_tb_reconhecimentotipo_schema import TTbReconhecimentotipoSaveSchema, T_TbReconhecimentotipoDescricaoSchema
|
||||
from packages.v1.administrativo.schemas.t_tb_reconhecimentotipo_schema import TTbReconhecimentotipoSaveSchema, TTbReconhecimentotipoDescricaoSchema
|
||||
from packages.v1.administrativo.actions.t_tb_reconhecimentotipo.t_tb_reconhecimentotipo_save_action import SaveAction
|
||||
from fastapi import HTTPException, status
|
||||
|
||||
class T_TbReconhecimentotipoSaveService:
|
||||
class TTbReconhecimentotipoSaveService:
|
||||
|
||||
def __init__(self):
|
||||
# Ação responsável por carregar as services de acordo com o estado
|
||||
|
|
@ -26,13 +26,13 @@ class T_TbReconhecimentotipoSaveService:
|
|||
|
||||
# Verifica se a descrição já está sendo utilizada
|
||||
# Importação de service
|
||||
descricao_service = self.dynamic_import.service("t_tb_reconhecimentotipo_get_by_descricao_service", "GetDescricaoService")
|
||||
descricao_service = self.dynamic_import.service("t_tb_reconhecimentotipo_get_descricao_service", "GetByDescricaoService")
|
||||
|
||||
# Instanciamento da service
|
||||
self.descricao_service = descricao_service()
|
||||
|
||||
# Verifica se a descrição já está sendo utilizada
|
||||
self.response = self.descricao_service.execute(T_TbReconhecimentotipoDescricaoSchema(descricao=reconhecimentotipo_schema.descricao), False)
|
||||
self.response = self.descricao_service.execute(TTbReconhecimentotipoDescricaoSchema(descricao=reconhecimentotipo_schema.descricao), False)
|
||||
|
||||
# Se houver retorno significa que a descrição já está sendo utilizada
|
||||
if self.response:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from fastapi import HTTPException, status
|
|||
from packages.v1.administrativo.schemas.t_tb_reconhecimentotipo_schema import TTbReconhecimentotipoIdSchema
|
||||
from packages.v1.administrativo.actions.t_tb_reconhecimentotipo.t_tb_reconhecimentotipo_show_action import ShowAction
|
||||
|
||||
class T_TbReconhecimentotipoShowService:
|
||||
class ShowService:
|
||||
"""
|
||||
Serviço responsável por encapsular a lógica de negócio para a operação
|
||||
de busca de um registro na tabela t_tb_reconhecimentotipo.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from packages.v1.administrativo.schemas.t_tb_reconhecimentotipo_schema import TTbReconhecimentotipoUpdateSchema
|
||||
from packages.v1.administrativo.actions.t_tb_reconhecimentotipo.t_tb_reconhecimentotipo_update_action import UpdateAction
|
||||
|
||||
class T_TbReconhecimentotipoUpdateService:
|
||||
class TTbReconhecimentotipoUpdateService:
|
||||
"""
|
||||
Serviço para a operação de atualização de um registro na tabela
|
||||
t_tb_reconhecimentotipo.
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
from fastapi import APIRouter
|
||||
|
||||
# Importa os módulos de rotas específicos
|
||||
from packages.v1.administrativo.endpoints import c_caixa_item
|
||||
from packages.v1.administrativo.endpoints import g_usuario
|
||||
from packages.v1.administrativo.endpoints import c_caixa_item_endpoint
|
||||
from packages.v1.administrativo.endpoints import g_usuario_endpoint
|
||||
from packages.v1.administrativo.endpoints import c_caixa_servico_endpoint
|
||||
from packages.v1.administrativo.endpoints import t_tb_reconhecimentotipo_endpoint
|
||||
|
||||
# Cria uma instância do APIRouter que vai agregar todas as rotas da API
|
||||
|
|
@ -11,7 +12,7 @@ api_router = APIRouter()
|
|||
|
||||
# Inclui as rotas de caixa
|
||||
api_router.include_router(
|
||||
c_caixa_item.router, prefix="/administrativo/caixa", tags=["Caixa"]
|
||||
c_caixa_item_endpoint.router, prefix="/administrativo/caixa", tags=["Caixa"]
|
||||
)
|
||||
|
||||
# Inclui as rotas de usuários
|
||||
|
|
|
|||
|
|
@ -822,5 +822,72 @@
|
|||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json"
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json",
|
||||
"storage/temp/http_exception_handler.json",
|
||||
"storage/temp/validation_exception_handler.json"
|
||||
]
|
||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue