From 1e62510321891ae5b51ed52443afa08e27a5a119 Mon Sep 17 00:00:00 2001 From: Yared Yemane Date: Mon, 18 May 2026 00:16:10 -0700 Subject: [PATCH] Always serialize active_subscription on profile responses. Null encodes when there is no active plan so clients see explicit subscription state; Swagger regenerated and GET /users description updated accordingly. Co-authored-by: Cursor --- docs/docs.go | 2 +- docs/swagger.json | 2 +- docs/swagger.yaml | 4 ++-- internal/domain/user.go | 2 +- internal/web_server/handlers/user.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index b644d68..32f77fe 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -8436,7 +8436,7 @@ const docTemplate = `{ }, "/api/v1/users": { "get": { - "description": "Get users with optional filters. Each user may include active_subscription when they have a current ACTIVE, non-expired plan.", + "description": "Get users with optional filters. Each user includes active_subscription: an object when they have a current ACTIVE, non-expired plan, otherwise null.", "consumes": [ "application/json" ], diff --git a/docs/swagger.json b/docs/swagger.json index d0094b4..441eac1 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -8428,7 +8428,7 @@ }, "/api/v1/users": { "get": { - "description": "Get users with optional filters. Each user may include active_subscription when they have a current ACTIVE, non-expired plan.", + "description": "Get users with optional filters. Each user includes active_subscription: an object when they have a current ACTIVE, non-expired plan, otherwise null.", "consumes": [ "application/json" ], diff --git a/docs/swagger.yaml b/docs/swagger.yaml index a1538d8..1fbe3a4 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -8017,8 +8017,8 @@ paths: get: consumes: - application/json - description: Get users with optional filters. Each user may include active_subscription - when they have a current ACTIVE, non-expired plan. + description: 'Get users with optional filters. Each user includes active_subscription: + an object when they have a current ACTIVE, non-expired plan, otherwise null.' parameters: - description: Role filter in: query diff --git a/internal/domain/user.go b/internal/domain/user.go index 79f251d..9529f2c 100644 --- a/internal/domain/user.go +++ b/internal/domain/user.go @@ -121,7 +121,7 @@ type UserProfileResponse struct { CreatedAt time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at,omitempty"` - ActiveSubscription *UserSubscriptionSummary `json:"active_subscription,omitempty"` + ActiveSubscription *UserSubscriptionSummary `json:"active_subscription"` } type UserFilter struct { diff --git a/internal/web_server/handlers/user.go b/internal/web_server/handlers/user.go index a91bbbe..9721852 100644 --- a/internal/web_server/handlers/user.go +++ b/internal/web_server/handlers/user.go @@ -423,7 +423,7 @@ func (h *Handler) CheckUserPending(c *fiber.Ctx) error { // GetAllUsers godoc // @Summary Get all users -// @Description Get users with optional filters. Each user may include active_subscription when they have a current ACTIVE, non-expired plan. +// @Description Get users with optional filters. Each user includes active_subscription: an object when they have a current ACTIVE, non-expired plan, otherwise null. // @Tags user // @Accept json // @Produce json