feat: workflow notification preferences#325
Merged
gusfcarvalho merged 3 commits intomainfrom Feb 18, 2026
Merged
Conversation
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new per-user workflow notification email preferences and exposes them through the existing /users/me/digest-subscription endpoints.
Changes:
- Extend
relational.UserwithtaskAvailableEmailSubscribedandtaskDailyDigestSubscribedflags (defaultfalse). - Expand GET/PUT
/users/me/digest-subscriptionto return/update the new preference fields, supporting partial updates via*boolrequest fields. - Update integration tests and generated swagger model docs to include the new fields (partially).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/service/relational/ccf_internal.go | Adds two new boolean notification preference columns to the User model. |
| internal/api/handler/users.go | Expands digest-subscription API responses/requests to include new task notification preferences and allow partial updates. |
| internal/api/handler/users_integration_test.go | Extends integration coverage to assert default values and partial-update behavior for the new fields. |
| docs/swagger.yaml | Adds new fields to the User schema definition (but digest-subscription endpoint schemas remain inconsistent). |
| docs/swagger.json | Generated swagger JSON updated for User schema fields. |
| docs/docs.go | Generated swagger Go template updated for User schema fields. |
Comments suppressed due to low confidence (1)
internal/api/handler/users.go:448
- The summary/description for these endpoints say they manage only the "digest email subscription", but the handler now returns/updates additional workflow notification preferences (
taskAvailableEmailSubscribed,taskDailyDigestSubscribed). Please update the endpoint descriptions (and/or consider a more general route/name) so the API contract is not misleading.
// @Summary Get digest subscription status
// @Description Gets the current user's digest email subscription status
// @Tags Users
// @Produce json
// @Success 200 {object} handler.GenericDataResponse[handler.UserHandler.GetDigestSubscription.digestSubscriptionResponse]
// @Failure 401 {object} api.Error
// @Failure 404 {object} api.Error
// @Failure 500 {object} api.Error
// @Security OAuth2Password
// @Router /users/me/digest-subscription [get]
func (h *UserHandler) GetDigestSubscription(ctx echo.Context) error {
userClaims := ctx.Get("user").(*authn.UserClaims)
email := userClaims.Subject
var user relational.User
if err := h.db.Where("email = ?", email).First(&user).Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return ctx.JSON(404, api.NewError(err))
}
h.sugar.Errorw("Failed to get user by email", "error", err)
return ctx.JSON(500, api.NewError(err))
}
return ctx.JSON(200, GenericDataResponse[digestSubscriptionResponse]{
Data: digestSubscriptionResponse{
Subscribed: user.DigestSubscribed,
TaskAvailableEmailSubscribed: user.TaskAvailableEmailSubscribed,
TaskDailyDigestSubscribed: user.TaskDailyDigestSubscribed,
},
})
}
// UpdateDigestSubscription godoc
//
// @Summary Update digest subscription status
// @Description Updates the current user's digest email subscription status
// @Tags Users
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.