Add Direct Transfer entity failures API
What does this MR do and why?
This MR:
- Adds a new Direct Transfer
failures
:import_id/entities/:entity_id/failures
API endpoint. Currentlyentities
:import_id/entities/:entity_id
endpoint hasfailures
list included in the endpoint, but we want to be able to view failures via a separate endpoint - Adds
source_url
&source_title
fields to BulkImports::Failure model in order to capture record's title and source url, if available -
source_url
is being built dynamically for specific types of relations, ifiid
is present for the failed to import object
Migration Output
main: == 20231024142236 AddFieldsToBulkImportFailures: migrating ====================
main: -- add_column(:bulk_import_failures, :source_url, :text)
main: -> 0.0020s
main: -- add_column(:bulk_import_failures, :source_title, :text)
main: -> 0.0006s
main: == 20231024142236 AddFieldsToBulkImportFailures: migrated (0.0074s) ===========
main: == 20231024143457 AddTextLimitToBulkImportFailures: migrating =================
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE bulk_import_failures\nADD CONSTRAINT check_e035a720ad\nCHECK ( char_length(source_url) <= 255 )\nNOT VALID;\n")
main: -> 0.0010s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0002s
main: -- execute("ALTER TABLE bulk_import_failures VALIDATE CONSTRAINT check_e035a720ad;")
main: -> 0.0006s
main: -- execute("RESET statement_timeout")
main: -> 0.0005s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE bulk_import_failures\nADD CONSTRAINT check_74414228d4\nCHECK ( char_length(source_title) <= 255 )\nNOT VALID;\n")
main: -> 0.0005s
main: -- execute("ALTER TABLE bulk_import_failures VALIDATE CONSTRAINT check_74414228d4;")
main: -> 0.0003s
main: == 20231024143457 AddTextLimitToBulkImportFailures: migrated (0.1621s) ========
Mentions #428016 (closed)
Screenshots or screen recordings
failures
API endpoint output
bulk_import_failures
db table
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by George Koltsov