feat: add valuations API endpoints for managing account reconciliations (#745)

* feat: add valuations API endpoints for managing account reconciliations

* refactor: formatting

* fix: make account extraction clearer

* feat: validation and error handling improvements

* feat: transaction

* feat: error handling

* Add API documentation LLM context

* Make it easier for people

* feat: transaction in creation

* feat: add OpenAPI spec for Valuations API

* fix: update notes validation to check for key presence

* Prevent double render

* All other docs use `apiKeyAuth`

* More `apiKeyAuth`

* Remove testing assertions from API doc specs

* fix: correct valuation entry references

---------

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
This commit is contained in:
Pere Montpeó
2026-01-30 18:54:15 +01:00
committed by GitHub
parent 02cd84568e
commit 9f5fdd4d13
16 changed files with 1014 additions and 168 deletions

View File

@@ -83,11 +83,7 @@ RSpec.describe 'API V1 Chats', type: :request do
response '200', 'chats listed' do
schema '$ref' => '#/components/schemas/ChatCollection'
run_test! do |response|
payload = JSON.parse(response.body)
expect(payload.fetch('chats')).to be_present
expect(payload.fetch('pagination')).to include('page', 'per_page', 'total_count', 'total_pages')
end
run_test!
end
response '403', 'AI features disabled' do
@@ -132,11 +128,7 @@ RSpec.describe 'API V1 Chats', type: :request do
response '201', 'chat created' do
schema '$ref' => '#/components/schemas/ChatDetail'
run_test! do |response|
payload = JSON.parse(response.body)
chat_record = Chat.find(payload.fetch('id'))
expect(chat_record.messages.first.content).to eq('Can you help me plan a summer trip?')
end
run_test!
end
response '422', 'validation error' do
@@ -162,10 +154,7 @@ RSpec.describe 'API V1 Chats', type: :request do
response '200', 'chat retrieved' do
schema '$ref' => '#/components/schemas/ChatDetail'
run_test! do |response|
payload = JSON.parse(response.body)
expect(payload.fetch('messages').size).to be >= 1
end
run_test!
end
response '404', 'chat not found' do
@@ -197,10 +186,7 @@ RSpec.describe 'API V1 Chats', type: :request do
response '200', 'chat updated' do
schema '$ref' => '#/components/schemas/ChatDetail'
run_test! do |response|
payload = JSON.parse(response.body)
expect(payload.fetch('title')).to eq('Updated budget plan')
end
run_test!
end
response '404', 'chat not found' do
@@ -269,10 +255,7 @@ RSpec.describe 'API V1 Chats', type: :request do
response '201', 'message created' do
schema '$ref' => '#/components/schemas/MessageResponse'
run_test! do |response|
payload = JSON.parse(response.body)
expect(payload.fetch('ai_response_status')).to eq('pending')
end
run_test!
end
response '404', 'chat not found' do
@@ -310,10 +293,7 @@ RSpec.describe 'API V1 Chats', type: :request do
allow_any_instance_of(AssistantMessage).to receive(:valid?).and_return(true)
end
run_test! do |response|
payload = JSON.parse(response.body)
expect(payload.fetch('message')).to eq('Retry initiated')
end
run_test!
end
response '404', 'chat not found' do