devのクエリ実行速度を調査するためのログを追加

This commit is contained in:
saito.k 2023-11-16 17:00:13 +09:00
parent b3660fbb69
commit da131e82e6
2 changed files with 4 additions and 2 deletions

View File

@ -101,6 +101,7 @@ import * as redisStore from 'cache-manager-redis-store';
database: configService.get('DB_NAME'),
autoLoadEntities: true, // forFeature()で登録されたEntityを自動的にロード
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
logging: true,
}),
inject: [ConfigService],
}),

View File

@ -343,6 +343,7 @@ export class UsersRepositoryService {
async findSameAccountUsers(external_id: string): Promise<User[]> {
return await this.dataSource.transaction(async (entityManager) => {
const repo = entityManager.getRepository(User);
console.log(new Date());
const accountId = (await repo.findOne({ where: { external_id } }))
?.account_id;
@ -350,7 +351,7 @@ export class UsersRepositoryService {
if (!accountId) {
throw new AccountNotFoundError('Account is Not Found.');
}
console.log(new Date());
const dbUsers = await repo.find({
relations: {
userGroupMembers: {
@ -360,7 +361,7 @@ export class UsersRepositoryService {
},
where: { account_id: accountId },
});
console.log(new Date());
return dbUsers;
});
}