From 1ddb20e2825cf4085e1023862c519635b27df05a Mon Sep 17 00:00:00 2001 From: rckrdmrd Date: Sun, 4 Jan 2026 07:14:22 -0600 Subject: [PATCH] refactor: Configure subrepositorios --- .gitignore | 16 ++++ .gitmodules | 13 +++ apps/backend/package.json | 84 -------------------- apps/backend/service.descriptor.yml | 58 -------------- apps/backend/src/app.module.ts | 32 -------- apps/backend/src/config/index.ts | 23 ------ apps/backend/src/main.ts | 36 --------- apps/backend/src/modules/auth/auth.module.ts | 19 ----- apps/backend/src/shared/types/index.ts | 27 ------- apps/backend/tsconfig.json | 26 ------ 10 files changed, 29 insertions(+), 305 deletions(-) create mode 100644 .gitignore create mode 100644 .gitmodules delete mode 100644 apps/backend/package.json delete mode 100644 apps/backend/service.descriptor.yml delete mode 100644 apps/backend/src/app.module.ts delete mode 100644 apps/backend/src/config/index.ts delete mode 100644 apps/backend/src/main.ts delete mode 100644 apps/backend/src/modules/auth/auth.module.ts delete mode 100644 apps/backend/src/shared/types/index.ts delete mode 100644 apps/backend/tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a2e0740 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# SUBREPOSITORIOS +apps/ + +# Dependencias +node_modules/ + +# Build +dist/ + +# Environment +.env +!.env.example + +# IDE +.idea/ +.vscode/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4dd4f2b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,13 @@ +# Subrepositorios de inmobiliaria-analytics + +[submodule "apps/backend"] + path = apps/backend + url = git@gitea-server:rckrdmrd/inmobiliaria-analytics-backend.git + +[submodule "apps/frontend"] + path = apps/frontend + url = git@gitea-server:rckrdmrd/inmobiliaria-analytics-frontend.git + +[submodule "apps/database"] + path = apps/database + url = git@gitea-server:rckrdmrd/inmobiliaria-analytics-database.git diff --git a/apps/backend/package.json b/apps/backend/package.json deleted file mode 100644 index 2622d64..0000000 --- a/apps/backend/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "name": "@inmobiliaria-analytics/backend", - "version": "0.1.0", - "description": "Inmobiliaria Analytics - Backend API", - "author": "Inmobiliaria Analytics Team", - "private": true, - "license": "UNLICENSED", - "scripts": { - "build": "nest build", - "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", - "start": "nest start", - "start:dev": "nest start --watch", - "start:debug": "nest start --debug --watch", - "start:prod": "node dist/main", - "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", - "test": "jest", - "test:watch": "jest --watch", - "test:cov": "jest --coverage", - "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", - "test:e2e": "jest --config ./test/jest-e2e.json", - "typecheck": "tsc --noEmit" - }, - "dependencies": { - "@nestjs/common": "^10.3.0", - "@nestjs/config": "^3.1.1", - "@nestjs/core": "^10.3.0", - "@nestjs/jwt": "^10.2.0", - "@nestjs/passport": "^10.0.3", - "@nestjs/platform-express": "^10.3.0", - "@nestjs/typeorm": "^10.0.1", - "bcrypt": "^5.1.1", - "class-transformer": "^0.5.1", - "class-validator": "^0.14.1", - "passport": "^0.7.0", - "passport-jwt": "^4.0.1", - "passport-local": "^1.0.0", - "pg": "^8.11.3", - "reflect-metadata": "^0.2.1", - "rxjs": "^7.8.1", - "typeorm": "^0.3.19" - }, - "devDependencies": { - "@nestjs/cli": "^10.3.0", - "@nestjs/schematics": "^10.1.0", - "@nestjs/testing": "^10.3.0", - "@types/bcrypt": "^5.0.2", - "@types/express": "^4.17.21", - "@types/jest": "^29.5.11", - "@types/node": "^20.10.6", - "@types/passport-jwt": "^4.0.0", - "@types/passport-local": "^1.0.38", - "@typescript-eslint/eslint-plugin": "^6.18.0", - "@typescript-eslint/parser": "^6.18.0", - "eslint": "^8.56.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-prettier": "^5.1.2", - "jest": "^29.7.0", - "prettier": "^3.1.1", - "source-map-support": "^0.5.21", - "supertest": "^6.3.4", - "ts-jest": "^29.1.1", - "ts-loader": "^9.5.1", - "ts-node": "^10.9.2", - "tsconfig-paths": "^4.2.0", - "typescript": "^5.3.3" - }, - "jest": { - "moduleFileExtensions": [ - "js", - "json", - "ts" - ], - "rootDir": "src", - "testRegex": ".*\\.spec\\.ts$", - "transform": { - "^.+\\.(t|j)s$": "ts-jest" - }, - "collectCoverageFrom": [ - "**/*.(t|j)s" - ], - "coverageDirectory": "../coverage", - "testEnvironment": "node" - } -} diff --git a/apps/backend/service.descriptor.yml b/apps/backend/service.descriptor.yml deleted file mode 100644 index bea8924..0000000 --- a/apps/backend/service.descriptor.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Service Descriptor - Inmobiliaria Analytics API -# Generado automáticamente durante migración - -service: - name: inmobiliaria-api - type: backend_api - framework: nestjs - runtime: node - version: "20" - description: "API de analytics inmobiliaria" - owner_agent: NEXUS-BACKEND - -repository: - name: workspace-v1 - path: projects/inmobiliaria-analytics/apps/backend - main_branch: main - -ports: - internal: 3100 - registry_ref: projects.inmobiliaria.services.api - protocol: http - -domains: - registry_ref: projects.inmobiliaria.domains - overrides: - local: api.inmobiliaria.localhost - -database: - registry_ref: databases.inmobiliaria - role: runtime - schemas: - - public - - properties - - analytics - -docker: - dockerfile: Dockerfile - context: . - networks: - - inmobiliaria_${ENV:-local} - - infra_shared - labels: - traefik: - enable: true - rule: "Host(`api.inmobiliaria.localhost`)" - -healthcheck: - path: /health - interval: 30s - timeout: 10s - retries: 3 - -metadata: - created: "2025-12-26" - updated: "2025-12-26" - maintainers: - - tech-leader - status: planned diff --git a/apps/backend/src/app.module.ts b/apps/backend/src/app.module.ts deleted file mode 100644 index 8d13052..0000000 --- a/apps/backend/src/app.module.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Module } from '@nestjs/common'; -import { ConfigModule } from '@nestjs/config'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { appConfig, databaseConfig, jwtConfig } from './config'; -import { AuthModule } from './modules/auth/auth.module'; - -@Module({ - imports: [ - ConfigModule.forRoot({ - isGlobal: true, - load: [appConfig, databaseConfig, jwtConfig], - }), - TypeOrmModule.forRootAsync({ - useFactory: (configService) => ({ - type: 'postgres', - host: configService.get('database.host'), - port: configService.get('database.port'), - username: configService.get('database.username'), - password: configService.get('database.password'), - database: configService.get('database.database'), - entities: [__dirname + '/**/*.entity{.ts,.js}'], - synchronize: configService.get('database.synchronize'), - logging: configService.get('database.logging'), - }), - inject: [ConfigModule], - }), - AuthModule, - ], - controllers: [], - providers: [], -}) -export class AppModule {} diff --git a/apps/backend/src/config/index.ts b/apps/backend/src/config/index.ts deleted file mode 100644 index 6307a1f..0000000 --- a/apps/backend/src/config/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { registerAs } from '@nestjs/config'; - -export const databaseConfig = registerAs('database', () => ({ - type: 'postgres', - host: process.env.DB_HOST || 'localhost', - port: parseInt(process.env.DB_PORT, 10) || 5432, - username: process.env.DB_USERNAME || 'postgres', - password: process.env.DB_PASSWORD || 'postgres', - database: process.env.DB_NAME || 'inmobiliaria_analytics', - synchronize: process.env.NODE_ENV !== 'production', - logging: process.env.NODE_ENV === 'development', -})); - -export const jwtConfig = registerAs('jwt', () => ({ - secret: process.env.JWT_SECRET || 'change-me-in-production', - expiresIn: process.env.JWT_EXPIRES_IN || '1d', -})); - -export const appConfig = registerAs('app', () => ({ - port: parseInt(process.env.PORT, 10) || 3000, - environment: process.env.NODE_ENV || 'development', - apiPrefix: process.env.API_PREFIX || 'api', -})); diff --git a/apps/backend/src/main.ts b/apps/backend/src/main.ts deleted file mode 100644 index 9e508ce..0000000 --- a/apps/backend/src/main.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { NestFactory } from '@nestjs/core'; -import { ValidationPipe } from '@nestjs/common'; -import { ConfigService } from '@nestjs/config'; -import { AppModule } from './app.module'; - -async function bootstrap() { - const app = await NestFactory.create(AppModule); - const configService = app.get(ConfigService); - - // Global validation pipe - app.useGlobalPipes( - new ValidationPipe({ - whitelist: true, - forbidNonWhitelisted: true, - transform: true, - }), - ); - - // CORS configuration - app.enableCors({ - origin: process.env.CORS_ORIGIN || '*', - credentials: true, - }); - - // API prefix - const apiPrefix = configService.get('app.apiPrefix', 'api'); - app.setGlobalPrefix(apiPrefix); - - // Start server - const port = configService.get('app.port', 3000); - await app.listen(port); - - console.log(`Inmobiliaria Analytics API running on: http://localhost:${port}/${apiPrefix}`); -} - -bootstrap(); diff --git a/apps/backend/src/modules/auth/auth.module.ts b/apps/backend/src/modules/auth/auth.module.ts deleted file mode 100644 index fe44ab6..0000000 --- a/apps/backend/src/modules/auth/auth.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Module } from '@nestjs/common'; - -/** - * Authentication module placeholder - * - * TODO: Implement authentication logic including: - * - User authentication service - * - JWT strategy - * - Local strategy - * - Auth controller - * - Auth guards - */ -@Module({ - imports: [], - controllers: [], - providers: [], - exports: [], -}) -export class AuthModule {} diff --git a/apps/backend/src/shared/types/index.ts b/apps/backend/src/shared/types/index.ts deleted file mode 100644 index 3114e8c..0000000 --- a/apps/backend/src/shared/types/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Shared type definitions for Inmobiliaria Analytics - */ - -export interface ApiResponse { - success: boolean; - data?: T; - error?: string; - message?: string; -} - -export interface PaginatedResponse { - data: T[]; - total: number; - page: number; - limit: number; - totalPages: number; -} - -export interface JwtPayload { - sub: string; - email: string; - iat?: number; - exp?: number; -} - -export type Environment = 'development' | 'production' | 'test'; diff --git a/apps/backend/tsconfig.json b/apps/backend/tsconfig.json deleted file mode 100644 index c86586b..0000000 --- a/apps/backend/tsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "declaration": true, - "removeComments": true, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "allowSyntheticDefaultImports": true, - "target": "ES2021", - "sourceMap": true, - "outDir": "./dist", - "baseUrl": "./", - "incremental": true, - "skipLibCheck": true, - "strictNullChecks": false, - "noImplicitAny": false, - "strictBindCallApply": false, - "forceConsistentCasingInFileNames": false, - "noFallthroughCasesInSwitch": false, - "paths": { - "@/*": ["src/*"] - } - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "test", "**/*spec.ts"] -}