diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index 6d553fd..d0c572a 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -17,9 +17,7 @@ export class CatalogController { async catalogAll(@Body() body) { console.log(`/catalog`, 'ON CATALOG ALL ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.catalogAll(body); + const res = await this.catalogService.catalogAll(body); return res; } @@ -28,9 +26,7 @@ export class CatalogController { async dataAppsAll(@Body() body) { console.log(`/catalog`, 'ON FIND ALL DATA APPS ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.dataAppsAll(body); + const res = await this.catalogService.dataAppsAll(body); return res; } @@ -39,9 +35,8 @@ export class CatalogController { async dataAppsOne(@Param() params, @Body() body) { console.log(`/catalog`, 'ON FIND ONE DATA APP ROUTE'); const { id } = params; - const catalogService = new CatalogService(); - const res = await catalogService.dataAppsOne(id, body); + const res = await this.catalogService.dataAppsOne(id, body); return res; } @@ -50,9 +45,7 @@ export class CatalogController { async getAllDashboardMetabase(@Body() body) { console.log(`/catalog`, 'ON GET ALL DASHBOARDS METABASE ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.getAllDashboardMetabase(body); + const res = await this.catalogService.getAllDashboardMetabase(body); return res; } @@ -62,9 +55,7 @@ export class CatalogController { const { id } = params; console.log(`/catalog`, 'ON GET ONE DASHBOARD METABASE ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.getOneDashboardMetabase(id, body); + const res = await this.catalogService.getOneDashboardMetabase(id, body); return res; } @@ -73,12 +64,11 @@ export class CatalogController { async getAllTableMetadata(@Body() body, @Query() query) { console.log(`/catalog`, 'ON GET ALL TABLES METADATA ROUTE'); - const catalogService = new CatalogService(); if (!query) { - const res = await catalogService.getAllTableMetadata(body); + const res = await this.catalogService.getAllTableMetadata(body); return res; } else { - const res = await catalogService.getOneTableMetadata(body, query); + const res = await this.catalogService.getOneTableMetadata(body, query); return res; } } @@ -88,9 +78,7 @@ export class CatalogController { const { id } = params; console.log(`/catalog`, 'ON DELETE ONE TABLE METADATA ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.deleteOneTableMetadata(id, body); + const res = await this.catalogService.deleteOneTableMetadata(id, body); return res; } @@ -99,9 +87,7 @@ export class CatalogController { async getOneColumnMetadata(@Body() body, @Query() params) { console.log(`/catalog`, 'ON GET ONE COLUMN METADATA ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.getOneColumnMetadata(body, params); + const res = await this.catalogService.getOneColumnMetadata(body, params); return res; } @@ -111,9 +97,7 @@ export class CatalogController { console.log(`/catalog`, 'ON DELETE ONE COLUMN METADATA ROUTE'); const { id } = params; - const catalogService = new CatalogService(); - - const res = await catalogService.deleteOneColumnMetadata(id, body); + const res = await this.catalogService.deleteOneColumnMetadata(id, body); return res; } @@ -122,9 +106,7 @@ export class CatalogController { async getOneDataPreview(@Body() body, @Query() params) { console.log(`/catalog`, 'ON GET ONE DATAPREVIEW ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.getOneDataPreview(body, params); + const res = await this.catalogService.getOneDataPreview(body, params); return res; } @@ -133,9 +115,7 @@ export class CatalogController { async getDataStatus(@Body() body) { console.log(`/catalog`, 'ON GET DATA STATUS ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.getDataStatus(body); + const res = await this.catalogService.getDataStatus(body); return res; } @@ -144,9 +124,7 @@ export class CatalogController { async createDataStatus(@Body() body) { console.log(`/catalog`, 'ON CREATE DATA STATUS ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.createDataStatus(body); + const res = await this.catalogService.createDataStatus(body); return res; } @@ -155,9 +133,7 @@ export class CatalogController { async getDataDescription(@Body() body) { console.log(`/catalog`, 'ON GET DATA DESCRIPTION ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.getDataDescription(body); + const res = await this.catalogService.getDataDescription(body); return res; } @@ -166,9 +142,7 @@ export class CatalogController { async createDataDescription(@Body() body) { console.log(`/catalog`, 'ON CREATE DATA DESCRIPTION ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.createDataDescription(body); + const res = await this.catalogService.createDataDescription(body); return res; } @@ -177,9 +151,7 @@ export class CatalogController { async getDataDocs(@Body() body) { console.log(`/catalog`, 'ON GET DATA DOCS ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.getDataDocs(body); + const res = await this.catalogService.getDataDocs(body); return res; } @@ -188,9 +160,7 @@ export class CatalogController { async createDataDocs(@Body() body) { console.log(`/catalog`, 'ON CREATE DATA DOCS ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.createDataDocs(body); + const res = await this.catalogService.createDataDocs(body); return res; } @@ -199,9 +169,7 @@ export class CatalogController { async getDataRating(@Body() body) { console.log(`/catalog`, 'ON GET DATA RATING ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.getDataRating(body); + const res = await this.catalogService.getDataRating(body); return res; } @@ -210,9 +178,7 @@ export class CatalogController { async createDataRating(@Body() body) { console.log(`/catalog`, 'ON GET DATA RATING ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.createDataRating(body); + const res = await this.catalogService.createDataRating(body); return res; } @@ -222,9 +188,9 @@ export class CatalogController { console.log(`/catalog`, 'ON GET SUMMARY RATING ROUTE'); //const { id } = params; - //const catalogService = new CatalogService(); + // - //const res = await catalogService.getSummaryRating(id, body); + //const res = await this.catalogService.getSummaryRating(id, body); return { avg_rating: 0, @@ -236,9 +202,7 @@ export class CatalogController { async getDataComment(@Body() body) { console.log(`/catalog`, 'ON GET DATA COMMENT ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.getDataComment(body); + const res = await this.catalogService.getDataComment(body); return res; } @@ -247,9 +211,7 @@ export class CatalogController { async createDataComment(@Body() body) { console.log(`/catalog`, 'ON GET DATA COMMENT ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.createDataComment(body); + const res = await this.catalogService.createDataComment(body); return res; } @@ -258,9 +220,7 @@ export class CatalogController { async getDataReview(@Body() body, @Query() params) { console.log(`/catalog`, 'ON GET DATA REVIEW ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.getDataReview(body, params); + const res = await this.catalogService.getDataReview(body, params); return res; } @@ -269,9 +229,7 @@ export class CatalogController { async createTags(@Body() body) { console.log(`/catalog`, 'ON CREATE TAG ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.createTags(body); + const res = await this.catalogService.createTags(body); return res; } @@ -280,9 +238,7 @@ export class CatalogController { async findAllTags(@Body() body) { console.log(`/catalog`, 'ON FIND ALL TAGS ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.findAllTags(body); + const res = await this.catalogService.findAllTags(body); return res; } @@ -292,9 +248,7 @@ export class CatalogController { console.log(`/catalog`, 'ON DELETE TAG ROUTE'); const { id } = params; - const catalogService = new CatalogService(); - - const res = await catalogService.deleteTags(id, body); + const res = await this.catalogService.deleteTags(id, body); return res; } @@ -303,9 +257,7 @@ export class CatalogController { async createTableTags(@Body() body) { console.log(`/catalog`, 'ON CREATE TABLE TAG ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.createTableTags(body); + const res = await this.catalogService.createTableTags(body); return res; } @@ -314,9 +266,7 @@ export class CatalogController { async getAllTableTags(@Body() body) { console.log(`/catalog`, 'ON GET ALL TABLE TAGS ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.findAllTableTags(body); + const res = await this.catalogService.findAllTableTags(body); return res; } @@ -326,9 +276,7 @@ export class CatalogController { console.log(`/catalog`, 'ON CREATE TABLE TAGS ROUTE'); const { id } = params; - const catalogService = new CatalogService(); - - const res = await catalogService.deleteTableTags(id, body); + const res = await this.catalogService.deleteTableTags(id, body); return res; } @@ -337,9 +285,7 @@ export class CatalogController { async getTableRules(@Body() body) { console.log(`/catalog`, 'ON GET TABLE RULES ROUTE'); - const catalogService = new CatalogService(); - - const res = await catalogService.getTableRules(body); + const res = await this.catalogService.getTableRules(body); return res; } @@ -349,9 +295,7 @@ export class CatalogController { console.log(`/catalog`, 'ON DELETE TABLE RULES ROUTE'); const { id } = params; - const catalogService = new CatalogService(); - - const res = await catalogService.deleteTableRules(id, body); + const res = await this.catalogService.deleteTableRules(id, body); return res; }