Skip to content

fix: shift group priorities endpoints#136

Merged
SvenMokveldje merged 1 commit intodevelopfrom
fix/shift-group-priorities-endpoints
Mar 24, 2026
Merged

fix: shift group priorities endpoints#136
SvenMokveldje merged 1 commit intodevelopfrom
fix/shift-group-priorities-endpoints

Conversation

@SvenMokveldje
Copy link
Collaborator

This fixes the last issues with the shift group priorities endpints. Such as not applying the correct filters and not adding the handler function to the route.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

This fixes the last issues with the shift group priorities endpints.
Such as not applying the correct filters and not adding the handler
function to the route.
Copilot AI review requested due to automatic review settings March 24, 2026 14:52
@SvenMokveldje SvenMokveldje merged commit 98b4fd3 into develop Mar 24, 2026
2 checks passed
@SvenMokveldje SvenMokveldje deleted the fix/shift-group-priorities-endpoints branch March 24, 2026 14:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes the shift group priorities API so it correctly filters priorities per shift group and properly wires the update handler into the router.

Changes:

  • Filter GetShiftGroupPriorities by shift_group_id instead of returning all priority records.
  • Register the PUT /roster/shift-groups/:id/priority route with UpdateShiftGroupPriority.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
internal/roster/service.go Applies the correct DB filter for shift-group priorities; simplifies return from update method.
internal/roster/handler.go Wires the missing PUT handler; adds a debug-style log on successful update response.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return
}

log.Print(groupPriority)
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

Avoid logging the full groupPriority object on every successful request; this adds noisy logs and may inadvertently expose identifiers in production. If logging is needed, use a structured log at an appropriate level (e.g., debug) with minimal fields, or remove this statement entirely.

Suggested change
log.Print(groupPriority)

Copilot uses AI. Check for mistakes.
func (s *service) GetShiftGroupPriorities(groupID uint) ([]*models.ShiftGroupPriority, error) {
var priorities []*models.ShiftGroupPriority
if err := s.db.Find(&priorities).Error; err != nil {
if err := s.db.Where("shift_group_id = ?", groupID).Find(&priorities).Error; err != nil {
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

GetShiftGroupPriorities previously returned all priorities and now applies a shift_group_id filter. Given the existing service test suite in this package, please add/adjust unit tests to assert this method only returns priorities for the requested groupID (and not priorities from other shift groups).

Copilot uses AI. Check for mistakes.
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.

2 participants