feat: add logging functionality with LoggerService; implement log entity and controller; enhance query processing with logging support
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
import { Inject, Injectable } from "@nestjs/common";
|
||||
import { forwardRef, Inject, Injectable } from "@nestjs/common";
|
||||
import { InjectRepository } from "@nestjs/typeorm";
|
||||
import { Repository } from "typeorm";
|
||||
import { Project } from "./entities/project.entity";
|
||||
import { RedisClient } from "src/redis/redis.service";
|
||||
import { DatabaseManagerService } from "src/databaseManager/database/database.manager.service";
|
||||
|
||||
@Injectable()
|
||||
export class ProjectService {
|
||||
@ -10,12 +11,20 @@ export class ProjectService {
|
||||
@InjectRepository(Project)
|
||||
private readonly projectRepository: Repository<Project>,
|
||||
@Inject(RedisClient)
|
||||
private readonly redisClient: RedisClient
|
||||
private readonly redisClient: RedisClient,
|
||||
@Inject(forwardRef(() => DatabaseManagerService))
|
||||
private readonly databaseManagerService: DatabaseManagerService
|
||||
) {}
|
||||
|
||||
create(name: string) {
|
||||
async create(name: string, createDatabase: boolean = true) {
|
||||
const project = this.projectRepository.create({ name });
|
||||
return this.projectRepository.save(project);
|
||||
const projectSaved = await this.projectRepository.save(project);
|
||||
|
||||
if (createDatabase) {
|
||||
await this.databaseManagerService.createDatabase(projectSaved.id);
|
||||
}
|
||||
|
||||
return projectSaved;
|
||||
}
|
||||
|
||||
async findById(id: string) {
|
||||
|
||||
Reference in New Issue
Block a user