Skip to content

feat: get shift priorities endpoint#135

Merged
SvenMokveldje merged 1 commit intodevelopfrom
feature/get-shift-group-priority-endpoint
Mar 24, 2026
Merged

feat: get shift priorities endpoint#135
SvenMokveldje merged 1 commit intodevelopfrom
feature/get-shift-group-priority-endpoint

Conversation

@SvenMokveldje
Copy link
Collaborator

This adds, as I forgot it, an endpoint to retrieve all priorities for a specific shift group.

Types of changes

  • New feature (non-breaking change which adds functionality)

This adds, as I forgot it, an endpoint to retrieve all priorities for a
specific shift group.
Copilot AI review requested due to automatic review settings March 24, 2026 14:28
@SvenMokveldje SvenMokveldje merged commit c8281b8 into develop Mar 24, 2026
4 checks passed
@SvenMokveldje SvenMokveldje deleted the feature/get-shift-group-priority-endpoint branch March 24, 2026 14:29
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

Adds a missing ShiftGroup API endpoint to retrieve all user priorities for a given shift group, and regenerates OpenAPI + TypeScript client artifacts accordingly.

Changes:

  • Add GET /roster/shift-groups/{id}/priority handler + service method.
  • Rename the update DTO from GroupUpdatePriorityParam to GroupPriorityUpdateParam across server + OpenAPI + client.
  • Regenerate Swagger artifacts and the TS client/docs to include the new endpoint and renamed DTO.

Reviewed changes

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

Show a summary per file
File Description
internal/roster/service.go Adds service interface + implementation for fetching shift group priorities; updates update method param type.
internal/roster/handler.go Registers new GET route + handler; switches CreateShiftGroup binding to ShouldBindBodyWith; updates update DTO usage.
internal/roster/dto.go Renames the priority update request DTO type.
internal/models/roster.go Adds Swagger naming comment for GroupPriority.
docs/swagger.yaml Adds GET priority endpoint; renames DTO schema reference.
docs/swagger.json Adds GET priority endpoint; renames DTO schema reference.
docs/docs.go Regenerated embedded Swagger template with new endpoint + renamed DTO.
client/src/docs/ShiftGroupApi.md Adds client docs for new endpoint; updates DTO name references.
client/src/docs/GroupPriorityUpdateParam.md Adds generated doc page for renamed DTO.
client/src/api.ts Adds generated client method getShiftGroupPriorities; renames DTO type usage.
client/src/.openapi-generator/FILES Updates generated file manifest to new DTO doc filename.

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

g.GET("/shift-groups/:id", h.GetShiftGroup)

g.GET("/shift-groups/:id/priority", requireShiftGroupOrganRoleParams(db, models.RoleAdmin), h.GetShiftGroupPriorities)
g.PUT("/shift-groups/:id/priority", requireShiftGroupOrganRoleParams(db, models.RoleAdmin))
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.

Route registration for PUT /shift-groups/:id/priority is missing the actual handler (UpdateShiftGroupPriority). As written, only the access-check middleware runs and the request will fall through with an empty 200 response. Register the PUT route with h.UpdateShiftGroupPriority after the middleware.

Suggested change
g.PUT("/shift-groups/:id/priority", requireShiftGroupOrganRoleParams(db, models.RoleAdmin))
g.PUT("/shift-groups/:id/priority", requireShiftGroupOrganRoleParams(db, models.RoleAdmin), h.UpdateShiftGroupPriority)

Copilot uses AI. Check for mistakes.
Comment on lines +234 to +240
func (s *service) GetShiftGroupPriorities(groupID uint) ([]*models.ShiftGroupPriority, error) {
var priorities []*models.ShiftGroupPriority
if err := s.db.Find(&priorities).Error; err != nil {
return nil, err
}

return priorities, 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 ignores the provided groupID and currently returns priorities for all shift groups. This can leak data across organs and will also grow unbounded as the table grows. Add a WHERE filter on shift_group_id = groupID (and consider an explicit ORDER BY if you want deterministic results).

Copilot uses AI. Check for mistakes.

// GetShiftGroupPriorities
//
// @Summary Get a shift group priorities for a shift group
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.

The Swagger summary text is grammatically incorrect ("Get a shift group priorities for a shift group"). Since this string is propagated into generated swagger/docs and the TS client docs, consider changing it to something like "Get shift group priorities" (or similar) in the handler annotation.

Suggested change
// @Summary Get a shift group priorities for a shift group
// @Summary Get shift group priorities

Copilot uses AI. Check for mistakes.
Comment on lines 12 to +13
docs/GEWISRoosterInternalModelsOrganRole.md
docs/GroupUpdatePriorityParam.md
docs/GroupPriorityUpdateParam.md
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.

The generator file list was updated to reference GroupPriorityUpdateParam.md, but the old generated markdown (docs/GroupUpdatePriorityParam.md) still exists in the repo (it is no longer referenced here). Consider removing the old file to avoid stale/duplicated client docs.

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