Skip to content

Commit

Permalink
Getting all posts with the author bug fixed -- user lazy entity loade…
Browse files Browse the repository at this point in the history
…d --
  • Loading branch information
devbenho committed Jun 1, 2024
1 parent 597da33 commit efb032e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 5 additions & 1 deletion server/src/infrastructure/posts/post.repository.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ export class PostRepository implements IPostRepository {

async findAll(limit: number, page: number): Promise<Post[]> {
const [posts, count] = await this._repository.findAndCount();
const postPromises = posts.map(post => PostMapper.toDomain(post));
const postPromises = posts.map(async post =>
PostMapper.toDomain(post, {
author: await post.author,
}),
);
return Promise.all(postPromises);
}

Expand Down
12 changes: 5 additions & 7 deletions server/src/web/process.log
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{"level":30,"time":1717202072939,"msg":"Application is running on port 2105 🚀"}
{"level":30,"time":1717202072942,"msg":"Environment: development"}
{"level":30,"time":1717202072968,"msg":"Data source initialized"}
{"level":30,"time":1717202075408,"msg":"Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI5YWIxYjMwYS1iNjE2LTQwZDktODAzZi1jNzg1MzAzOGNkNzUiLCJpYXQiOjE3MTcxNTMzMTd9.rvPLsi6NPcwTCUEcko2m5AAFraL6qVkzNFnUGQfeRmc"}
{"level":30,"time":1717202075418,"msg":"PostsController.create"}
{"level":30,"time":1717202075420,"msg":"CreatePostUseCase.performOperation"}
{"level":30,"time":1717202075420,"msg":"mapped post is kjkhkhkhfkldhskjhdfksjahjdshajkhfdjskahfsdhjksah"}
{"level":30,"time":1717202659332,"msg":"Application is running on port 2105 🚀"}
{"level":30,"time":1717202659336,"msg":"Environment: development"}
{"level":30,"time":1717202659359,"msg":"Data source initialized"}
{"level":30,"time":1717202660982,"msg":"Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJlOGU4MTMxMi1hNDNlLTQ2NGEtYjRjNy1kYjc2NTI5YzIxOWIiLCJpYXQiOjE3MTcwMjIxNzd9.5RnwT3TDulPO5cEw5_AkqZBe4LXSfmrr6gCbCrLQeZ8"}
{"level":30,"time":1717202661002,"msg":"PostsController.findAll"}

0 comments on commit efb032e

Please sign in to comment.