mirror of
https://github.com/we-promise/sure.git
synced 2026-04-22 21:44:11 +00:00
Move AI enable endpoint to user scope
Replace /api/v1/auth/enable_ai with /api/v1/user/enable_ai by moving the action into Api::V1::UsersController, updating Flutter client calls, tests, and OpenAPI docs.
This commit is contained in:
@@ -49,6 +49,9 @@ class Api::V1::AuthControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal "newuser@example.com", response_data["user"]["email"]
|
||||
assert_equal "New", response_data["user"]["first_name"]
|
||||
assert_equal "User", response_data["user"]["last_name"]
|
||||
new_user = User.find(response_data["user"]["id"])
|
||||
assert_equal new_user.ui_layout, response_data["user"]["ui_layout"]
|
||||
assert_equal new_user.ai_enabled?, response_data["user"]["ai_enabled"]
|
||||
|
||||
# OAuth token assertions
|
||||
assert response_data["access_token"].present?
|
||||
@@ -58,8 +61,8 @@ class Api::V1::AuthControllerTest < ActionDispatch::IntegrationTest
|
||||
assert response_data["created_at"].present?
|
||||
|
||||
# Verify the device was created
|
||||
new_user = User.find(response_data["user"]["id"])
|
||||
device = new_user.mobile_devices.first
|
||||
created_user = User.find(response_data["user"]["id"])
|
||||
device = created_user.mobile_devices.first
|
||||
assert_equal @device_info[:device_id], device.device_id
|
||||
assert_equal @device_info[:device_name], device.device_name
|
||||
assert_equal @device_info[:device_type], device.device_type
|
||||
@@ -227,6 +230,8 @@ class Api::V1::AuthControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_equal user.id.to_s, response_data["user"]["id"]
|
||||
assert_equal user.email, response_data["user"]["email"]
|
||||
assert_equal user.ui_layout, response_data["user"]["ui_layout"]
|
||||
assert_equal user.ai_enabled?, response_data["user"]["ai_enabled"]
|
||||
|
||||
# OAuth token assertions
|
||||
assert response_data["access_token"].present?
|
||||
@@ -439,4 +444,6 @@ class Api::V1::AuthControllerTest < ActionDispatch::IntegrationTest
|
||||
response_data = JSON.parse(response.body)
|
||||
assert_equal "Refresh token is required", response_data["error"]
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user