This commit is contained in:
2024-11-17 15:37:47 +01:00
parent d41c876258
commit 4719cd3e9a
3 changed files with 29 additions and 2 deletions
@@ -141,6 +141,18 @@ public class TransactionResource {
);
}
@GetMapping("/forAccount/{userAccountId}")
public List<TransactionDTO> getAllTransactionsForAccountId(
@PathVariable(value = "userAccountId", required = false) final Long userAccountId,
@RequestParam(name = "eagerload", required = false, defaultValue = "true") boolean eagerload
) {
List<TransactionDTO> allTransactions = getAllTransactions(true);
if (userAccountId != null) {
// allTransactions.removeFirst();
}
return allTransactions;
}
/**
* {@code GET /transactions} : get all the transactions.
*
@@ -14,7 +14,7 @@ export default defineComponent({
default: null,
},
},
setup() {
setup(props) {
const transactionService = inject('transactionService', () => new TransactionService());
const alertService = inject('alertService', () => useAlertService(), true);
@@ -23,11 +23,13 @@ export default defineComponent({
const isFetching = ref(false);
const clear = () => {};
// console.log(props.userAccountId);
const retrieveTransactions = async () => {
isFetching.value = true;
try {
// console.log(props);
const res = await transactionService().retrieve();
// const res = await transactionService().retrieveForAccount(props.userAccountId);
transactions.value = res.data;
} catch (err) {
alertService.showHttpError(err.response);
@@ -30,6 +30,19 @@ export default class TransactionService {
});
});
}
//
// public retrieveForAccount(userAccountId: any): Promise<any> {
// return new Promise<any>((resolve, reject) => {
// axios
// .get(`${baseApiUrl}/forAccount/${userAccountId}`)
// .then(res => {
// resolve(res);
// })
// .catch(err => {
// reject(err);
// });
// });
// }
public delete(id: number): Promise<any> {
return new Promise<any>((resolve, reject) => {