Skip to content

Conversation

@tars919
Copy link

@tars919 tars919 commented Jan 17, 2026

Description

This PR is documenting the implementation for the get hotels id ticket to retrieve a single hotel by its given UUID.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (code improvement without changing functionality)
  • Documentation update
  • Configuration/infrastructure change
  • Performance improvement
  • Test coverage improvement

Related Issue(s)

Closes #43

What Changed?

  • Added the hotel model following the database schema
  • Added method getbyid to implement hotelrepository
  • Created HotelHandler with UUID validation
  • Added tests file to verify functionality
  • Registered route

Testing & Validation

How to Test

  1. Made a test file called hotels_test.go for the handler
  2. All the unit tests here passed
  3. Verified proper error handling as well

Test Coverage

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing completed
  • Edge cases considered and tested

Screenshots/Recordings

Unfinished Work & Known Issues

  • None, this PR is complete and production-ready
  • The following items are intentionally deferred:



Notes & Nuances

  • First time submitting a PR so not sure if I did this correctly, let me know any issues!


Deployment Considerations

  • No special deployment considerations
  • Database migrations required (see backend/supabase/migrations/)
  • Environment variables added/changed (document in PR or update .env.example)
  • Breaking API changes (requires client updates)

Pre-Merge Checklist

Code Quality

  • Code follows the project's style guidelines and conventions
  • Self-review completed (I've reviewed my own code for obvious issues)
  • No debugging code, console logs, or commented-out code left behind
  • No merge conflicts with the base branch
  • Meaningful commit messages that explain the "why"

Testing & CI

  • All CI checks are passing
  • All new and existing tests pass locally
  • Test coverage hasn't decreased (or decrease is justified)
  • Linting passes without errors

Documentation

  • Code is self-documenting or includes helpful comments for complex logic
  • API documentation updated (if backend endpoints changed)
  • Type definitions are accurate and up-to-date

Security & Performance

  • No sensitive data (passwords, tokens, API keys, PII, etc.) committed
  • Security implications considered and addressed
  • Performance impact evaluated (no obvious performance regressions)

Reviewer Notes

Areas needing extra attention:

  • Questions for reviewers: ...

  • Concerns: ...

@danctila danctila self-requested a review January 17, 2026 17:43
Copy link
Contributor

@danctila danctila left a comment

Choose a reason for hiding this comment

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

overall great stuff @tars919 🎉. couple of notes and a few minor changes requested mostly to naming.

good:

  • error handling (400, 404, 500) 🙏
  • UUID validation is correct, test coverage is epic
  • existing repo patterns

changes requested:

  • naming conventions (GetById -> FindByID in repository)
  • move HotelRepository interface from storage.go to repo_types.go
  • Swagger godoc comments to handler method


//Interface for hotel repository -> used in testing later
type HotelRepository interface {
GetByID(ctx context.Context, id string) (*models.Hotel, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be FindByID per naming convention (repository methods for GET should use find prefix). Applies to both the interface and implementation

return &HotelRepository{db: db}
}

func (r *HotelRepository) GetByID(ctx context.Context, id string) (*models.Hotel, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Method should be FindByID per naming convention

DB: db,
DevsRepository: repository.NewDevsRepository(db),
RequestRepository: repository.NewRequestsRepo(db),
//added for hotel
Copy link
Contributor

Choose a reason for hiding this comment

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

remove cmt

Comment on lines 18 to 20
type HotelRepository interface {
GetByID(ctx context.Context, id string) (*models.Hotel, error)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
type HotelRepository interface {
GetByID(ctx context.Context, id string) (*models.Hotel, error)
}
type HotelRepository interface {
FindByID(ctx context.Context, id string) (*models.Hotel, error)
}

helloHandler := handler.NewHelloHandler()
devsHandler := handler.NewDevsHandler(repository.NewDevsRepository(repo.DB))
reqsHandler := handler.NewRequestsHandler(repository.NewRequestsRepo(repo.DB))
hotelHandler := handler.NewHotelHandler(repository.NewHotelRepository(repo.DB)) //for hotel
Copy link
Contributor

Choose a reason for hiding this comment

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

remove cmt

r.Post("/", reqsHandler.CreateRequest)
})

// hotel routes
Copy link
Contributor

Choose a reason for hiding this comment

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

capitalize cmt

- changed naming conventions
- added swagger comments
- moved interface
Copy link
Contributor

@danctila danctila left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/GET hotels/id

3 participants