diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/AccountController.java b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/AccountController.java index bc90732d6e6d245d3a6047d1c9e61e64525861d1..9ffad906f6dec2229cf69eb133fdb1d9761d5ecc 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/AccountController.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/AccountController.java @@ -41,7 +41,10 @@ public class AccountController { @GetMapping("/accounts/profile/{bankProfileId}") public ResponseEntity<List<Account>> getAccounts(@PathVariable Long bankProfileId) { List<Account> accounts = accountService.getAccountsByBankProfileId(bankProfileId); - log.info("[AccountController:getAccounts] accounts: {}", accounts); + log.info("[AccountController:getAccounts] bankProfileId: {}", bankProfileId); + for (Account account : accounts) { + log.info("[AccountController:getAccounts] accountBban: {}", account.getBban()); + } return ResponseEntity.ok(accounts); } @@ -55,7 +58,10 @@ public class AccountController { @GetMapping("/accounts/ssn/{ssn}") public ResponseEntity<List<Account>> getAccountsBySsn(@PathVariable Long ssn) { List<Account> accounts = accountService.getAccountsBySsn(ssn); - log.info("[AccountController:getAccountsBySsn] accounts: {}", accounts); + log.info("[AccountController:getAccountsBySsn] ssn: {}", ssn); + for (Account account : accounts) { + log.info("[AccountController:getAccountsBySsn] accountBban: {}", account.getBban()); + } return ResponseEntity.ok(accounts); } @@ -68,7 +74,7 @@ public class AccountController { @PostMapping("/create-account") public ResponseEntity<AccountResponseDTO> createAccount(@RequestBody AccountRequestDTO accountRequestDTO) { AccountResponseDTO accountResponseDTO = accountService.saveAccount(accountRequestDTO); - log.info("[AccountController:createAccount] account: {}", accountResponseDTO); + log.info("[AccountController:createAccount] accountBankProfileId: {}", accountResponseDTO.getBankProfileId()); return ResponseEntity.ok(accountResponseDTO); } } \ No newline at end of file diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/BankProfileController.java b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/BankProfileController.java index 17bdd30027cf9585b6111250fa13c28ce076118f..2905a6b43cb933eae51099bdda7f75a0a28817a8 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/BankProfileController.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/BankProfileController.java @@ -34,7 +34,7 @@ public class BankProfileController { }) @PostMapping("/create-profile") public BankProfileResponseDTO createBankProfile(@RequestBody BankProfileDTO bankProfileDTO) { - log.info("[BankProfileController:createBankProfile] bank-profile: {}", bankProfileDTO); + log.info("[BankProfileController:createBankProfile] bank-profileSsn: {}", bankProfileDTO.getSsn()); return bankProfileService.saveBankProfile(bankProfileDTO); } diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/TransactionController.java b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/TransactionController.java index 9f3529733e7e226f42f8296ef0087dbd5233012a..9abda39988fb35a827f2aacab0f8b110b87b2073 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/TransactionController.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/controller/TransactionController.java @@ -36,7 +36,7 @@ public class TransactionController { @PostMapping("/norwegian-domestic-payment-to-self") public ResponseEntity<TransactionDTO> transferToSelf(@RequestBody TransactionDTO transactionRequest) { transactionService.saveTransaction(transactionRequest); - log.info("[TransactionController:transferToSelf] transaction: {}", transactionRequest); + log.info("[TransactionController:transferToSelf] transaction amount {} from: {} -> {}", transactionRequest.getAmount(), transactionRequest.getCreditorBBAN(), transactionRequest.getDebtorBBAN()); return ResponseEntity.ok(transactionRequest); } } diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/AccountServiceImpl.java b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/AccountServiceImpl.java index af84dedd7d26290e4a2cbf608b29c7c07a0f3491..e373afb421b27f1ab4cfa634f1a090dcf10e9b33 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/AccountServiceImpl.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/AccountServiceImpl.java @@ -43,7 +43,10 @@ public class AccountServiceImpl implements AccountService { throw new ResponseStatusException(HttpStatusCode.valueOf(404), "Bank profile not found"); } accountList = accountRepository.findAllByBankProfileId(id); - log.info("[AccountServiceImpl:getAccountsByBankProfileId] accounts: {}", accountList); + log.info("[AccountServiceImpl:getAccountsByBankProfileId] bankProfileId: {}", id); + for (Account account : accountList) { + log.info("[AccountServiceImpl:getAccountsByBankProfileId] accountBban: {}", account.getBban()); + } return accountList; } @@ -63,7 +66,10 @@ public class AccountServiceImpl implements AccountService { throw new ResponseStatusException(HttpStatusCode.valueOf(404), "Bank profile not found"); } accountList = accountRepository.findAllByBankProfileSsn(ssn); - log.info("[AccountServiceImpl:getAccountsBySsn] accounts: {}", accountList); + log.info("[AccountServiceImpl:getAccountsBySsn] ssn: {}", ssn); + for (Account account : accountList) { + log.info("[AccountServiceImpl:getAccountsBySsn] accountBban: {}", account.getBban()); + } return accountList; } @@ -89,7 +95,7 @@ public class AccountServiceImpl implements AccountService { accountRepository.save(newAccount); accountResponseDTO.setBalance(newAccount.getBalance()); accountResponseDTO.setBankProfileId(newAccount.getBankProfile().getId()); - log.info("[AccountServiceImpl:saveAccount] account: {}", newAccount); + log.info("[AccountServiceImpl:saveAccount] accountBban: {}", newAccount.getBban()); } catch (Exception e) { throw new ResponseStatusException(HttpStatusCode.valueOf(400), e.getMessage()); } @@ -109,7 +115,7 @@ public class AccountServiceImpl implements AccountService { log.error("[AccountServiceImpl:getAccountByBban] account: Account not found {}", bban); throw new ResponseStatusException(HttpStatusCode.valueOf(404), "Account not found"); } - log.info("[AccountServiceImpl:getAccountByBban] account: {}", account); + log.info("[AccountServiceImpl:getAccountByBban] accountBban: {}", account.get().getBban()); return account.get(); } } diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/BankProfileServiceImpl.java b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/BankProfileServiceImpl.java index b3c41067370fe775342aedb90d64ade40b4ecb06..331a4c898ac5fb42c5e77ed02f205f9cd409f2e2 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/BankProfileServiceImpl.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/BankProfileServiceImpl.java @@ -53,7 +53,7 @@ public class BankProfileServiceImpl implements BankProfileService { HttpStatusCode.valueOf(400), "Could not create bank profile"); } - log.info("[BankProfileServiceImpl:saveBankProfile] bank profile: {}", bankProfileDTO); + log.info("[BankProfileServiceImpl:saveBankProfile] bank-profileSsn: {}", bankProfileDTO.getSsn()); return savedProfileResponse; } } diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/TransactionServiceImpl.java b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/TransactionServiceImpl.java index b4b3789ebfb77c692033eee732fe422dc2c5b6ec..8015b5272cd4b8072b04c227d31423aa6b48dc6b 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/TransactionServiceImpl.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/bank/service/impl/TransactionServiceImpl.java @@ -80,7 +80,7 @@ public class TransactionServiceImpl implements TransactionService { accountRepository.updateBalance(debtorBalance, debtorAccount.get().getBban()); accountRepository.updateBalance(creditorBalance, creditorAccount.get().getBban()); transactionRepository.save(savedTransaction); - log.info("[TransactionService:saveTransaction] saved transaction: {}", savedTransaction); + log.info("[TransactionService:saveTransaction] saved transaction with id: {}", savedTransaction.getId()); } catch (Exception e) { log.error("[TransactionService:saveTransaction] Transaction failed"); throw new ResponseStatusException(HttpStatusCode.valueOf(400), e.getMessage()); diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/badge/BadgeController.java b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/badge/BadgeController.java index 2ac80f37c2dd839adda64b83744fb75ff8762a0a..ffbabf712bcc0ff18736607a84ebaef7e882e78b 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/badge/BadgeController.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/badge/BadgeController.java @@ -68,7 +68,7 @@ public class BadgeController { public ResponseEntity<BadgeDTO> getBadge(@PathVariable long badgeId) { Badge badge = badgeService.findBadgeByBadgeId(badgeId); BadgeDTO response = modelMapper.map(badge, BadgeDTO.class); - log.info("[BadgeController:getBadge] badge: {}", response); + log.info("[BadgeController:getBadge] badge: {}", badge.getId()); return ResponseEntity.ok(response); } @@ -87,7 +87,9 @@ public class BadgeController { public ResponseEntity<List<BadgeDTO>> getAllBadges() { List<Badge> badges = badgeService.findAllBadges(); List<BadgeDTO> badgeDTOS = badges.stream().map(badge -> modelMapper.map(badge, BadgeDTO.class)).toList(); - log.info("[BadgeController:getAllBadges] badges: {}", badgeDTOS); + for(BadgeDTO badgeDTO : badgeDTOS) { + log.info("[BadgeController:getAllBadges] badge: {}", badgeDTO.getId()); + } return ResponseEntity.ok(badgeDTOS); } @@ -107,7 +109,10 @@ public class BadgeController { public ResponseEntity<List<BadgeDTO>> getBadgesUnlockedByActiveUser(@AuthenticationPrincipal AuthIdentity identity) { List<Badge> badges = badgeService.findBadgesUnlockedByUser(identity.getId()); List<BadgeDTO> badgeDTOS = badges.stream().map(badge -> modelMapper.map(badge, BadgeDTO.class)).toList(); - log.info("[BadgeController:getBadgesUnlockedByUser] badges: {}", badgeDTOS); + log.info("[BadgeController:getBadgesUnlockedByUser] userId: {}", identity.getId()); + for(BadgeDTO badgeDTO : badgeDTOS) { + log.info("[BadgeController:getBadgesUnlockedByUser] badge: {}", badgeDTO.getId()); + } return ResponseEntity.ok(badgeDTOS); } @@ -127,7 +132,10 @@ public class BadgeController { public ResponseEntity<List<BadgeDTO>> getBadgesUnlockedByUser(@PathVariable Long userId) { List<Badge> badges = badgeService.findBadgesUnlockedByUser(userId); List<BadgeDTO> badgeDTOS = badges.stream().map(badge -> modelMapper.map(badge, BadgeDTO.class)).toList(); - log.info("[BadgeController:getBadgesUnlockedByUser] badges: {}", badgeDTOS); + log.info("[BadgeController:getBadgesUnlockedByUser] userId: {}", userId); + for(BadgeDTO badgeDTO : badgeDTOS) { + log.info("[BadgeController:getBadgesUnlockedByUser] badge: {}", badgeDTO.getId()); + } return ResponseEntity.ok(badgeDTOS); } @@ -147,7 +155,10 @@ public class BadgeController { public ResponseEntity<List<BadgeDTO>> getBadgesNotUnlockedByActiveUser(@AuthenticationPrincipal AuthIdentity identity) { List<Badge> badges = badgeService.findBadgesNotUnlockedByUser(identity.getId()); List<BadgeDTO> badgeDTOS = badges.stream().map(badge -> modelMapper.map(badge, BadgeDTO.class)).toList(); - log.info("[BadgeController:getBadgesNotUnlockedByUser] badges: {}", badgeDTOS); + log.info("[BadgeController:getBadgesNotUnlockedByUser] userId: {}", identity.getId()); + for(BadgeDTO badgeDTO : badgeDTOS) { + log.info("[BadgeController:getBadgesNotUnlockedByUser] badge: {}", badgeDTO.getId()); + } return ResponseEntity.ok(badgeDTOS); } @@ -178,7 +189,9 @@ public class BadgeController { notificationService.updateNotification(notification); } List<BadgeDTO> badgeDTOS = badges.stream().map(badge -> modelMapper.map(badge, BadgeDTO.class)).toList(); - log.info("[BadgeController:updateUnlockedBadges] unlocked badges: {}", badgeDTOS); + for(BadgeDTO badgeDTO : badgeDTOS) { + log.info("[BadgeController:updateUnlockedBadges] badge: {}", badgeDTO.getId()); + } return ResponseEntity.ok(badgeDTOS); } } \ No newline at end of file diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/budget/BudgetController.java b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/budget/BudgetController.java index 69a3cb79f0049924ce6ca4e470ee97ac708950d4..1ebb7caba862d444d6e145fbdaf918ec401a2385 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/budget/BudgetController.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/budget/BudgetController.java @@ -74,9 +74,9 @@ public class BudgetController { List<BudgetResponseDTO> budgetDTOs = new ArrayList<>(); for (Budget budget : budgets) { budgetDTOs.add(modelMapper.map(budget, BudgetResponseDTO.class)); + log.info("[BudgetController:getBudgetsByUser] budget: {}", budget.getId()); } Collections.reverse(budgetDTOs); - log.info("[BudgetController:getBudgetByUser] budgets: {}", budgetDTOs); return ResponseEntity.ok(budgetDTOs); } @@ -95,7 +95,7 @@ public class BudgetController { public ResponseEntity<BudgetResponseDTO> getBudget(@PathVariable long budgetId) { Budget budget = budgetService.findBudgetById(budgetId); BudgetResponseDTO response = modelMapper.map(budget, BudgetResponseDTO.class); - log.info("[BudgetController:getBudget] budget: {}", response); + log.info("[BudgetController:getBudget] budget: {}", response.getId()); return ResponseEntity.ok(response); } @@ -118,7 +118,7 @@ public class BudgetController { budget.setUser(userService.findById(identity.getId())); budget.setCreatedAt(Timestamp.from(Instant.now())); budgetService.createBudget(budget); - log.info("[BudgetController:createBudget] budget created: {}", budget); + log.info("[BudgetController:createBudget] budget created: {}", budget.getId()); return ResponseEntity.ok().build(); } @@ -142,7 +142,7 @@ public class BudgetController { budget.setBudgetAmount(request.getBudgetAmount()); budget.setExpenseAmount(request.getExpenseAmount()); budgetService.updateBudget(budget); - log.info("[BudgetController:updateBudget] budget updated: {}", budget); + log.info("[BudgetController:updateBudget] budget updated: {}", budget.getId()); return ResponseEntity.ok().build(); } @@ -183,7 +183,7 @@ public class BudgetController { Expense expense = modelMapper.map(request, Expense.class); expense.setBudget(budget); budgetService.createExpense(expense); - log.info("[BudgetController:updateExpense] expense updated: {}", expense); + log.info("[BudgetController:updateExpense] expense updated: {}", expense.getId()); return ResponseEntity.ok(request); } @@ -202,7 +202,7 @@ public class BudgetController { public ResponseEntity<ExpenseResponseDTO> getExpense(@PathVariable Long expenseId) { Expense expense = budgetService.findExpenseById(expenseId); ExpenseResponseDTO response = modelMapper.map(expense, ExpenseResponseDTO.class); - log.info("[BudgetController:getExpense] expense: {}", response); + log.info("[BudgetController:getExpense] expense: {}", response.getExpenseId()); return ResponseEntity.ok(response); } @@ -221,11 +221,12 @@ public class BudgetController { public ResponseEntity<List<ExpenseResponseDTO>> getExpenses(@PathVariable Long budgetId) { List<Expense> expenses = budgetService.findExpensesByBudgetId(budgetId); List<ExpenseResponseDTO> expenseDTOs = new ArrayList<>(); + log.info("[BudgetController:getExpenses] budget: {}", budgetId); for (Expense expense : expenses) { expenseDTOs.add(modelMapper.map(expense, ExpenseResponseDTO.class)); + log.info("[BudgetController:getExpenses] expense: {}", expense.getId()); } Collections.reverse(expenseDTOs); - log.info("[BudgetController:getExpenses] expenses: {}", expenseDTOs); return ResponseEntity.ok(expenseDTOs); } diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/friend/FriendController.java b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/friend/FriendController.java index 6a6d4b09a399cee9efdab344255b5bcfe238d940..c2f0c6ad77dd26b1ad80bf480dc5f485f5aeeea3 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/friend/FriendController.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/friend/FriendController.java @@ -61,7 +61,10 @@ public class FriendController { @GetMapping public ResponseEntity<List<UserDTO>> getFriends(@AuthenticationPrincipal AuthIdentity identity) { List<User> friendsUser = userService.getFriends(identity.getId()); - log.info("[FriendController:getFriends] friends: {}", friendsUser); + log.info("[FriendController:getFriends] user: {}", identity.getId()); + for (User user : friendsUser) { + log.info("[FriendController:getFriends] friend: {}", user.getId()); + } return ResponseEntity.ok(convertToDto(friendsUser)); } @@ -72,7 +75,10 @@ public class FriendController { @GetMapping("/requests") public ResponseEntity<List<UserDTO>> getFriendRequests(@AuthenticationPrincipal AuthIdentity identity) { List<User> friendsUser = userService.getFriendRequests(identity.getId()); - log.info("[FriendController:getFriendRequests] friend requests: {}", friendsUser); + log.info("[FriendController:getFriendRequests] user: {}", identity.getId()); + for (User user : friendsUser) { + log.info("[FriendController:getFriendRequests] friend requests: {}", user.getId()); + } return ResponseEntity.ok(convertToDto(friendsUser)); } @@ -89,7 +95,7 @@ public class FriendController { Notification notification = new Notification(null, friend, "You have received a new friend request from " + user.getFirstName(), true, NotificationType.FRIEND_REQUEST, Timestamp.from(Instant.now())); notificationService.updateNotification(notification); - log.info("[FriendController:addFriendRequest] from: {} to: {}", user, friend); + log.info("[FriendController:addFriendRequest] from: {} to: {}", user.getId(), friend.getId()); } @Operation(summary = "Accept a friend request", description = "Accepts a friend request from another user.") @@ -107,7 +113,7 @@ public class FriendController { return ResponseEntity.status(HttpStatus.NOT_FOUND).body("No friend request found."); } friendService.acceptFriendRequest(friendRequest); - log.info("[FriendController:acceptFriendRequest] Friend request successfully accepted between: {} and: {}", user, friend); + log.info("[FriendController:acceptFriendRequest] Friend request successfully accepted between: {} and: {}", user.getId(), friend.getId()); return ResponseEntity.ok().build(); } @@ -128,7 +134,7 @@ public class FriendController { } friendService.deleteFriendOrFriendRequest(friendStatus); - log.info("[FriendController:acceptFriendRequest] Friend request successfully deleted between: {} and: {}", user, friend); + log.info("[FriendController:acceptFriendRequest] Friend request successfully deleted between: {} and: {}", user.getId(), friend.getId()); return ResponseEntity.ok().build(); } diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/goal/GoalController.java b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/goal/GoalController.java index ca2aaea62cef4572bcec15ef0265ece0d3a485f5..d523fddfe639fbdd1ad8899a0b89e233a0e518db 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/goal/GoalController.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/goal/GoalController.java @@ -65,7 +65,7 @@ public class GoalController { Goal createGoal = modelMapper.map(request, Goal.class); Goal goal = goalService.createGoal(createGoal, identity.getId()); GoalDTO goalDTO = modelMapper.map(goal, GoalDTO.class); - log.info("[GoalController:createGoal] goal: {}", goalDTO); + log.info("[GoalController:createGoal] goal: {}", goalDTO.getId()); return ResponseEntity.status(HttpStatus.CREATED).body(goalDTO); } @@ -83,7 +83,10 @@ public class GoalController { public ResponseEntity<List<GoalDTO>> getGoals(@AuthenticationPrincipal AuthIdentity identity) { List<Goal> goals = goalService.getGoals(identity.getId()); List<GoalDTO> goalsDTO = goals.stream().map(goal -> modelMapper.map(goal, GoalDTO.class)).toList(); - log.info("[GoalController:getGoals] goals: {}", goalsDTO); + log.info("[GoalController:getGoals] user: {}", identity.getId()); + for(GoalDTO goalDTO : goalsDTO) { + log.info("[GoalController:getGoals] goal: {}", goalDTO.getId()); + } return ResponseEntity.ok(goalsDTO); } @@ -109,7 +112,7 @@ public class GoalController { @RequestBody MarkChallengeDTO request) { challengeService.updateProgress(identity.getId(), request.getId(), request.getDay(), request.getAmount()); - log.info("[GoalController:updateChallenge] challenge: {}", request); + log.info("[GoalController:updateChallenge] challenge: {}", request.getId()); return ResponseEntity.status(HttpStatus.ACCEPTED).build(); } @@ -130,7 +133,7 @@ public class GoalController { public ResponseEntity<Void> updateChallengeAmount(@AuthenticationPrincipal AuthIdentity identity, @RequestBody MarkChallengeDTO request) { challengeService.updateSavingAmount(identity.getId(), request.getId(), request.getAmount()); - log.info("[GoalController:updateChallengeAmount] challenge: {}", request); + log.info("[GoalController:updateChallengeAmount] challenge: {}", request.getId()); return ResponseEntity.status(HttpStatus.ACCEPTED).build(); } @@ -138,7 +141,7 @@ public class GoalController { public ResponseEntity<GoalDTO> getGoal(@PathVariable Long id) { Goal goal = goalService.getGoal(id); GoalDTO goalDTO = modelMapper.map(goal, GoalDTO.class); - log.info("[GoalController:getGoal] goal: {}", goalDTO); + log.info("[GoalController:getGoal] goal: {}", goalDTO.getId()); return ResponseEntity.ok(goalDTO); } diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/item/ItemController.java b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/item/ItemController.java index 07e059b92028ce421bfbcfe4ee23b4787d8ec5bb..e742dc3fc4e6a6786c34d5d2d673a672b15f5fff 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/item/ItemController.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/item/ItemController.java @@ -62,9 +62,9 @@ public class ItemController { if(inventory.contains(item)) { itemDTO.setAlreadyBought(true); } + log.info("[ItemController:getStore] item: {}", itemDTO.getId()); storeDTO.add(itemDTO); } - log.info("[ItemController:getStore] store: {}", storeDTO); return ResponseEntity.ok(storeDTO); } @@ -78,8 +78,8 @@ public class ItemController { List<InventoryDTO> inventoryDTO = new ArrayList<>(); for(Item item : inventory) { inventoryDTO.add(modelMapper.map(item, InventoryDTO.class)); + log.info("[ItemController:getInventory] item: {}", item.getId()); } - log.info("[ItemController:getInventory] inventory: {}", inventoryDTO); return ResponseEntity.ok(inventoryDTO); } @@ -93,8 +93,8 @@ public class ItemController { List<InventoryDTO> inventoryDTO = new ArrayList<>(); for(Item item : inventory) { inventoryDTO.add(modelMapper.map(item, InventoryDTO.class)); + log.info("[ItemController:getInventoryByUserId] item: {}", item.getId()); } - log.info("[ItemController:getInventoryByUserId] inventory: {}", inventoryDTO); return ResponseEntity.ok(inventoryDTO); } @@ -111,7 +111,7 @@ public class ItemController { boolean purchaseSuccessful = itemService.addItem(user, item); if (purchaseSuccessful) { - log.info("[ItemController:buyItem] item: {}, user: {}", item, user); + log.info("[ItemController:buyItem] item: {}, user: {}", item.getId(), user.getId()); return ResponseEntity.status(HttpStatus.CREATED).build(); } else { log.error("[ItemController:buyItem] Insufficient points to purchase the item"); diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/leaderboard/LeaderboardController.java b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/leaderboard/LeaderboardController.java index 380427fe3ad68fd406bc3712c81e5abe3e554c28..3547801e3f7d42219eb3487979570543ebd690a9 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/leaderboard/LeaderboardController.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/leaderboard/LeaderboardController.java @@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import no.ntnu.idi.stud.savingsapp.dto.leaderboard.LeaderboardDTO; +import no.ntnu.idi.stud.savingsapp.dto.leaderboard.LeaderboardEntryDTO; import no.ntnu.idi.stud.savingsapp.model.leaderboard.Leaderboard; import no.ntnu.idi.stud.savingsapp.model.leaderboard.LeaderboardFilter; import no.ntnu.idi.stud.savingsapp.model.leaderboard.LeaderboardType; @@ -59,7 +60,12 @@ public class LeaderboardController { Leaderboard leaderboard = leaderboardService.getTopUsers( LeaderboardType.valueOf(type), LeaderboardFilter.valueOf(filter), entryCount, identity.getId()); LeaderboardDTO leaderboardDTO = modelMapper.map(leaderboard, LeaderboardDTO.class); - log.info("[LeaderboardController:getLeaderboard] leaderboard: {}", leaderboardDTO); + log.info("[LeaderboardController:getLeaderboard] type: {}, filter: {}, count: {}", + type, filter, entryCount); + for(LeaderboardEntryDTO leaderboardEntryDTO : leaderboardDTO.getEntries()) { + log.info("[LeaderboardController:getLeaderboard] entry: {}, rank: {}, score: {}", + leaderboardEntryDTO.getUser().getId(), leaderboardEntryDTO.getRank(), leaderboardEntryDTO.getScore()); + } return ResponseEntity.ok(leaderboardDTO); } @@ -83,7 +89,12 @@ public class LeaderboardController { Leaderboard leaderboard = leaderboardService.getSurrounding( LeaderboardType.valueOf(type), LeaderboardFilter.valueOf(filter), entryCount, identity.getId()); LeaderboardDTO leaderboardDTO = modelMapper.map(leaderboard, LeaderboardDTO.class); - log.info("[LeaderboardController:getSurrounding] leaderboard: {}", leaderboardDTO); + log.info("[LeaderboardController:getLeaderboard] type: {}, filter: {}, count: {}", + type, filter, entryCount); + for(LeaderboardEntryDTO leaderboardEntryDTO : leaderboardDTO.getEntries()) { + log.info("[LeaderboardController:getLeaderboard] entry: {}, rank: {}, score: {}", + leaderboardEntryDTO.getUser().getId(), leaderboardEntryDTO.getRank(), leaderboardEntryDTO.getScore()); + } return ResponseEntity.ok(leaderboardDTO); } diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/notification/NotificationController.java b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/notification/NotificationController.java index 293ae332a952b126cbaab0338eaada3042602cd7..57b361ddc9bd1b41a71832013f2d72b6ef6d1ec8 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/notification/NotificationController.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/notification/NotificationController.java @@ -63,7 +63,7 @@ public class NotificationController { public ResponseEntity<NotificationDTO> getNotification(@PathVariable long notificationId) { Notification notification = notificationService.getNotificationById(notificationId); NotificationDTO response = modelMapper.map(notification, NotificationDTO.class); - log.info("[NotificationController:getNotification] notification: {}", response); + log.info("[NotificationController:getNotification] notification: {}", response.getId()); return ResponseEntity.ok(response); } @@ -82,7 +82,9 @@ public class NotificationController { public ResponseEntity<List<NotificationDTO>> getNotificationByUser(@AuthenticationPrincipal AuthIdentity identity) { List<Notification> notifications = notificationService.getNotificationsByUserId(identity.getId()); List<NotificationDTO> notificationDTOs = notifications.stream().map(notification -> modelMapper.map(notification, NotificationDTO.class)).toList(); - log.info("[NotificationController:getNotificationByUser] notifications: {}", notificationDTOs); + for (NotificationDTO notificationDTO : notificationDTOs) { + log.info("[NotificationController:getNotificationByUser] notification: {}", notificationDTO.getId()); + } return ResponseEntity.ok(notificationDTOs); } @@ -101,7 +103,9 @@ public class NotificationController { public ResponseEntity<List<NotificationDTO>> getUnreadNotificationByUser(@AuthenticationPrincipal AuthIdentity identity) { List<Notification> notifications = notificationService.getUnreadNotificationsByUserId(identity.getId()); List<NotificationDTO> notificationsDTOs = notifications.stream().map(notification -> modelMapper.map(notification, NotificationDTO.class)).toList(); - log.info("[NotificationController:getUnreadNotificationByUser] notifications: {}", notificationsDTOs); + for(NotificationDTO notificationDTO : notificationsDTOs) { + log.info("[NotificationController:getUnreadNotificationByUser] notification: {}", notificationDTO.getId()); + } return ResponseEntity.ok(notificationsDTOs); } @@ -127,7 +131,7 @@ public class NotificationController { User user = userService.findById(identity.getId()); notification.setUser(user); notificationService.updateNotification(notification); - log.info("[NotificationController:updateNotification] updated notification: {}", request); + log.info("[NotificationController:updateNotification] updated notification: {}", request.getId()); return ResponseEntity.ok().build(); } } diff --git a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/user/UserController.java b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/user/UserController.java index add2356a71a66320ed2c4a21eead5f7406f8f457..e32d27b4efa7eaa18c8d1c6492886098168985c3 100644 --- a/src/main/java/no/ntnu/idi/stud/savingsapp/controller/user/UserController.java +++ b/src/main/java/no/ntnu/idi/stud/savingsapp/controller/user/UserController.java @@ -70,7 +70,7 @@ public class UserController { public ResponseEntity<UserDTO> getUser(@AuthenticationPrincipal AuthIdentity identity) { User user = userService.findById(identity.getId()); UserDTO userDTO = modelMapper.map(user, UserDTO.class); - log.info("[UserController:getUser] user: {}", userDTO); + log.info("[UserController:getUser] user: {}", userDTO.getId()); return ResponseEntity.ok(userDTO); } @@ -90,7 +90,7 @@ public class UserController { public ResponseEntity<ProfileDTO> getProfile(@PathVariable long userId) { User user = userService.findById(userId); ProfileDTO profileDTO = modelMapper.map(user, ProfileDTO.class); - log.info("[UserController:getProfile] profile: {}", profileDTO); + log.info("[UserController:getProfile] profile: {}", profileDTO.getId()); return ResponseEntity.ok(profileDTO); } @@ -211,7 +211,7 @@ public class UserController { @RequestBody @Valid BankAccountDTO bankAccountDTO) { BankAccountType accountType = modelMapper.map(bankAccountDTO.getBankAccountType(), BankAccountType.class); - log.info("[UserController:selectBankAccount], bankAccount: {}", bankAccountDTO); + log.info("[UserController:selectBankAccount], bankAccountBban: {}", bankAccountDTO.getBban()); return userService.selectBankAccount( accountType, bankAccountDTO.getBban(), @@ -233,8 +233,8 @@ public class UserController { for(User user : users) { UserDTO userDTO = modelMapper.map(user, UserDTO.class); userDTOs.add(userDTO); + log.info("[UserController:getUsersByNameAndFilter] user: {}", userDTO.getId()); } - log.info("[UserController:getRandomUsers] random users: {}", userDTOs); return ResponseEntity.ok(userDTOs); } @@ -248,7 +248,7 @@ public class UserController { @PostMapping("/send-feedback") public ResponseEntity<Void> sendFeedback(@Validated @RequestBody FeedbackRequestDTO feedbackRequestDTO) { userService.sendFeedback(feedbackRequestDTO.getEmail(), feedbackRequestDTO.getMessage()); - log.info("[UserController:sendFeedback] feedback: {}", feedbackRequestDTO); + log.info("[UserController:sendFeedback] feedback: {}", feedbackRequestDTO.getMessage()); return ResponseEntity.ok().build(); } @@ -270,7 +270,9 @@ public class UserController { } List<Feedback> feedbacks = userService.getFeedback(); List<FeedbackResponseDTO> feedbackResponseDTOS = feedbacks.stream().map(quiz -> modelMapper.map(quiz, FeedbackResponseDTO.class)).toList(); - log.info("[UserController:getFeedback] feedback: {}", feedbackResponseDTOS); + for(FeedbackResponseDTO feedbackResponseDTO : feedbackResponseDTOS) { + log.info("[UserController:getFeedback] feedback: {}", feedbackResponseDTO.getId()); + } return ResponseEntity.ok(feedbackResponseDTOS); } @@ -289,8 +291,8 @@ public class UserController { for(User user : users) { UserDTO userDTO = modelMapper.map(user, UserDTO.class); userDTOs.add(userDTO); + log.info("[UserController:getRandomUsers] user: {}", userDTO.getId()); } - log.info("[UserController:getUsersByNameAndFilter] users: {}", userDTOs); return ResponseEntity.ok(userDTOs); }