feat: add streaks to user stats endpoint (#891)

* add api to streaks

* swaggerize
This commit is contained in:
Echo 2026-02-02 12:18:25 -05:00 committed by GitHub
parent f8034f87db
commit 8edd8404d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View file

@ -126,7 +126,8 @@ class Api::V1::StatsController < ApplicationController
render json: {
data: summary,
trust_factor: trust_info
trust_factor: trust_info,
streak: @user.streak_days
}
end

View file

@ -249,7 +249,8 @@ RSpec.describe 'Api::V1::Stats', type: :request do
trust_level: { type: :string, example: 'blue' },
trust_value: { type: :integer, example: 3 }
}
}
},
streak: { type: :integer, example: 7, description: 'Number of consecutive days the user has coded' }
}
run_test!
end

View file

@ -3140,6 +3140,10 @@ paths:
trust_value:
type: integer
example: 3
streak:
type: integer
example: 7
description: Number of consecutive days the user has coded
'403':
description: forbidden
content: