From fee83f52f6cb597342fa03d4a95f90cd28f2eecc Mon Sep 17 00:00:00 2001 From: Yamamoto Date: Fri, 2 Jan 2026 19:50:47 -0300 Subject: [PATCH] feat(backoffice): standardize root response root json format --- backoffice/src/app.controller.ts | 6 +++--- backoffice/src/app.service.ts | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/backoffice/src/app.controller.ts b/backoffice/src/app.controller.ts index e28e058..3ca61cb 100644 --- a/backoffice/src/app.controller.ts +++ b/backoffice/src/app.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get } from '@nestjs/common'; +import { Controller, Get, Req } from '@nestjs/common'; import { ApiOperation, ApiTags } from '@nestjs/swagger'; import { AppService } from './app.service'; @@ -9,7 +9,7 @@ export class AppController { @Get() @ApiOperation({ summary: 'API Status' }) - getStatus() { - return this.appService.getStatus(); + getStatus(@Req() req: any) { + return this.appService.getStatus(req); } } diff --git a/backoffice/src/app.service.ts b/backoffice/src/app.service.ts index 7a2e73e..5f575fd 100644 --- a/backoffice/src/app.service.ts +++ b/backoffice/src/app.service.ts @@ -2,13 +2,15 @@ import { Injectable } from '@nestjs/common'; @Injectable() export class AppService { - getStatus() { + getStatus(req: any) { + const ip = req.headers['x-forwarded-for'] || req.socket?.remoteAddress || req.ip; + return { - message: '🐴 GoHorseJobs Backoffice API is running!', docs: '/docs', health: '/health', + ip: ip ? ip.split(',')[0].trim() : 'unknown', + message: '🐴 GoHorseJobs API is running!', version: '1.0.0', - env: process.env.NODE_ENV || 'development', }; } }