Skip to content

Conversation

@narrowizard
Copy link
Collaborator

  • Create or update accounts for creator and assignee
  • Link accounts to issues in the database
  • Add account data to issues_output.csv
  • Verify account data with snapshot_tables/accounts.csv

#8400

⚠️ Pre Checklist

Please complete ALL items in this checklist, and remove before submitting

  • I have read through the Contributing Documentation.
  • I have added relevant tests.
  • I have added relevant documentation.
  • I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc.

Summary

What does this PR do?

Does this close any open issues?

Closes xx

Screenshots

Include any relevant screenshots here.

Other Information

Any other information that is important to this PR.

- Create or update accounts for creator and assignee
- Link accounts to issues in the database
- Add account data to issues_output.csv
- Verify account data with snapshot_tables/accounts.csv

#8400
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. component/plugins This issue or PR relates to plugins pr-type/feature-development This PR is to develop a new feature labels Apr 23, 2025
d4x1
d4x1 previously approved these changes Apr 24, 2025
var err errors.Error
var id string
if record["id"] == nil {
idValue, ok := record["id"]
Copy link
Contributor

@d4x1 d4x1 Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen some duplicated codes like:

idValue, ok := record["id"]
if !ok || idValue == nil {
	return errors.Default.New("record without id")
}
id, ok := idValue.(string)
if !ok || id == "" {
	return errors.Default.New("invalid or empty id")
}

I think we can simplify a function.

Copy link
Collaborator Author

@narrowizard narrowizard Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. The relevant logic has been extracted into a getStringField function, and a test case has been added for it.

return "", nil // Return empty ID if name is empty, no error needed here.
}
now := time.Now()
accountId := fmt.Sprintf("csv:CsvAccount:0:%s", accountName)
Copy link
Contributor

@d4x1 d4x1 Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 0 in csv:CsvAccount:0:%s correct? I am not sure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSV is not a real data source within the system; there are no plugins or connections specifically for CSV. This ID is a mock, designed to match the format of other entities, so all data obtained through the API (which is in CSV format) shares this single "connection".

…d handling

- Add getStringField function to extract and validate string fields from records
- Use getStringField to replace repetitive code in issueHandlerFactory
- Add unit tests for getStringField to ensure its correctness

#8400
@d4x1 d4x1 merged commit 2b8dc32 into main Apr 24, 2025
10 checks passed
@d4x1 d4x1 deleted the feat-8400 branch April 24, 2025 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/plugins This issue or PR relates to plugins pr-type/feature-development This PR is to develop a new feature size:L This PR changes 100-499 lines, ignoring generated files.

2 participants