Skip to content

Commit 0483dd0

Browse files
committed
Merge branch 'feature/user-id' into develop
* feature/user-id: Added user id in response
2 parents 1e08d11 + 514e072 commit 0483dd0

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

app/controllers/api/v1/authentication_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def login
1010
token = JsonWebToken.encode(user_id: @user.id)
1111
time = Time.now + 24.hours.to_i
1212
user_serializer = UserSerializer.new(@user)
13-
render json: { token: token, exp: time.strftime("%m-%d-%Y %H:%M"),
13+
render json: { id: @user.id, token: token, exp: time.strftime("%m-%d-%Y %H:%M"),
1414
username: @user.username, email: @user.email, avatar: user_serializer.avatar}, status: :ok
1515
else
1616
render json: { error: 'unauthorized' }, status: :unauthorized

spec/swagger_helper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
auth: {
7272
type: :object,
7373
properties: {
74+
id: { type: :integer },
7475
token: { type: :string },
7576
exp: { type: :string },
7677
username: { type: :string },

swagger/v1/swagger.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,8 @@ definitions:
903903
auth:
904904
type: object
905905
properties:
906+
id:
907+
type: integer
906908
token:
907909
type: string
908910
exp:

0 commit comments

Comments
 (0)