Refactor Import placeholder push reference service
What does this MR do and why?
Refactor the service to log errors, handle composite key and raise error in development environment.
The service currently isn't working on production. This MR is part of a series of MRs that will integrate user contribution mapping in Direct Transfer.
Related to: #443557 (closed)
MR that implemented the service: !156704 (merged)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
The service is not used by any class, so to test it, we need to use the Rails console. Here are some examples of how to use the service:
MergeRequest reference
Import::PlaceholderReferences::PushService.from_record(import_source: Import::SOURCE_DIRECT_TRANSFER, import_uid: 1, source_user: Import::SourceUser.first, record: MergeRequest.new(id: 1), user_reference_column: :author_id).execute
IssueAssignee reference
Import::PlaceholderReferences::PushService.from_record(import_source: Import::SOURCE_DIRECT_TRANSFER, import_uid: 1, source_user: Import::SourceUser.first, record: IssueAssignee.new(user_id: 1, issue_id: 2), user_reference_column: :user_id).execute
Invalid reference
Import::PlaceholderReferences::PushService.from_record(import_source: Import::SOURCE_DIRECT_TRANSFER, import_uid: 1, source_user: Import::SourceUser.first, record: IssueAssignee.new(issue_id: 2), user_reference_column: :user_id).execute