This pull request streamlines the way default metadata API sources are seeded in the application by moving this logic from the application startup code into a dedicated database migration. Additionally, it makes a minor refactor in the SearchService to simplify a method signature and its implementation.
Migration and Database Initialization Changes:
- Added a new migration
AddDefaultMetadataSourcesthat inserts default metadata API sources ("Audimeta" and "Audnexus") directly into theApiConfigurationstable if they do not already exist, and removes them on rollback. This ensures these sources are always present after migrations and prevents duplicate entries. - Removed the manual seeding logic for default metadata API sources from the startup code in
Program.cs, relying instead on the migration to handle this automatically. This reduces code complexity and centralizes data initialization.
Code Refactoring:
- Refactored
ConvertMetadataToSearchResultAsyncinSearchService.csto be a synchronous method that returns aTask<SearchResult>usingTask.FromResult, instead of being marked asasync. This simplifies the method since it does not perform any asynchronous operations. [1] [2] [3]Removes runtime seeding of Audimeta and Audnexus metadata API sources from Program.cs and adds their creation to a new EF migration. Also refactors SearchService to make ConvertMetadataToSearchResultAsync synchronous, returning a Task directly.
Automated canary build