feat: implement logging enhancements; add projectId and queryId to log entity; update query and logger services for improved logging; refactor query execution to support call stack tracking

This commit is contained in:
lborv
2025-10-11 19:36:43 +03:00
parent 08a62fa2c5
commit 967c89108a
14 changed files with 226 additions and 46 deletions

View File

@ -1,6 +1,15 @@
import { Body, Controller, Get, Inject, Post, UseGuards } from "@nestjs/common";
import {
Body,
Controller,
Get,
Inject,
Param,
Post,
UseGuards,
} from "@nestjs/common";
import { LoggerService } from "./logger.service";
import { ApiTokenGuard } from "src/api/guards/api-token.guard";
import { QueryGuard } from "../guards/query.guard";
@Controller("logger")
@UseGuards(ApiTokenGuard)
@ -10,13 +19,14 @@ export class LoggerController {
private readonly loggerService: LoggerService
) {}
@Get("/:traceId")
getByTraceId(@Inject("traceId") traceId: string) {
@Get("/:id/:traceId")
getByTraceId(@Param("traceId") traceId: string) {
return this.loggerService.findByTraceId(traceId);
}
@Post("/find")
find(
@Post("/:id/findAll")
findAll(
@Param("id") projectId: string,
@Body()
body: {
traceId?: string;
@ -27,6 +37,23 @@ export class LoggerController {
offset: number;
}
) {
return this.loggerService.find(body);
return this.loggerService.findByProjectId(projectId, body);
}
@Post("/:id/find")
@UseGuards(QueryGuard)
find(
@Param("id") _id: string,
@Body()
body: {
traceId?: string;
fromDate?: Date;
toDate?: Date;
url?: string;
limit: number;
offset: number;
}
) {
return this.loggerService.find(_id, body);
}
}