Add contractors by residence endpoint and Bruno API collection
- Add GET /contractors/by-residence/:residence_id/ endpoint - Create comprehensive Bruno API collection (89 endpoints) - Collection covers all API endpoints with Local and Dev environments 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -294,6 +294,25 @@ func (s *ContractorService) GetContractorTasks(contractorID, userID uint) ([]res
|
||||
return responses.NewTaskListResponse(tasks), nil
|
||||
}
|
||||
|
||||
// ListContractorsByResidence lists all contractors for a specific residence
|
||||
func (s *ContractorService) ListContractorsByResidence(residenceID, userID uint) ([]responses.ContractorResponse, error) {
|
||||
// Check user has access to the residence
|
||||
hasAccess, err := s.residenceRepo.HasAccess(residenceID, userID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !hasAccess {
|
||||
return nil, ErrResidenceAccessDenied
|
||||
}
|
||||
|
||||
contractors, err := s.contractorRepo.FindByResidence(residenceID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return responses.NewContractorListResponse(contractors), nil
|
||||
}
|
||||
|
||||
// GetSpecialties returns all contractor specialties
|
||||
func (s *ContractorService) GetSpecialties() ([]responses.ContractorSpecialtyResponse, error) {
|
||||
specialties, err := s.contractorRepo.GetAllSpecialties()
|
||||
|
||||
Reference in New Issue
Block a user