Skip to content

feat: workflow notification preferences#325

Merged
gusfcarvalho merged 3 commits intomainfrom
gc-feat-workflow-notification-preferences
Feb 18, 2026
Merged

feat: workflow notification preferences#325
gusfcarvalho merged 3 commits intomainfrom
gc-feat-workflow-notification-preferences

Conversation

@gusfcarvalho
Copy link
Contributor

No description provided.

Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Copilot AI review requested due to automatic review settings February 18, 2026 14:29
Copy link
Contributor

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 new per-user workflow notification email preferences and exposes them through the existing /users/me/digest-subscription endpoints.

Changes:

  • Extend relational.User with taskAvailableEmailSubscribed and taskDailyDigestSubscribed flags (default false).
  • Expand GET/PUT /users/me/digest-subscription to return/update the new preference fields, supporting partial updates via *bool request 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>
@gusfcarvalho gusfcarvalho merged commit e005f5b into main Feb 18, 2026
6 of 8 checks passed
@gusfcarvalho gusfcarvalho deleted the gc-feat-workflow-notification-preferences branch February 18, 2026 15:48
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