update: user me data
This commit is contained in:
+3
-3
@@ -7,13 +7,13 @@ import { ConfigModule } from "@nestjs/config";
|
|||||||
import { ThrottlerModule } from "@nestjs/throttler";
|
import { ThrottlerModule } from "@nestjs/throttler";
|
||||||
import { TypeOrmModule } from "@nestjs/typeorm";
|
import { TypeOrmModule } from "@nestjs/typeorm";
|
||||||
import { MailerModule } from "@nestjs-modules/mailer";
|
import { MailerModule } from "@nestjs-modules/mailer";
|
||||||
import { TelegrafModule } from "nestjs-telegraf";
|
// import { TelegrafModule } from "nestjs-telegraf";
|
||||||
|
|
||||||
import { bullMqConfig } from "./configs/bullmq.config";
|
import { bullMqConfig } from "./configs/bullmq.config";
|
||||||
import { cacheConfig } from "./configs/cache.config";
|
import { cacheConfig } from "./configs/cache.config";
|
||||||
import { mailerConfig } from "./configs/mailer.config";
|
import { mailerConfig } from "./configs/mailer.config";
|
||||||
import { rateLimitConfig } from "./configs/rateLimit.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 { databaseConfigs } from "./configs/typeorm.config";
|
||||||
import { HTTPLogger } from "./core/middlewares/logger.middleware";
|
import { HTTPLogger } from "./core/middlewares/logger.middleware";
|
||||||
import { AddressModule } from "./modules/address/address.module";
|
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";
|
import { WalletsModule } from "./modules/wallets/wallets.module";
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
TelegrafModule.forRootAsync(telegrafConfig()),
|
// TelegrafModule.forRootAsync(telegrafConfig()),
|
||||||
MailerModule.forRootAsync(mailerConfig()),
|
MailerModule.forRootAsync(mailerConfig()),
|
||||||
BullModule.forRootAsync(bullMqConfig()),
|
BullModule.forRootAsync(bullMqConfig()),
|
||||||
ThrottlerModule.forRootAsync(rateLimitConfig()),
|
ThrottlerModule.forRootAsync(rateLimitConfig()),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export function databaseConfigs(): TypeOrmModuleAsyncOptions {
|
|||||||
username: configService.getOrThrow<string>("DB_USER"),
|
username: configService.getOrThrow<string>("DB_USER"),
|
||||||
password: configService.getOrThrow<string>("DB_PASS"),
|
password: configService.getOrThrow<string>("DB_PASS"),
|
||||||
autoLoadEntities: true,
|
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,
|
logging: configService.getOrThrow<string>("NODE_ENV") == "production" ? false : true,
|
||||||
migrationsTableName: "typeorm_migrations",
|
migrationsTableName: "typeorm_migrations",
|
||||||
migrationsRun: false,
|
migrationsRun: false,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export class LoggerService extends Logger {
|
|||||||
async sendLogToTelegram(level: string, message: string) {
|
async sendLogToTelegram(level: string, message: string) {
|
||||||
try {
|
try {
|
||||||
const logMessage = `🚨 *${level.toUpperCase()} Log:*\n${message}`;
|
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",
|
parse_mode: "MarkdownV2",
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -81,7 +81,10 @@ export class UsersService {
|
|||||||
/************************************************************ */
|
/************************************************************ */
|
||||||
|
|
||||||
async getMe(userId: string) {
|
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);
|
if (!user) throw new BadRequestException(UserMessage.USER_NOT_FOUND);
|
||||||
return { user };
|
return { user };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user