Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR refactors the template table seeding logic by extracting table creation logic into reusable helper functions and adds a new public method for seeding template tables for a given database.
- Extracted base template table creation logic into
seedBaseTemplateTableshelper function - Extracted additional template table creation logic into
seedAdditionalTemplateTableshelper function - Added new
seedTemplateTablesForDatabasemethod that seeds both base and additional template tables for a specified database
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile OverviewGreptile SummaryExtracted template table seeding logic into reusable helper functions Key changes:
Critical issue found:
Confidence Score: 1/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client
participant Service as seedTemplateTablesService
participant AuthFunc as authenticateAdmin
participant ProjectFunc as getProjectDatabaseId
participant BaseFunc as seedBaseTables
participant AdditionalFunc as seedAdditionalTables
participant TableAPIs as Table Creation APIs
Note over Client,TableAPIs: New Method: seedTemplateTablesForDatabase
Client->>Service: seedTemplateTablesForDatabase(dbId, credentials)
Service->>BaseFunc: seedBaseTemplateTables(dbId, credentials)
BaseFunc->>TableAPIs: createBusinessUnitsTable
TableAPIs-->>BaseFunc: buTable
BaseFunc->>TableAPIs: createTagOwnerMappingTable
BaseFunc->>TableAPIs: createIdleEbsVolumesToDeleteTable
BaseFunc->>TableAPIs: createResourceBuTagAssignmentTable
BaseFunc-->>Service: Done
Service->>AdditionalFunc: seedAdditionalTemplateTables(dbId, credentials)
AdditionalFunc->>TableAPIs: createOpportunitiesTable
AdditionalFunc->>TableAPIs: createAggregatedCostsTable
AdditionalFunc->>TableAPIs: createKnownCostTypesByApplicationTable
AdditionalFunc->>TableAPIs: createAutoInstancesShutdownTable
AdditionalFunc-->>Service: Done
Service-->>Client: Complete
Note over Client,TableAPIs: Refactored: createBaseTemplateTables
Client->>Service: createBaseTemplateTables()
Service->>AuthFunc: authenticate()
AuthFunc-->>Service: credentials
Service->>ProjectFunc: getDatabaseId()
ProjectFunc-->>Service: dbId
Service->>BaseFunc: seedBaseTemplateTables(dbId, credentials)
BaseFunc-->>Service: Done
Service-->>Client: Complete
|
|
| throw new Error(`No project found for user: ${email}`); | ||
| } | ||
|
|
||
| return project; |
There was a problem hiding this comment.
doesnt it need to be return project.tablesDatabaseId?
There was a problem hiding this comment.
this return stmt is for getAdminUserProject helper.
We used to have getProjectTablesDatabaseId helper (in packages/server/api/src/app/openops-tables/template-tables/seed-tables-for-templates.ts).



Part of OPS-3009.