Skip to content

Commit

Permalink
Fix: getAllUsers 로직
Browse files Browse the repository at this point in the history
  • Loading branch information
minchodang committed Dec 6, 2024
1 parent 00f6078 commit f2bf9e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
5 changes: 3 additions & 2 deletions src/modules/user/user.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export class UserRepository {

console.log(
'Filtered UserInfo data:',
JSON.stringify(result.Items, null, 2),
// JSON.stringify(result.Items, null, 2),
result.Items,
);

if (!result.Items || result.Items.length === 0) {
Expand All @@ -60,7 +61,7 @@ export class UserRepository {
id: item.PK,
email: item.email,
nickname: item.nickname,
...item,
password: item.password,
}));
} catch (e) {
console.error('Error in findAllUsers:', e);
Expand Down
16 changes: 2 additions & 14 deletions src/modules/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,8 @@ export class UserService {
return hashedPassword;
}

async getAllUsers(): Promise<User[]> {
const users = await this.usersRepository.findAllUsers();
console.log('DynamoDB users:', JSON.stringify(users, null, 2));
const mappedUsers = users.map((user) => {
console.log('Processing user:', JSON.stringify(user, null, 2));
return {
id: user.id,
email: user.email,
nickname: user.nickname,
...user,
};
});
console.log('Mapped users:', JSON.stringify(mappedUsers, null, 2));
return mappedUsers;
async getAllUsers() {
return await this.usersRepository.findAllUsers();
}

async update(
Expand Down

0 comments on commit f2bf9e1

Please sign in to comment.