Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Criar Style Guide da aplicação #82

Open
devlefel opened this issue Jan 30, 2024 · 5 comments
Open

Criar Style Guide da aplicação #82

devlefel opened this issue Jan 30, 2024 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation Easy Good for first issue. good first issue Good for newcomers up-to-date issue updated to be assigned
Milestone

Comments

@devlefel
Copy link
Contributor

devlefel commented Jan 30, 2024

Describe the feature
Criar Style guide para aplicação, mostrando como deve ser o codigo, como devem ser as rotas, etc.

ESSE É UM DOCUMENTO VIVO

No final, linkar ao readme da aplicação

Description Precisamos de um template para o style guide. É necessário documentar cada feature a ser inserida na aplicação

Use Case Será usado em todas as features a serem adicionadas

Implementation Details Template para
- Controller
- Infra
- Entidades
- Outros... 

Visual Concepts

[Include any visual representations or concepts if those are available and applicable.]


Additional Information

Estaremos usando Effective GO, clean arch e DDD:
https://go.dev/doc/effective_go
https://eltonminetto.dev/en/post/2020-07-06-clean-architecture-2years-later/
https://programmingpercy.tech/blog/how-to-domain-driven-design-ddd-golang/

@GabrielTrindadeC GabrielTrindadeC added the good first issue Good for newcomers label Jan 30, 2024
@GabrielTrindadeC GabrielTrindadeC added this to the Docs milestone Jan 30, 2024
@devlefel
Copy link
Contributor Author

Criar uma documentação de styleguide baseado nos styleguides que definimos para o projeto:

https://google.github.io/styleguide/go/
https://go.dev/doc/effective_go

Alem disso Documentar como fazer controllers, Models, Usecases, repositories e interfaces.

Alem disso documentar tambem como faremos padrao de roteamento:

Rotas da API

POST /api/v1/users/

GET,PATCH/PUT,DELETE /api/v1/users/{id}

GET,POST, /api/v1/users/{idUser}/addresses

GET,PATCH,DELETE /api/v1/users/1/addresses/1

GET,POST /api/v1/users/1/pets

GET,PATCH,DELETE /api/v1/users/1/pets/2

GET,POST /api/v1/users/1/pets/1/images

GET,PATCH,DELETE /api/v1/users/1/pets/1/images/1

GET,POST /api/v1/users/1/pets/1/vaccines

GET,PATCH,DELETE /api/v1/users/1/pets/1/vaccines/1

GET, POST /api/v1/breeds/

GET,PATCH,DELETE /api/v1/breeds/1

@devlefel devlefel added documentation Improvements or additions to documentation Easy Good for first issue. labels Feb 26, 2024
@GabrielTrindadeC GabrielTrindadeC removed their assignment Feb 27, 2024
@k1nha k1nha added the up-to-date issue updated to be assigned label Mar 12, 2024
@k1nha k1nha changed the title Criar Style Guide da aplicação Criar template para Style Guide da aplicação Mar 12, 2024
@k1nha
Copy link
Contributor

k1nha commented Mar 12, 2024

Infra

Logger

path: infra/config/logger.go

Funcionalidade:

Ferramenta para registrar mensagens durante a execução do programa.
Utilidades:

  1. Registro de eventos
  2. Depuração
  3. Monitoramento
Como usar:

Para instanciar o logger em algum lugar da aplicação é necessário usar o package config. Ao topo do arquivo, declare o logger com o escopo do arquivo, vamos considerar um controller:

//

package controllers

import (
	"pet-dex-backend/v2/infra/config"
	... //imports
)

var logger = config.GetLogger("pet-controller")

... // controller

func (pc *PetController) Create(w http.ResponseWriter, r *http.Request){
	...
	logger.Error(err)
	logger.Info("Olha lá")
}

O logger tem alguns métodos:

  • Debug - Debugf
  • Info - Infof
  • Warn - Warnf
  • Error - Errorf

@k1nha
Copy link
Contributor

k1nha commented Mar 12, 2024

Pet Controller

Endpoint para pets

1. Criar Pet:

Qual handler?
  • CreatePet

GET /pets/

Payload:
{
	"name": "Cratos bom de guerra"
}
Response:
{
  "resultado": "sucesso",
  "dados": {
    "informacao1": "valor1",
    "informacao2": "valor2"
  }
}

2. Pegar um pet:

Qual handler?

  • CreatePet

GET /pet/{id}
id: string - UUID

Payload:
no-body
Response:
{
	"name": "Cratos bom de guerra"
}

@k1nha
Copy link
Contributor

k1nha commented Mar 12, 2024

Use Cases

Casos de uso para PETS

1. ListUserPets

Paramêtros:
Fluxo:
Repositórios acessados:
Retorno:

@AtilaRocha
Copy link

EU QUERO!!!

@GabrielTrindadeC GabrielTrindadeC removed this from the Docs milestone Apr 6, 2024
@devlefel devlefel added this to the Core milestone Apr 6, 2024
@GabrielTrindadeC GabrielTrindadeC modified the milestones: Core, Doc Apr 8, 2024
@zoldyzdk zoldyzdk changed the title Criar template para Style Guide da aplicação Criar Style Guide da aplicação May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation Easy Good for first issue. good first issue Good for newcomers up-to-date issue updated to be assigned
Projects
Status: Commited
Development

No branches or pull requests

4 participants