update: user me data

This commit is contained in:
Mahyargdz
2025-05-24 15:26:48 +03:30
parent 8bbe821dc8
commit d5ae216784
4 changed files with 9 additions and 6 deletions
+3 -3
View File
@@ -7,13 +7,13 @@ import { ConfigModule } from "@nestjs/config";
import { ThrottlerModule } from "@nestjs/throttler";
import { TypeOrmModule } from "@nestjs/typeorm";
import { MailerModule } from "@nestjs-modules/mailer";
import { TelegrafModule } from "nestjs-telegraf";
// import { TelegrafModule } from "nestjs-telegraf";
import { bullMqConfig } from "./configs/bullmq.config";
import { cacheConfig } from "./configs/cache.config";
import { mailerConfig } from "./configs/mailer.config";
import { rateLimitConfig } from "./configs/rateLimit.config";
import { telegrafConfig } from "./configs/telegraf.config";
// import { telegrafConfig } from "./configs/telegraf.config";
import { databaseConfigs } from "./configs/typeorm.config";
import { HTTPLogger } from "./core/middlewares/logger.middleware";
import { AddressModule } from "./modules/address/address.module";
@@ -42,7 +42,7 @@ import { UsersModule } from "./modules/users/users.module";
import { WalletsModule } from "./modules/wallets/wallets.module";
@Module({
imports: [
TelegrafModule.forRootAsync(telegrafConfig()),
// TelegrafModule.forRootAsync(telegrafConfig()),
MailerModule.forRootAsync(mailerConfig()),
BullModule.forRootAsync(bullMqConfig()),
ThrottlerModule.forRootAsync(rateLimitConfig()),
+1 -1
View File
@@ -13,7 +13,7 @@ export function databaseConfigs(): TypeOrmModuleAsyncOptions {
username: configService.getOrThrow<string>("DB_USER"),
password: configService.getOrThrow<string>("DB_PASS"),
autoLoadEntities: true,
synchronize: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : true,
synchronize: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : false,
logging: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : true,
migrationsTableName: "typeorm_migrations",
migrationsRun: false,
+1 -1
View File
@@ -18,7 +18,7 @@ export class LoggerService extends Logger {
async sendLogToTelegram(level: string, message: string) {
try {
const logMessage = `🚨 *${level.toUpperCase()} Log:*\n${message}`;
await this.bot.telegram.sendMessage(this.chatId, logMessage, {
await this.bot?.telegram?.sendMessage(this.chatId, logMessage, {
parse_mode: "MarkdownV2",
});
} catch (error) {
+4 -1
View File
@@ -81,7 +81,10 @@ export class UsersService {
/************************************************************ */
async getMe(userId: string) {
const user = await this.userRepository.findOne({ where: { id: userId }, relations: { roles: true } });
const user = await this.userRepository.findOne({
where: { id: userId },
relations: { roles: true, realUser: { address: { city: { province: true } } }, legalUser: { address: { city: { province: true } } } },
});
if (!user) throw new BadRequestException(UserMessage.USER_NOT_FOUND);
return { user };
}