Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
eb2e4a1
feat: adiciona entidades User, RoleEnum e UserTest utilizando pydantic
PedroOSanches Jul 14, 2026
9aa1d05
fix: corrige versão do pacote coverage para 7.10.7
PedroOSanches Jul 14, 2026
4f70096
feat: atualiza dependências no requirements-dev.txt
PedroOSanches Jul 16, 2026
ca6204b
feat: implementa criação de usuário com validação de dados e gerencia…
PedroOSanches Jul 16, 2026
ec1d0a4
refactor: renomeia RoleEnum para ROLE e atualiza referências em todo …
PedroOSanches Jul 17, 2026
144657a
refactor: comenta testes do template
PedroOSanches Jul 20, 2026
9f8e28f
Revert "feat: implementa criação de usuário com validação de dados e …
PedroOSanches Jul 24, 2026
87321ab
Revert "refactor: renomeia RoleEnum para ROLE e atualiza referências …
PedroOSanches Jul 24, 2026
d25a3df
refactor: comenta testes de rotas
PedroOSanches Jul 24, 2026
cfe0598
refactor: atualiza UserRepositoryMock para usar UUID em vez de email
PedroOSanches Jul 28, 2026
7485ee6
refactor: atualiza UserRepositoryMock para permitir atualização de se…
PedroOSanches Jul 31, 2026
25014d1
refactor: atualiza IUserRepository e UserRepositoryMock para usar UUI…
PedroOSanches Jul 31, 2026
4d6f23c
refactor: atualiza método update_user para simplificar a atualização …
PedroOSanches Aug 3, 2026
4a35cb4
refactor: troca assinatura do metódo update user para fins de documen…
PedroOSanches Aug 3, 2026
6cc23da
refactor: alinha entidade User e mock com EntityError e requirements …
lseixas Aug 10, 2026
3a16239
fix: updated ci to python 311, meeting requirements new packages
lseixas Aug 10, 2026
0b21f9e
Merge pull request #1 from Maua-Dev/user-entitie
lseixas Aug 10, 2026
f642739
chore: updated ci to 1.3
lseixas Aug 10, 2026
3ae39f1
refactor: remove password_hash da entidade user, refatora testes
PedroOSanches Aug 12, 2026
8847c81
feat: adéqua rota create_user a nova estrutura de user e refatora os …
PedroOSanches Aug 14, 2026
5856175
feat: alinha helpers, observability, HTTP e stack local com o template
lseixas Aug 15, 2026
f340ce6
feat(infra): adiciona dynamo_keys e alinha tabela CDK com pk/sk
lseixas Aug 15, 2026
29b6091
feat: Adiciona entidade Member, enum dos cargos e o teste da nova ent…
oTeitz Aug 15, 2026
8a85aca
feat: member interface and mock, with tests
oTeitz Aug 18, 2026
b8848ef
refactor: altera GetUserController e GetUserUsecase para usar UUID, s…
PedroOSanches Aug 18, 2026
033e2bc
refactor: adiciona tratamento de erro para user_id e adequa testes da…
PedroOSanches Aug 20, 2026
b79b2e6
feat(infra): adiciona template Dynamo DTO/repo com model_dump
lseixas Aug 21, 2026
5118068
Merge pull request #13 from Maua-Dev/feature/dynamo_infra
lseixas Aug 21, 2026
d51089a
refactor: validação de user_id e atualização de testes para uso de UUID
PedroOSanches Aug 21, 2026
99c6542
refactor: adiciona user_id na inicialização dos usuários no repositór…
PedroOSanches Aug 24, 2026
5dd65d7
Merge branch 'refat/user' into feature/get-user para trazer os id de …
PedroOSanches Aug 24, 2026
9430de7
Merge branch 'refat/user' into feature/create_user: Para trazer os id…
PedroOSanches Aug 24, 2026
731df32
refactor: altera a lógica de exclusão de usuário para usar UUID e atu…
PedroOSanches Aug 24, 2026
8466882
refactor: atualiza a estrutura do UserViewmodel e ajusta testes para …
PedroOSanches Aug 24, 2026
20823cb
refactor: ajusta importações e atualiza dados de usuários nos testes
PedroOSanches Aug 24, 2026
b52246c
refactor: atualiza lógica de atualização de usuário e melhora o model…
PedroOSanches Aug 24, 2026
f63a09a
refactor: atualiza testes de atualização de usuário para incluir novo…
PedroOSanches Aug 24, 2026
2f4bd31
feat: implementa UserRepositoryDynamo com métodos para obter e criar …
PedroOSanches Aug 26, 2026
ca6b529
feat: adiciona métodos para obter todos os usuários, deletar e atuali…
PedroOSanches Aug 26, 2026
27de24a
Merge pull request #12 from Maua-Dev/refat/user
lseixas Aug 26, 2026
705104f
Merge pull request #15 from Maua-Dev/feature/create_user
lseixas Aug 26, 2026
37cf65d
feat: member_dynamo_dto and test
oTeitz Aug 26, 2026
99a9a9e
Merge branch 'dev' into feature/user-repository-dynamo
PedroOSanches Aug 27, 2026
7bb3591
feat: atualiza UserRepositoryDynamo para usar método get_envs e corri…
PedroOSanches Aug 27, 2026
c923529
refat: corrige a formatação dos decorators de teste no Test_UserRepos…
PedroOSanches Aug 27, 2026
7a74ea6
Merge pull request #17 from Maua-Dev/feature/delete-user
lseixas Aug 31, 2026
5e47aee
Merge pull request #18 from Maua-Dev/feature/get-all-users
lseixas Aug 31, 2026
c08bef2
Merge pull request #16 from Maua-Dev/feature/get-user
lseixas Aug 31, 2026
a622f1d
Merge pull request #14 from Maua-Dev/feature/member_entity
lseixas Aug 31, 2026
0139522
refat: remove verificação de duplicação de email na criação de usuári…
PedroOSanches Aug 31, 2026
49b243c
refactor: adiciona validações de tipo para campos de email e papel na…
PedroOSanches Aug 31, 2026
b12547d
refat: corrige mensagem de erro para tipo de usuário inválido nos tes…
PedroOSanches Aug 31, 2026
1f29271
Merge pull request #20 from Maua-Dev/feature/user-repository-dynamo
lseixas Sep 1, 2026
7c5a429
Merge pull request #21 from Maua-Dev/refat/testes_rotas_user
lseixas Sep 1, 2026
536b8c2
feat(infra): migra IAC para template v2 com REST API e workflows
lseixas Sep 1, 2026
31375e9
Merge pull request #22 from Maua-Dev/feature/infra
lseixas Sep 1, 2026
a9bd507
fix: DTO fix and fetch dynamo keys from dev
oTeitz Sep 4, 2026
48dee58
feat: member repository dynamo.
oTeitz Sep 4, 2026
6c312b9
refat: added status attribute (enum), added every member_function
oTeitz Sep 9, 2026
aa28808
fix: dto test fix
oTeitz Sep 14, 2026
16fb2a0
Merge pull request #25 from Maua-Dev/refat/member
lseixas Sep 14, 2026
46dd7cc
fix: member repo dynamo test fix
oTeitz Sep 15, 2026
93ee104
fix: skipping dynamoDB tests
oTeitz Sep 15, 2026
6c208df
refactor: melhora a validação do user_id e atualiza a lógica de atual…
PedroOSanches Sep 16, 2026
7d3cc58
Merge pull request #24 from Maua-Dev/feature/dynamo_member
lseixas Oct 1, 2026
72e85cd
Merge remote-tracking branch 'origin/dev' into feature/update-user
lseixas Oct 3, 2026
2f75dc6
fix: alinha update_user com mensagens e limpeza pós-merge de dev
lseixas Oct 3, 2026
676ee9f
Merge pull request #19 from Maua-Dev/feature/update-user
lseixas Oct 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/scripts/assert_project_configured.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# Blocks CD deploy while this repo still looks like the clean_mss_template starter.
set -euo pipefail

REPO_NAME="${GITHUB_REPOSITORY##*/}"

FORBIDDEN_REPO_NAMES=(
"clean_mss_template"
)

FORBIDDEN_STACK_PREFIX="CleanMssTemplate"
FORBIDDEN_PROJECT_TAG="Template"

failed=0

for name in "${FORBIDDEN_REPO_NAMES[@]}"; do
if [[ "$REPO_NAME" == "$name" ]]; then
echo "::error::Repository is still named '${name}'. Rename it before enabling CD deploy."
failed=1
fi
done

if [[ "${GITHUB_REPOSITORY}" == "Maua-Dev/clean_mss_template" ]]; then
echo "::error::Refusing to deploy the upstream template repository itself."
failed=1
fi

if grep -qE "STACK_NAME=${FORBIDDEN_STACK_PREFIX}" .github/workflows/CD.yml; then
echo "::error::Change STACK_NAME prefix in .github/workflows/CD.yml (still '${FORBIDDEN_STACK_PREFIX}')."
failed=1
fi

if grep -qE "['\"]project['\"]: ['\"]${FORBIDDEN_PROJECT_TAG}['\"]" iac/app.py; then
echo "::error::Change the project tag in iac/app.py (still '${FORBIDDEN_PROJECT_TAG}')."
failed=1
fi

if [[ "$failed" -ne 0 ]]; then
echo ""
echo "CD deploy is blocked until the template identity is customized."
echo "No AWS resources will be created."
exit 1
fi

echo "Template identity looks customized. Deploy may proceed."
82 changes: 80 additions & 2 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,87 @@

name: CD

on:
push:
branches:
- main
- dev
- homolog
- prod

workflow_dispatch:

jobs:
deployGuard:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Assert project is no longer the unmodified template
run: bash .github/scripts/assert_project_configured.sh
env:
GITHUB_REPOSITORY: ${{ github.repository }}

testApp:
needs: [deployGuard]
uses: maua-dev/ci_workflows_reusable/.github/workflows/pytest_ci_313.yml@V1.3

cdkSynth:
needs: [deployGuard]
uses: ./.github/workflows/cdk_synth_ci.yml

DeployToAWS:
needs: [deployGuard, testApp, cdkSynth]
environment:
name: ${{ github.ref_name }}
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Set AWS Account ID
run: |
if [[ "${{ github.ref_name }}" == "dev" ]]; then
echo "AWS_ACCOUNT_ID=${{ secrets.AWS_ACCOUNT_ID_DEV }}" >> $GITHUB_ENV
elif [[ "${{ github.ref_name }}" == "homolog" ]]; then
echo "AWS_ACCOUNT_ID=${{ secrets.AWS_ACCOUNT_ID_HOML }}" >> $GITHUB_ENV
elif [[ "${{ github.ref_name }}" == "prod" ]]; then
echo "AWS_ACCOUNT_ID=${{ secrets.AWS_ACCOUNT_ID_PROD }}" >> $GITHUB_ENV
else
echo "Invalid branch name: ${{ github.ref_name }}" && exit 1
fi

- name: Setup AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/GithubActionsRole
role-session-name: github-action

- name: Setting stage and stack name
run: |
echo "STACK_NAME=EpepStackBack${{ github.ref_name }}" >> $GITHUB_ENV

- name: Installing Dependencies
run: |
npm install -g aws-cdk
pip install -r requirements-app.txt
pip install -r iac/requirements-infra.txt

- name: DeployWithCDK
working-directory: iac
run: |
cdk synth "$STACK_NAME"
cdk deploy "$STACK_NAME" --require-approval never
env:
AWS_REGION: ${{ vars.AWS_REGION }}
AWS_ACCOUNT_ID: ${{ env.AWS_ACCOUNT_ID }}
STACK_NAME: ${{ env.STACK_NAME }}
STAGE: ${{ github.ref_name }}
GITHUB_REF_NAME: ${{ github.ref_name }}
MSS_NAME: ${{ github.event.repository.name }}
GRAPH_MICROSOFT_ENDPOINT: ${{ vars.GRAPH_MICROSOFT_ENDPOINT }}
12 changes: 11 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,14 @@ on:

jobs:
testApp:
uses: maua-dev/ci_workflows_reusable/.github/workflows/pytest_ci.yml@V1.0
uses: maua-dev/ci_workflows_reusable/.github/workflows/pytest_ci_313.yml@V1.3

cdkSynth:
if: >
github.event_name != 'pull_request' &&
(github.ref_name == 'dev' ||
github.ref_name == 'homolog' ||
github.ref_name == 'prod' ||
startsWith(github.ref_name, 'feature/infra') ||
startsWith(github.ref_name, 'infra/'))
uses: ./.github/workflows/cdk_synth_ci.yml
37 changes: 37 additions & 0 deletions .github/workflows/cdk_synth_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CDK Synth

on:
workflow_call:

jobs:
cdkSynth:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.13"

- uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-app.txt
pip install -r iac/requirements-infra.txt
npm install -g aws-cdk

- name: CDK synth
working-directory: iac
run: cdk synth
env:
AWS_REGION: sa-east-1
AWS_ACCOUNT_ID: "000000000000"
STACK_NAME: EpepStackBackCi
STAGE: ci
GITHUB_REF_NAME: ci
MSS_NAME: epep_api
GRAPH_MICROSOFT_ENDPOINT: https://graph.microsoft.com/v1.0/me
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,6 @@ dmypy.json

/.vscode/
/.idea/
.DS_Store
iac/local/docker/dynamodb/shared-local-instance.db
iac/local/docker/minio/
1 change: 1 addition & 0 deletions iac/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ __pycache__
.venv
*.egg-info
lambda_layer_out_temp/
build/

# CDK asset staging directory
.cdk.staging
Expand Down
4 changes: 2 additions & 2 deletions iac/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ If you are a Windows platform, you would activate the virtualenv like this:
Once the virtualenv is activated, you can install the required dependencies.

```
$ pip install -r requirements.txt
$ pip install -r requirements-infra.txt
```

At this point you can now synthesize the CloudFormation template for this code.
Expand All @@ -44,7 +44,7 @@ $ cdk synth
```

To add additional dependencies, for example other CDK libraries, just add
them to your `setup.py` file and rerun the `pip install -r requirements.txt`
them to your `setup.py` file and rerun the `pip install -r requirements-infra.txt`
command.

## Useful commands
Expand Down
89 changes: 56 additions & 33 deletions iac/adjust_layer_directory.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,60 @@
import os
import shutil
import subprocess
from pathlib import Path
import sys

IAC_DIRECTORY_NAME = "iac"
SOURCE_DIRECTORY_NAME = "src"
LAMBDA_LAYER_PREFIX = os.path.join("python", "src")


def adjust_layer_directory(shared_dir_name: str, destination: str):
# Get the root directory of the source directory
root_directory = Path(__file__).parent.parent
iac_directory = os.path.join(root_directory, IAC_DIRECTORY_NAME)

print(f"Root directory: {root_directory}")
print(f"Root direcotry files: {os.listdir(root_directory)}")
print(f"IaC directory: {iac_directory}")
print(f"IaC directory files: {os.listdir(iac_directory)}")


# Get the destination and source directory
destination_directory = os.path.join(root_directory, IAC_DIRECTORY_NAME, destination)
source_directory = os.path.join(root_directory, SOURCE_DIRECTORY_NAME, shared_dir_name)

# Delete the destination directory if it exists
if os.path.exists(destination_directory):
shutil.rmtree(destination_directory)

# Copy the source directory to the destination directory
shutil.copytree(source_directory, os.path.join(destination_directory, LAMBDA_LAYER_PREFIX, shared_dir_name))
print(
f"Copying files from {source_directory} to {os.path.join(destination_directory, LAMBDA_LAYER_PREFIX, shared_dir_name)}")


if __name__ == '__main__':
adjust_layer_directory(shared_dir_name="shared", destination="lambda_layer_out_temp")
BUILD_DIRECTORY = "build"
PYTHON_TOP_LEVEL_DIR = os.path.join(BUILD_DIRECTORY, "python")
REQUIREMENTS_FILE = "requirements-app.txt"

PROJECT_ROOT = Path(__file__).parent.parent
SHARED_CODE_SOURCE = os.path.join(PROJECT_ROOT, "src", "shared")


def adjust_layer_directory():
"""
Prepara um diretório 'build' para uma Lambda Layer do AWS CDK.

A função junta o código local compartilhado e as dependências externas (pip)
na estrutura de pastas que a Lambda espera (/python).
"""
if os.path.exists(BUILD_DIRECTORY):
shutil.rmtree(BUILD_DIRECTORY)

shared_code_intermediate_dir = os.path.join(PYTHON_TOP_LEVEL_DIR, "src")
os.makedirs(shared_code_intermediate_dir)

print(f"Copiando código de: {SHARED_CODE_SOURCE}")
shared_code_dest = os.path.join(
shared_code_intermediate_dir,
os.path.basename(SHARED_CODE_SOURCE),
)
shutil.copytree(SHARED_CODE_SOURCE, shared_code_dest)

requirements_path = os.path.join(PROJECT_ROOT, REQUIREMENTS_FILE)
if os.path.exists(requirements_path):
subprocess.check_call(
[
"pip",
"install",
"-r",
requirements_path,
"-t",
PYTHON_TOP_LEVEL_DIR,
"--no-cache-dir",
"--platform",
"manylinux2014_x86_64",
"--python-version",
"3.13",
"--only-binary=:all:",
]
)
else:
print(
f"Aviso: Arquivo '{requirements_path}' não encontrado. "
"Nenhuma dependência externa será instalada."
)


if __name__ == "__main__":
adjust_layer_directory()
Loading
Loading