11import { AppSystemProp , logger , system } from '@openops/server-shared' ;
22import { projectService } from '../../project/project-service' ;
33import { userService } from '../../user/user-service' ;
4+ import { authenticateAdminUserInOpenOpsTables } from '../auth-admin-tables' ;
45import { openopsTables } from '../index' ;
56import { createAggregatedCostsTable } from './create-aggregated-costs-table' ;
67import { createAutoInstancesShutdownTable } from './create-auto-instances-shutdown-table' ;
@@ -33,8 +34,7 @@ const getProjectTablesDatabaseId = async (): Promise<number> => {
3334
3435export const seedTemplateTablesService = {
3536 async createBaseTemplateTables ( ) {
36- const { token } =
37- await openopsTables . authenticateAdminUserInOpenOpsTables ( ) ;
37+ const { token } = await authenticateAdminUserInOpenOpsTables ( ) ;
3838 const databaseId = await getProjectTablesDatabaseId ( ) ;
3939
4040 const buTable = await createBusinessUnitsTable ( databaseId , token ) ;
@@ -50,8 +50,7 @@ export const seedTemplateTablesService = {
5050 } ,
5151
5252 async createOpportunityTemplateTable ( ) {
53- const { token } =
54- await openopsTables . authenticateAdminUserInOpenOpsTables ( ) ;
53+ const { token } = await authenticateAdminUserInOpenOpsTables ( ) ;
5554 const databaseId = await getProjectTablesDatabaseId ( ) ;
5655
5756 await createOpportunitiesTable ( token , databaseId ) ;
@@ -60,16 +59,14 @@ export const seedTemplateTablesService = {
6059 } ,
6160
6261 async createAggregatedCostsTable ( ) {
63- const { token } =
64- await openopsTables . authenticateAdminUserInOpenOpsTables ( ) ;
62+ const { token } = await authenticateAdminUserInOpenOpsTables ( ) ;
6563 const databaseId = await getProjectTablesDatabaseId ( ) ;
6664
6765 await createAggregatedCostsTable ( databaseId , token ) ;
6866 } ,
6967
7068 async createKnownCostTypesByApplicationTable ( ) {
71- const { token } =
72- await openopsTables . authenticateAdminUserInOpenOpsTables ( ) ;
69+ const { token } = await authenticateAdminUserInOpenOpsTables ( ) ;
7370 const databaseId = await getProjectTablesDatabaseId ( ) ;
7471
7572 await createKnownCostTypesByApplicationTable ( token , databaseId ) ;
@@ -78,8 +75,7 @@ export const seedTemplateTablesService = {
7875 } ,
7976
8077 async createAutoInstancesShutdownTable ( ) : Promise < void > {
81- const { token } =
82- await openopsTables . authenticateAdminUserInOpenOpsTables ( ) ;
78+ const { token } = await authenticateAdminUserInOpenOpsTables ( ) ;
8379 const databaseId = await getProjectTablesDatabaseId ( ) ;
8480
8581 await createAutoInstancesShutdownTable ( token , databaseId ) ;
0 commit comments