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:
37
spec/requests/api/v1/users_spec.rb
Normal file
37
spec/requests/api/v1/users_spec.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'swagger_helper'
|
||||
|
||||
RSpec.describe 'API V1 Users', type: :request do
|
||||
path '/api/v1/user/enable_ai' do
|
||||
patch 'Enable AI features for the authenticated user' do
|
||||
tags 'Users'
|
||||
consumes 'application/json'
|
||||
produces 'application/json'
|
||||
security [{ apiKeyAuth: [] }]
|
||||
|
||||
response '200', 'ai enabled' do
|
||||
schema type: :object,
|
||||
properties: {
|
||||
user: {
|
||||
type: :object,
|
||||
properties: {
|
||||
id: { type: :string, format: :uuid },
|
||||
email: { type: :string },
|
||||
first_name: { type: :string, nullable: true },
|
||||
last_name: { type: :string, nullable: true },
|
||||
ui_layout: { type: :string, enum: %w[dashboard intro] },
|
||||
ai_enabled: { type: :boolean }
|
||||
}
|
||||
}
|
||||
}
|
||||
run_test!
|
||||
end
|
||||
|
||||
response '401', 'unauthorized' do
|
||||
schema '$ref' => '#/components/schemas/ErrorResponse'
|
||||
run_test!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user