{"id":26824891,"url":"https://github.com/guilopes15/tcc_madr","last_synced_at":"2025-10-17T06:24:19.964Z","repository":{"id":252853518,"uuid":"841662308","full_name":"guilopes15/tcc_madr","owner":"guilopes15","description":"Meu Acervo Digital de Romances","archived":false,"fork":false,"pushed_at":"2024-08-28T17:24:51.000Z","size":220,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T10:18:05.423Z","etag":null,"topics":["alembic","argon2","factory-boy","fastapi","freezegun","psycopg2","pydantic","pydantic-settings","pyjwt","pytest","python","python-multipart","ruff","slugify","sqlalchemy","taskipy","testcontainers"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guilopes15.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-12T21:16:17.000Z","updated_at":"2025-02-14T15:48:53.000Z","dependencies_parsed_at":"2024-08-13T00:22:19.911Z","dependency_job_id":"39f6708f-76a5-4842-979e-a517fbce5b6b","html_url":"https://github.com/guilopes15/tcc_madr","commit_stats":null,"previous_names":["guilopes15/tcc_madr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/guilopes15/tcc_madr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilopes15%2Ftcc_madr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilopes15%2Ftcc_madr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilopes15%2Ftcc_madr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilopes15%2Ftcc_madr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guilopes15","download_url":"https://codeload.github.com/guilopes15/tcc_madr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guilopes15%2Ftcc_madr/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261255521,"owners_count":23131473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alembic","argon2","factory-boy","fastapi","freezegun","psycopg2","pydantic","pydantic-settings","pyjwt","pytest","python","python-multipart","ruff","slugify","sqlalchemy","taskipy","testcontainers"],"created_at":"2025-03-30T10:18:08.110Z","updated_at":"2025-10-17T06:24:19.959Z","avatar_url":"https://github.com/guilopes15.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# O que é o MADR?\n\nMadr ou Meu Acervo Digital de Romances é uma **API** para gestão de livros. Este projeto surgiu como tcc do curso [FastZero](https://fastapidozero.dunossauro.com/#pre-requisitos), disponibilizado pelo [Dunossauro](https://github.com/dunossauro).\n\n#### Observações iniciais\n\nNeste projeto decidi utilizar a mesma estrutura do curso fastzero, por ser o meu primeiro projeto com o framework [FastAPI](https://fastapi.tiangolo.com/). \n\n#### Bibliotecas fora do escopo do curso\n\n* Para sanitizar os nomes usei o **python-slugify**, esta biblioteca limpa os caracteres especiais, letras maiusculas, acentuação e etc.  \n\n```bash\npoetry add python-slugify\n```\n\n### Como utilizar?\nAntes de tudo instale o [python](https://www.python.org/downloads/) e o [docker](https://docs.docker.com/engine/install/) na máquina.\n\n\nÉ preciso também criar um arquivo **`.env`** na raiz do projeto(pasta onde fica o pyproject.toml) com as seguintes variaveis:\n\n```plaintext\nDATABASE_URL=\"postgresql+psycopg://app_user:app_password@localhost:5432/app_db\"\nSECRET_KEY=\"your-secret-key\"\nALGORITHM=\"HS256\"\nACCESS_TOKEN_EXPIRE_MINUTES=60\n```\n\nDepois execute:\n\n```bash\ndocker compose up --build\n```\nCom isso a **API** já esta rodando localmente dentro de um conteiner docker.\n\n\n#### Swagger\nUtilize o swagger para testar todas as rotas e verificar os schemas.\n\nAcesse: \n\u003elocalhost:8000/docs\n\n\n\n#### Login\nAlguns endpoints é necessario estar logado para acessar, e este projeto não possui uma tela de login, então utilize o swagger para isso.\nOs endpoints com *login required* é necessario passar informações no header da requisição.\n```\nhearders={'Authorization': 'Bearer {token}'}\n```\n\n### Rotas\n\n#### Auth\n* ***Token JWT***\n\nÉ preciso ter o token jwt do tipo Bearer para realizar a autentificação, então faça um post no seguinte endpoint:\n\u003e POST /auth/token\n```       \n{\n    'username': 'test@test.com', \n    'password': 'password'\n}\n```\n* ***Refresh Token*** - *login required*\n\nO token expira em 60 minutos, então faça um post no endpoint abaixo antes do tempo expirar, para permanecer utilizando a aplicação:\n\u003ePOST /auth/refresh_token\n\n#### Users, Livro e Romancista\nUtilize o **redoc** para mais informações sobre todas as rotas disponíveis.\n\n\u003elocalhost:8000/redoc\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilopes15%2Ftcc_madr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguilopes15%2Ftcc_madr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilopes15%2Ftcc_madr/lists"}