From 3f1947172ec8242d1745069f2a0f32e220df1740 Mon Sep 17 00:00:00 2001 From: Marluan Espiritusanto Date: Tue, 3 Aug 2021 21:48:33 -0400 Subject: [PATCH] [REF] versioning project structure implemented --- .github/workflows/prod-cd.yml | 2 +- src/app.module.ts | 2 ++ src/config/swagger.config.ts | 7 +++--- src/main.ts | 2 +- .../territorial-division.module.ts | 25 +++++++++++-------- .../{ => v1}/dto/index.ts | 0 .../{ => v1}/dto/params/index.ts | 0 .../{ => v1}/dto/params/param-district.dto.ts | 0 .../dto/params/param-municipality.dto.ts | 0 .../dto/params/param-neighborhood.dto.ts | 0 .../{ => v1}/dto/params/param-province.dto.ts | 0 .../{ => v1}/dto/params/param-section.dto.ts | 0 .../dto/params/param-sub-neighborhood.dto.ts | 0 .../{ => v1}/dto/params/query-region.dto.ts | 0 .../{ => v1}/dto/queries/base.ts | 0 .../{ => v1}/dto/queries/index.ts | 0 .../dto/queries/query-district.dto.ts | 0 .../dto/queries/query-municipality.dto.ts | 0 .../dto/queries/query-neighborhood.dto.ts | 0 .../dto/queries/query-province.dto.ts | 0 .../{ => v1}/dto/queries/query-region.dto.ts | 0 .../{ => v1}/dto/queries/query-section.dto.ts | 0 .../dto/queries/query-sub-neighborhood.dto.ts | 0 .../{ => v1}/dto/responses/base.ts | 0 .../{ => v1}/dto/responses/index.ts | 0 .../dto/responses/response-district.dto.ts | 0 .../responses/response-municipality.dto.ts | 0 .../responses/response-neighborhood.dto.ts | 0 .../dto/responses/response-province.dto.ts | 0 .../dto/responses/response-region.dto.ts | 0 .../dto/responses/response-section.dto.ts | 0 .../response-sub-neighborhood.dto.ts | 0 .../{ => v1}/dto/responses/wrapper.ts | 0 .../{ => v1}/entities/base.model.ts | 0 .../{ => v1}/entities/district.model.ts | 0 .../{ => v1}/entities/index.ts | 0 .../{ => v1}/entities/municipality.model.ts | 0 .../{ => v1}/entities/neighborhood.model.ts | 0 .../{ => v1}/entities/province.model.ts | 0 .../{ => v1}/entities/region.model.ts | 0 .../{ => v1}/entities/section.model.ts | 0 .../entities/sub-neighborhood.model.ts | 0 .../{ => v1}/interfaces/index.ts | 0 .../interfaces/query-strategy.interface.ts | 0 .../{ => v1}/strategies/district.strategy.ts | 0 .../{ => v1}/strategies/index.ts | 0 .../strategies/municipality.strategy.ts | 0 .../strategies/neighborhood.strategy.ts | 0 .../{ => v1}/strategies/province.strategy.ts | 0 .../{ => v1}/strategies/region.strategy.ts | 0 .../{ => v1}/strategies/section.strategy.ts | 0 .../strategies/sub-neighborhood.strategy.ts | 0 .../territorial-division-v1.controller.ts} | 8 +++--- .../territorial-division-v1.service.ts} | 2 +- 54 files changed, 26 insertions(+), 22 deletions(-) rename src/modules/territorial-division/{ => v1}/dto/index.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/params/index.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/params/param-district.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/params/param-municipality.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/params/param-neighborhood.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/params/param-province.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/params/param-section.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/params/param-sub-neighborhood.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/params/query-region.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/queries/base.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/queries/index.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/queries/query-district.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/queries/query-municipality.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/queries/query-neighborhood.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/queries/query-province.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/queries/query-region.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/queries/query-section.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/queries/query-sub-neighborhood.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/responses/base.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/responses/index.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/responses/response-district.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/responses/response-municipality.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/responses/response-neighborhood.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/responses/response-province.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/responses/response-region.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/responses/response-section.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/responses/response-sub-neighborhood.dto.ts (100%) rename src/modules/territorial-division/{ => v1}/dto/responses/wrapper.ts (100%) rename src/modules/territorial-division/{ => v1}/entities/base.model.ts (100%) rename src/modules/territorial-division/{ => v1}/entities/district.model.ts (100%) rename src/modules/territorial-division/{ => v1}/entities/index.ts (100%) rename src/modules/territorial-division/{ => v1}/entities/municipality.model.ts (100%) rename src/modules/territorial-division/{ => v1}/entities/neighborhood.model.ts (100%) rename src/modules/territorial-division/{ => v1}/entities/province.model.ts (100%) rename src/modules/territorial-division/{ => v1}/entities/region.model.ts (100%) rename src/modules/territorial-division/{ => v1}/entities/section.model.ts (100%) rename src/modules/territorial-division/{ => v1}/entities/sub-neighborhood.model.ts (100%) rename src/modules/territorial-division/{ => v1}/interfaces/index.ts (100%) rename src/modules/territorial-division/{ => v1}/interfaces/query-strategy.interface.ts (100%) rename src/modules/territorial-division/{ => v1}/strategies/district.strategy.ts (100%) rename src/modules/territorial-division/{ => v1}/strategies/index.ts (100%) rename src/modules/territorial-division/{ => v1}/strategies/municipality.strategy.ts (100%) rename src/modules/territorial-division/{ => v1}/strategies/neighborhood.strategy.ts (100%) rename src/modules/territorial-division/{ => v1}/strategies/province.strategy.ts (100%) rename src/modules/territorial-division/{ => v1}/strategies/region.strategy.ts (100%) rename src/modules/territorial-division/{ => v1}/strategies/section.strategy.ts (100%) rename src/modules/territorial-division/{ => v1}/strategies/sub-neighborhood.strategy.ts (100%) rename src/modules/territorial-division/{territorial-division.controller.ts => v1/territorial-division-v1.controller.ts} (97%) rename src/modules/territorial-division/{territorial-division.service.ts => v1/territorial-division-v1.service.ts} (99%) diff --git a/.github/workflows/prod-cd.yml b/.github/workflows/prod-cd.yml index ca566c2..6255b39 100644 --- a/.github/workflows/prod-cd.yml +++ b/.github/workflows/prod-cd.yml @@ -72,7 +72,7 @@ jobs: service: ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}-${{ needs.versioning.outputs.api_version }} credentials: ${{ secrets.GAR_JSON_KEY }} region: ${{ secrets.GCP_REGION }} - env_vars: DB_HOST=${{ secrets.DB_HOST }},DB_PORT=${{ secrets.DB_PORT }},DB_USER=${{ secrets.DB_USER }},DB_PASSWORD=${{ secrets.DB_PASSWORD }},DB_NAME=${{ secrets.DB_NAME }},HASH_CONVERT_SERVICE_URI=${{ secrets.HASH_CONVERT_SERVICE_URI }},JCE_CITIZENS_API=${{ secrets.JCE_CITIZENS_API }} + env_vars: DB_HOST=${{ secrets.DB_HOST }},DB_PORT=${{ secrets.DB_PORT }},DB_USER=${{ secrets.DB_USER }},DB_PASSWORD=${{ secrets.DB_PASSWORD }},DB_NAME=${{ secrets.DB_NAME }},API_VERSION=${{ needs.versioning.outputs.api_version }} - name: Testing Service By Curl run: curl "${{ steps.deploy.outputs.url }}" diff --git a/src/app.module.ts b/src/app.module.ts index 43cd3a7..7ac66e4 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -13,8 +13,10 @@ import { TerritorialDivisionModule } from '@modules/territorial-division/territo }) export class AppModule { static port: number; + static apiVersion: string; constructor(private readonly configService: ConfigService) { AppModule.port = +this.configService.get('PORT'); + AppModule.apiVersion = this.configService.get('API_VERSION'); } } diff --git a/src/config/swagger.config.ts b/src/config/swagger.config.ts index 9ac4a8f..cb8b77b 100644 --- a/src/config/swagger.config.ts +++ b/src/config/swagger.config.ts @@ -3,22 +3,21 @@ import { INestApplication } from '@nestjs/common'; const title = 'Territorial Division'; const description = 'Territorial Division api definition.'; -const version = '1.0'; /** * Setup swagger in the application boostrap * @param app {INestApplication} */ -export const configSwagger = (app: INestApplication) => { +export const configSwagger = (app: INestApplication, apiVersion: string) => { const options = new DocumentBuilder() .setTitle(title) .setDescription(description) - .setVersion(version) + .setVersion(apiVersion) .build(); const document = SwaggerModule.createDocument(app, options, { operationIdFactory: (controllerKey: string, methodKey: string) => methodKey, }); - SwaggerModule.setup('v1/territories/api', app, document); + SwaggerModule.setup(`${apiVersion}/territories/api`, app, document); }; diff --git a/src/main.ts b/src/main.ts index 1547b9f..09e7b32 100644 --- a/src/main.ts +++ b/src/main.ts @@ -23,7 +23,7 @@ async function bootstrap() { ); app.enableVersioning(); - configSwagger(app); + configSwagger(app, AppModule.apiVersion); await app.listen(AppModule.port); } diff --git a/src/modules/territorial-division/territorial-division.module.ts b/src/modules/territorial-division/territorial-division.module.ts index fb4e57b..0a66ace 100644 --- a/src/modules/territorial-division/territorial-division.module.ts +++ b/src/modules/territorial-division/territorial-division.module.ts @@ -1,15 +1,18 @@ import { Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; -import { District } from './entities/district.model'; -import { Municipality } from './entities/municipality.model'; -import { Neighborhood } from './entities/neighborhood.model'; -import { Province } from './entities/province.model'; -import { Region } from './entities/region.model'; -import { Section } from './entities/section.model'; -import { SubNeighborhood } from './entities/sub-neighborhood.model'; -import { TerritorialDivisionController } from './territorial-division.controller'; -import { TerritorialDivisionService } from './territorial-division.service'; +/** + * V1 + */ +import { District } from './v1/entities/district.model'; +import { Municipality } from './v1/entities/municipality.model'; +import { Neighborhood } from './v1/entities/neighborhood.model'; +import { Province } from './v1/entities/province.model'; +import { Region } from './v1/entities/region.model'; +import { Section } from './v1/entities/section.model'; +import { SubNeighborhood } from './v1/entities/sub-neighborhood.model'; +import { TerritorialDivisionV1Controller } from './v1/territorial-division-v1.controller'; +import { TerritorialDivisionV1Service } from './v1/territorial-division-v1.service'; @Module({ imports: [ @@ -23,7 +26,7 @@ import { TerritorialDivisionService } from './territorial-division.service'; SubNeighborhood, ]), ], - controllers: [TerritorialDivisionController], - providers: [TerritorialDivisionService], + controllers: [TerritorialDivisionV1Controller], + providers: [TerritorialDivisionV1Service], }) export class TerritorialDivisionModule {} diff --git a/src/modules/territorial-division/dto/index.ts b/src/modules/territorial-division/v1/dto/index.ts similarity index 100% rename from src/modules/territorial-division/dto/index.ts rename to src/modules/territorial-division/v1/dto/index.ts diff --git a/src/modules/territorial-division/dto/params/index.ts b/src/modules/territorial-division/v1/dto/params/index.ts similarity index 100% rename from src/modules/territorial-division/dto/params/index.ts rename to src/modules/territorial-division/v1/dto/params/index.ts diff --git a/src/modules/territorial-division/dto/params/param-district.dto.ts b/src/modules/territorial-division/v1/dto/params/param-district.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/params/param-district.dto.ts rename to src/modules/territorial-division/v1/dto/params/param-district.dto.ts diff --git a/src/modules/territorial-division/dto/params/param-municipality.dto.ts b/src/modules/territorial-division/v1/dto/params/param-municipality.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/params/param-municipality.dto.ts rename to src/modules/territorial-division/v1/dto/params/param-municipality.dto.ts diff --git a/src/modules/territorial-division/dto/params/param-neighborhood.dto.ts b/src/modules/territorial-division/v1/dto/params/param-neighborhood.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/params/param-neighborhood.dto.ts rename to src/modules/territorial-division/v1/dto/params/param-neighborhood.dto.ts diff --git a/src/modules/territorial-division/dto/params/param-province.dto.ts b/src/modules/territorial-division/v1/dto/params/param-province.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/params/param-province.dto.ts rename to src/modules/territorial-division/v1/dto/params/param-province.dto.ts diff --git a/src/modules/territorial-division/dto/params/param-section.dto.ts b/src/modules/territorial-division/v1/dto/params/param-section.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/params/param-section.dto.ts rename to src/modules/territorial-division/v1/dto/params/param-section.dto.ts diff --git a/src/modules/territorial-division/dto/params/param-sub-neighborhood.dto.ts b/src/modules/territorial-division/v1/dto/params/param-sub-neighborhood.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/params/param-sub-neighborhood.dto.ts rename to src/modules/territorial-division/v1/dto/params/param-sub-neighborhood.dto.ts diff --git a/src/modules/territorial-division/dto/params/query-region.dto.ts b/src/modules/territorial-division/v1/dto/params/query-region.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/params/query-region.dto.ts rename to src/modules/territorial-division/v1/dto/params/query-region.dto.ts diff --git a/src/modules/territorial-division/dto/queries/base.ts b/src/modules/territorial-division/v1/dto/queries/base.ts similarity index 100% rename from src/modules/territorial-division/dto/queries/base.ts rename to src/modules/territorial-division/v1/dto/queries/base.ts diff --git a/src/modules/territorial-division/dto/queries/index.ts b/src/modules/territorial-division/v1/dto/queries/index.ts similarity index 100% rename from src/modules/territorial-division/dto/queries/index.ts rename to src/modules/territorial-division/v1/dto/queries/index.ts diff --git a/src/modules/territorial-division/dto/queries/query-district.dto.ts b/src/modules/territorial-division/v1/dto/queries/query-district.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/queries/query-district.dto.ts rename to src/modules/territorial-division/v1/dto/queries/query-district.dto.ts diff --git a/src/modules/territorial-division/dto/queries/query-municipality.dto.ts b/src/modules/territorial-division/v1/dto/queries/query-municipality.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/queries/query-municipality.dto.ts rename to src/modules/territorial-division/v1/dto/queries/query-municipality.dto.ts diff --git a/src/modules/territorial-division/dto/queries/query-neighborhood.dto.ts b/src/modules/territorial-division/v1/dto/queries/query-neighborhood.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/queries/query-neighborhood.dto.ts rename to src/modules/territorial-division/v1/dto/queries/query-neighborhood.dto.ts diff --git a/src/modules/territorial-division/dto/queries/query-province.dto.ts b/src/modules/territorial-division/v1/dto/queries/query-province.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/queries/query-province.dto.ts rename to src/modules/territorial-division/v1/dto/queries/query-province.dto.ts diff --git a/src/modules/territorial-division/dto/queries/query-region.dto.ts b/src/modules/territorial-division/v1/dto/queries/query-region.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/queries/query-region.dto.ts rename to src/modules/territorial-division/v1/dto/queries/query-region.dto.ts diff --git a/src/modules/territorial-division/dto/queries/query-section.dto.ts b/src/modules/territorial-division/v1/dto/queries/query-section.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/queries/query-section.dto.ts rename to src/modules/territorial-division/v1/dto/queries/query-section.dto.ts diff --git a/src/modules/territorial-division/dto/queries/query-sub-neighborhood.dto.ts b/src/modules/territorial-division/v1/dto/queries/query-sub-neighborhood.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/queries/query-sub-neighborhood.dto.ts rename to src/modules/territorial-division/v1/dto/queries/query-sub-neighborhood.dto.ts diff --git a/src/modules/territorial-division/dto/responses/base.ts b/src/modules/territorial-division/v1/dto/responses/base.ts similarity index 100% rename from src/modules/territorial-division/dto/responses/base.ts rename to src/modules/territorial-division/v1/dto/responses/base.ts diff --git a/src/modules/territorial-division/dto/responses/index.ts b/src/modules/territorial-division/v1/dto/responses/index.ts similarity index 100% rename from src/modules/territorial-division/dto/responses/index.ts rename to src/modules/territorial-division/v1/dto/responses/index.ts diff --git a/src/modules/territorial-division/dto/responses/response-district.dto.ts b/src/modules/territorial-division/v1/dto/responses/response-district.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/responses/response-district.dto.ts rename to src/modules/territorial-division/v1/dto/responses/response-district.dto.ts diff --git a/src/modules/territorial-division/dto/responses/response-municipality.dto.ts b/src/modules/territorial-division/v1/dto/responses/response-municipality.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/responses/response-municipality.dto.ts rename to src/modules/territorial-division/v1/dto/responses/response-municipality.dto.ts diff --git a/src/modules/territorial-division/dto/responses/response-neighborhood.dto.ts b/src/modules/territorial-division/v1/dto/responses/response-neighborhood.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/responses/response-neighborhood.dto.ts rename to src/modules/territorial-division/v1/dto/responses/response-neighborhood.dto.ts diff --git a/src/modules/territorial-division/dto/responses/response-province.dto.ts b/src/modules/territorial-division/v1/dto/responses/response-province.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/responses/response-province.dto.ts rename to src/modules/territorial-division/v1/dto/responses/response-province.dto.ts diff --git a/src/modules/territorial-division/dto/responses/response-region.dto.ts b/src/modules/territorial-division/v1/dto/responses/response-region.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/responses/response-region.dto.ts rename to src/modules/territorial-division/v1/dto/responses/response-region.dto.ts diff --git a/src/modules/territorial-division/dto/responses/response-section.dto.ts b/src/modules/territorial-division/v1/dto/responses/response-section.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/responses/response-section.dto.ts rename to src/modules/territorial-division/v1/dto/responses/response-section.dto.ts diff --git a/src/modules/territorial-division/dto/responses/response-sub-neighborhood.dto.ts b/src/modules/territorial-division/v1/dto/responses/response-sub-neighborhood.dto.ts similarity index 100% rename from src/modules/territorial-division/dto/responses/response-sub-neighborhood.dto.ts rename to src/modules/territorial-division/v1/dto/responses/response-sub-neighborhood.dto.ts diff --git a/src/modules/territorial-division/dto/responses/wrapper.ts b/src/modules/territorial-division/v1/dto/responses/wrapper.ts similarity index 100% rename from src/modules/territorial-division/dto/responses/wrapper.ts rename to src/modules/territorial-division/v1/dto/responses/wrapper.ts diff --git a/src/modules/territorial-division/entities/base.model.ts b/src/modules/territorial-division/v1/entities/base.model.ts similarity index 100% rename from src/modules/territorial-division/entities/base.model.ts rename to src/modules/territorial-division/v1/entities/base.model.ts diff --git a/src/modules/territorial-division/entities/district.model.ts b/src/modules/territorial-division/v1/entities/district.model.ts similarity index 100% rename from src/modules/territorial-division/entities/district.model.ts rename to src/modules/territorial-division/v1/entities/district.model.ts diff --git a/src/modules/territorial-division/entities/index.ts b/src/modules/territorial-division/v1/entities/index.ts similarity index 100% rename from src/modules/territorial-division/entities/index.ts rename to src/modules/territorial-division/v1/entities/index.ts diff --git a/src/modules/territorial-division/entities/municipality.model.ts b/src/modules/territorial-division/v1/entities/municipality.model.ts similarity index 100% rename from src/modules/territorial-division/entities/municipality.model.ts rename to src/modules/territorial-division/v1/entities/municipality.model.ts diff --git a/src/modules/territorial-division/entities/neighborhood.model.ts b/src/modules/territorial-division/v1/entities/neighborhood.model.ts similarity index 100% rename from src/modules/territorial-division/entities/neighborhood.model.ts rename to src/modules/territorial-division/v1/entities/neighborhood.model.ts diff --git a/src/modules/territorial-division/entities/province.model.ts b/src/modules/territorial-division/v1/entities/province.model.ts similarity index 100% rename from src/modules/territorial-division/entities/province.model.ts rename to src/modules/territorial-division/v1/entities/province.model.ts diff --git a/src/modules/territorial-division/entities/region.model.ts b/src/modules/territorial-division/v1/entities/region.model.ts similarity index 100% rename from src/modules/territorial-division/entities/region.model.ts rename to src/modules/territorial-division/v1/entities/region.model.ts diff --git a/src/modules/territorial-division/entities/section.model.ts b/src/modules/territorial-division/v1/entities/section.model.ts similarity index 100% rename from src/modules/territorial-division/entities/section.model.ts rename to src/modules/territorial-division/v1/entities/section.model.ts diff --git a/src/modules/territorial-division/entities/sub-neighborhood.model.ts b/src/modules/territorial-division/v1/entities/sub-neighborhood.model.ts similarity index 100% rename from src/modules/territorial-division/entities/sub-neighborhood.model.ts rename to src/modules/territorial-division/v1/entities/sub-neighborhood.model.ts diff --git a/src/modules/territorial-division/interfaces/index.ts b/src/modules/territorial-division/v1/interfaces/index.ts similarity index 100% rename from src/modules/territorial-division/interfaces/index.ts rename to src/modules/territorial-division/v1/interfaces/index.ts diff --git a/src/modules/territorial-division/interfaces/query-strategy.interface.ts b/src/modules/territorial-division/v1/interfaces/query-strategy.interface.ts similarity index 100% rename from src/modules/territorial-division/interfaces/query-strategy.interface.ts rename to src/modules/territorial-division/v1/interfaces/query-strategy.interface.ts diff --git a/src/modules/territorial-division/strategies/district.strategy.ts b/src/modules/territorial-division/v1/strategies/district.strategy.ts similarity index 100% rename from src/modules/territorial-division/strategies/district.strategy.ts rename to src/modules/territorial-division/v1/strategies/district.strategy.ts diff --git a/src/modules/territorial-division/strategies/index.ts b/src/modules/territorial-division/v1/strategies/index.ts similarity index 100% rename from src/modules/territorial-division/strategies/index.ts rename to src/modules/territorial-division/v1/strategies/index.ts diff --git a/src/modules/territorial-division/strategies/municipality.strategy.ts b/src/modules/territorial-division/v1/strategies/municipality.strategy.ts similarity index 100% rename from src/modules/territorial-division/strategies/municipality.strategy.ts rename to src/modules/territorial-division/v1/strategies/municipality.strategy.ts diff --git a/src/modules/territorial-division/strategies/neighborhood.strategy.ts b/src/modules/territorial-division/v1/strategies/neighborhood.strategy.ts similarity index 100% rename from src/modules/territorial-division/strategies/neighborhood.strategy.ts rename to src/modules/territorial-division/v1/strategies/neighborhood.strategy.ts diff --git a/src/modules/territorial-division/strategies/province.strategy.ts b/src/modules/territorial-division/v1/strategies/province.strategy.ts similarity index 100% rename from src/modules/territorial-division/strategies/province.strategy.ts rename to src/modules/territorial-division/v1/strategies/province.strategy.ts diff --git a/src/modules/territorial-division/strategies/region.strategy.ts b/src/modules/territorial-division/v1/strategies/region.strategy.ts similarity index 100% rename from src/modules/territorial-division/strategies/region.strategy.ts rename to src/modules/territorial-division/v1/strategies/region.strategy.ts diff --git a/src/modules/territorial-division/strategies/section.strategy.ts b/src/modules/territorial-division/v1/strategies/section.strategy.ts similarity index 100% rename from src/modules/territorial-division/strategies/section.strategy.ts rename to src/modules/territorial-division/v1/strategies/section.strategy.ts diff --git a/src/modules/territorial-division/strategies/sub-neighborhood.strategy.ts b/src/modules/territorial-division/v1/strategies/sub-neighborhood.strategy.ts similarity index 100% rename from src/modules/territorial-division/strategies/sub-neighborhood.strategy.ts rename to src/modules/territorial-division/v1/strategies/sub-neighborhood.strategy.ts diff --git a/src/modules/territorial-division/territorial-division.controller.ts b/src/modules/territorial-division/v1/territorial-division-v1.controller.ts similarity index 97% rename from src/modules/territorial-division/territorial-division.controller.ts rename to src/modules/territorial-division/v1/territorial-division-v1.controller.ts index c8f364f..1a55c28 100644 --- a/src/modules/territorial-division/territorial-division.controller.ts +++ b/src/modules/territorial-division/v1/territorial-division-v1.controller.ts @@ -25,17 +25,17 @@ import { ResponseSectionDto, ResponseSubNeighborhoodDto, } from './dto'; -import { TerritorialDivisionService } from './territorial-division.service'; +import { TerritorialDivisionV1Service } from './territorial-division-v1.service'; @Controller({ path: 'territories', version: '1', }) -@ApiTags('Territorial Division') +@ApiTags('Territorial Division: Version 1') @UseInterceptors(EnvelopInterceptor) -export class TerritorialDivisionController { +export class TerritorialDivisionV1Controller { constructor( - private readonly territorialDivisionService: TerritorialDivisionService, + private readonly territorialDivisionService: TerritorialDivisionV1Service, ) {} @Get('regions') diff --git a/src/modules/territorial-division/territorial-division.service.ts b/src/modules/territorial-division/v1/territorial-division-v1.service.ts similarity index 99% rename from src/modules/territorial-division/territorial-division.service.ts rename to src/modules/territorial-division/v1/territorial-division-v1.service.ts index 5b83609..edbce76 100644 --- a/src/modules/territorial-division/territorial-division.service.ts +++ b/src/modules/territorial-division/v1/territorial-division-v1.service.ts @@ -39,7 +39,7 @@ import { } from './strategies'; @Injectable() -export class TerritorialDivisionService { +export class TerritorialDivisionV1Service { constructor( @InjectRepository(Region) private readonly regionRepo: Repository, @InjectRepository(Province)