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

Consultar ONG #111 #117

Closed
wants to merge 19 commits into from
Closed

Consultar ONG #111 #117

wants to merge 19 commits into from

Conversation

AtilaRocha
Copy link

Closes #111

Feature Criado uma rota que recebe um ID de ONG e retorna as informações dessa ONG. Alguns componentes foram criados para pesquisar e interagir com o banco de dados para buscar e retornar essas informações quando necessário.
Changelog N/A
Visual evidences 🖼️
Checklist
  • Issue linked
  • Build working correctly
  • Tests created
Additional info N/A

@AtilaRocha AtilaRocha requested a review from k1nha April 9, 2024 18:16
@kvnbg
Copy link
Contributor

kvnbg commented Apr 9, 2024

@AtilaRocha, entendo que sua issue ainda está em desenvolvimento, poderia atualizar a PR para "Draft"? Quando finalizar o desenvolvimento você passa ele para "Open" novamente.

@AtilaRocha AtilaRocha marked this pull request as draft April 9, 2024 20:30
@AtilaRocha AtilaRocha marked this pull request as ready for review April 10, 2024 21:35
@AtilaRocha AtilaRocha marked this pull request as draft April 11, 2024 19:36
@AtilaRocha AtilaRocha marked this pull request as ready for review April 15, 2024 21:44
@kvnbg kvnbg self-requested a review April 16, 2024 02:55
Copy link
Contributor

@kvnbg kvnbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no api/main.go ficou faltando instanciar o OngController para poder ser usado no api/routes.go


// FindById implements interfaces.UserRepository.
func (o *OngRepository) FindById(id uuid.UUID) *entity.User {
panic("unimplemented")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ficou faltando a implementação da consulta da ONG

api/main.go Outdated
Comment on lines 42 to 47
OngUseCase := usecase.NewOngUseCase(bdOngRepo)

breedController := controllers.NewBreedController(breedUsecase)
petController := controllers.NewPetController(petUsecase)
userController := controllers.NewUserController(uusercase)
OngController := controllers.NewOngController(OngUseCase)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boa, só manteria o padrão de camelCase

dbconnection *sqlx.DB
}

// FindByID implements interfaces.OngRepository.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// FindByID implements interfaces.OngRepository.

remover esse comentário

Comment on lines 42 to 47
if err := row.Scan(
&ong.ID,
&ong.Name,
); err != nil {
return nil, fmt.Errorf("error scanning ONG: %w", err)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

porque só fazemos o scan do id e do name? a consulta de ong não deveria retornar uma ong "completa"?

p.address,
p.phone
FROM
ongs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Essa tabela não existe

Comment on lines 42 to 44
if err := row.Scan(
&ong.ID,
&ong.Name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usando o sqlx tem uma forma melhor de atribuir valores que retornam do banco

var data;
err = db.Select(&data, "SELECT * FROM table where id = ?", 1) 

Dessa forma, o que retorna do SELECT ele vai associar a entity, desde que os nomes da propriedade e das colunas da tabela sejam os mesmos

@AtilaRocha AtilaRocha requested review from kvnbg and k1nha April 24, 2024 21:01
mmaysc and others added 6 commits May 2, 2024 20:20
…cao) devhatt#58 (devhatt#109)

* wip: cuidados especiais incluidos no pet

* wip: correção

* wip: migrations

* feat: update special care

* feat: atualização de teste de req.

* fix: requested changes

* fix: requested changes on migration

* fix: update pet, use case, entity and repository

* fix: logger in update pet
* refactor: Extracted Address Interface to new file

* refactor: Extracted Address Struct to new file

* feat: Add ong_repository interface

* feat: Add ong controller

* feat: Add ong routes

* chore: changed sql to sqlx

* feat: Add ong entity

* feat: Add ong repository

* feat: Add ong usecase

* chore: Adjust ong entity

* chore: adjust ong repositories

* chore: adjust ong routes

* chore: Adjust ong usecase

* typo: Corrected Ong name

* chore: Adjust ong entity

* chore: adjust ong repositories

* chore: Adjust ong usecase

* feat: Add ONG Dto

* fix: Type longitude corrected

* chore: Adjust ong entity

* fix: Typo longitude corrected

* chore: Remove unecessary fmt.Println

* fix: Implemented logger to ong controller

* fix: Implemented logger to ong usecase

* fix: Implemented logger to ong repository

* fix: Implemented logger to ong repository

* chore: Adjust loggers

* refact: Implemented Address DTO

* refactor: Reusing userRepo inside ong usecase

* refactor: Reusing userRepo inside ong usecase

* refactor: Reorganizing entity and dtos methods to its respectives owners

* fix[refactor]: Corrected import cycle error by changing Pet.ToEntity location from dto to entity

* test: Corrected Pet tests
* feat(user): init user update endpoint

* feat(user): update user name

* feat(user): add tests

* fix(user): improve error response message trying update user

* feat(user): include more field on update user

* fix(user): adjust after rebase with main branch
@PiluVitu
Copy link
Member

PiluVitu commented May 3, 2024

@AtilaRocha sua branch foi criado de maneira certa pae ?
Parece q tu herdou alguns commits que não deveriam estar aqui

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: On PR
Development

Successfully merging this pull request may close these issues.

Consultar ONG
8 participants