Skip to content

Commit

Permalink
fix: entries aggregation sum up failed
Browse files Browse the repository at this point in the history
  • Loading branch information
noobj committed Sep 22, 2022
1 parent 5c10f34 commit e3f4093
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cmd/ahorro/fetchentries/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ func Handler(ctx context.Context, request events.APIGatewayV2HTTPRequest) (event
}}},
},
{Key: "sum", Value: bson.D{{
Key: "$sum", Value: "$amount"},
Key: "$sum", Value: bson.M{
"$toDecimal": "$amount",
}},
}},
},
}}
Expand All @@ -122,7 +124,6 @@ func Handler(ctx context.Context, request events.APIGatewayV2HTTPRequest) (event
repoResults := entryRepository.Aggregate([]bson.D{matchStage, sortStage, groupStage, sortSumStage, lookupStage})
var categories []CategoryEntriesBundle
total := 0

for _, repoResult := range repoResults {
doc, _ := bson.Marshal(repoResult)

Expand Down
1 change: 0 additions & 1 deletion internal/middleware/jwt_auth/jwt_auth_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ func payloadHandler(ctx context.Context, payload interface{}) (context.Context,
}

userRepo := UserRepository.New()
defer userRepo.Disconnect()()
var user UserRepository.User

err := userRepo.FindOne(context.TODO(), bson.M{"_id": userObjId}).Decode(&user)
Expand Down

0 comments on commit e3f4093

Please sign in to comment.