mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
refactor(nestjs): pdf templates
This commit is contained in:
@@ -18,14 +18,14 @@ const PaymentsReceivedListContext = createContext();
|
||||
function PaymentsReceivedListProvider({ query, tableStateChanged, ...props }) {
|
||||
// Fetch payment receives resource views and fields.
|
||||
const { data: paymentReceivesViews, isLoading: isViewsLoading } =
|
||||
useResourceViews('payment_receives');
|
||||
useResourceViews('payment-received');
|
||||
|
||||
// Fetch the payment receives resource fields.
|
||||
const {
|
||||
data: resourceMeta,
|
||||
isLoading: isResourceLoading,
|
||||
isFetching: isResourceFetching,
|
||||
} = useResourceMeta('payment_receives');
|
||||
} = useResourceMeta('payment-received');
|
||||
|
||||
// Fetch payment receives list according to the given custom view id.
|
||||
const {
|
||||
|
||||
@@ -83,7 +83,7 @@ export function useDisconnectBankAccount(
|
||||
DisconnectBankAccountValues
|
||||
>(
|
||||
({ bankAccountId }) =>
|
||||
apiRequest.post(`/banking/bank_accounts/${bankAccountId}/disconnect`),
|
||||
apiRequest.post(`/banking/accounts/${bankAccountId}/disconnect`),
|
||||
{
|
||||
...options,
|
||||
onSuccess: (res, values) => {
|
||||
@@ -115,7 +115,7 @@ export function useUpdateBankAccount(
|
||||
|
||||
return useMutation<DisconnectBankAccountRes, Error, UpdateBankAccountValues>(
|
||||
({ bankAccountId }) =>
|
||||
apiRequest.post(`/banking/bank_accounts/${bankAccountId}/update`),
|
||||
apiRequest.post(`/banking/accounts/${bankAccountId}/update`),
|
||||
{
|
||||
...options,
|
||||
onSuccess: () => {},
|
||||
@@ -254,7 +254,7 @@ export function useGetBankTransactionsMatches(
|
||||
[BANK_QUERY_KEY.BANK_TRANSACTION_MATCHES, uncategorizeTransactionsIds],
|
||||
() =>
|
||||
apiRequest
|
||||
.get(`/cashflow/transactions/matches`, {
|
||||
.get(`/banking/matching/matched`, {
|
||||
params: { uncategorizeTransactionsIds },
|
||||
})
|
||||
.then((res) => transformToCamelCase(res.data)),
|
||||
@@ -312,7 +312,7 @@ export function useExcludeUncategorizedTransaction(
|
||||
>(
|
||||
(uncategorizedTransactionId: number) =>
|
||||
apiRequest.put(
|
||||
`/cashflow/transactions/${uncategorizedTransactionId}/exclude`,
|
||||
`/banking/transactions/${uncategorizedTransactionId}/exclude`,
|
||||
),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
@@ -353,7 +353,7 @@ export function useUnexcludeUncategorizedTransaction(
|
||||
>(
|
||||
(uncategorizedTransactionId: number) =>
|
||||
apiRequest.put(
|
||||
`/cashflow/transactions/${uncategorizedTransactionId}/unexclude`,
|
||||
`/banking/transactions/${uncategorizedTransactionId}/unexclude`,
|
||||
),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
@@ -392,7 +392,7 @@ export function useExcludeUncategorizedTransactions(
|
||||
ExcludeBankTransactionsValue
|
||||
>(
|
||||
(value: { ids: Array<number | string> }) =>
|
||||
apiRequest.put(`/cashflow/transactions/exclude`, { ids: value.ids }),
|
||||
apiRequest.put(`/banking/transactions/exclude`, { ids: value.ids }),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
onValidateExcludeUncategorizedTransaction(queryClient);
|
||||
@@ -430,7 +430,7 @@ export function useUnexcludeUncategorizedTransactions(
|
||||
UnexcludeBankTransactionsValue
|
||||
>(
|
||||
(value: { ids: Array<number | string> }) =>
|
||||
apiRequest.put(`/cashflow/transactions/unexclude`, { ids: value.ids }),
|
||||
apiRequest.put(`/banking/transactions/unexclude`, { ids: value.ids }),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
onValidateExcludeUncategorizedTransaction(queryClient);
|
||||
@@ -515,7 +515,7 @@ export function useUnmatchMatchedUncategorizedTransaction(
|
||||
UnmatchUncategorizedTransactionRes,
|
||||
Error,
|
||||
UnmatchUncategorizedTransactionValues
|
||||
>(({ id }) => apiRequest.post(`/banking/matches/unmatch/${id}`), {
|
||||
>(({ id }) => apiRequest.post(`/banking/matching/unmatch/${id}`), {
|
||||
onSuccess: (res, id) => {
|
||||
queryClient.invalidateQueries(
|
||||
t.CASHFLOW_ACCOUNT_UNCATEGORIZED_TRANSACTIONS_INFINITY,
|
||||
@@ -579,7 +579,7 @@ export function useGetBankAccountSummaryMeta(
|
||||
[BANK_QUERY_KEY.BANK_ACCOUNT_SUMMARY_META, bankAccountId],
|
||||
() =>
|
||||
apiRequest
|
||||
.get(`/banking/bank_accounts/${bankAccountId}/meta`)
|
||||
.get(`/banking/accounts/${bankAccountId}/summary`)
|
||||
.then((res) => transformToCamelCase(res.data?.data)),
|
||||
{ ...options },
|
||||
);
|
||||
@@ -668,7 +668,7 @@ export function useExcludedBankTransactionsInfinity(
|
||||
const response = await apiRequest.http({
|
||||
...axios,
|
||||
method: 'get',
|
||||
url: `/api/cashflow/excluded`,
|
||||
url: `/api/banking/excluded`,
|
||||
params: { page: pageParam, ...query },
|
||||
});
|
||||
return response.data;
|
||||
@@ -700,7 +700,7 @@ export function usePendingBankTransactionsInfinity(
|
||||
const response = await apiRequest.http({
|
||||
...axios,
|
||||
method: 'get',
|
||||
url: `/api/banking/bank_accounts/pending_transactions`,
|
||||
url: `/api/banking/accounts/pending_transactions`,
|
||||
params: { page: pageParam, ...query },
|
||||
});
|
||||
return response.data;
|
||||
|
||||
@@ -54,7 +54,7 @@ export function useCreateCashflowTransaction(props) {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(values) => apiRequest.post('cashflow/transactions', values),
|
||||
(values) => apiRequest.post('banking/transactions', values),
|
||||
{
|
||||
onSuccess: () => {
|
||||
// Invalidate queries.
|
||||
@@ -73,7 +73,7 @@ export function useCreateCashflowTransaction(props) {
|
||||
export function useCashflowTransaction(id, props) {
|
||||
return useRequestQuery(
|
||||
[t.CASH_FLOW_TRANSACTIONS, id],
|
||||
{ method: 'get', url: `cashflow/transactions/${id}` },
|
||||
{ method: 'get', url: `banking/transactions/${id}` },
|
||||
{
|
||||
select: (res) => res.data.cashflow_transaction,
|
||||
defaultData: [],
|
||||
@@ -89,7 +89,7 @@ export function useDeleteCashflowTransaction(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation((id) => apiRequest.delete(`cashflow/transactions/${id}`), {
|
||||
return useMutation((id) => apiRequest.delete(`banking/transactions/${id}`), {
|
||||
onSuccess: (res, id) => {
|
||||
// Invalidate queries.
|
||||
commonInvalidateQueries(queryClient);
|
||||
@@ -118,7 +118,7 @@ export function useAccountTransactionsInfinity(
|
||||
const response = await apiRequest.http({
|
||||
...axios,
|
||||
method: 'get',
|
||||
url: `/api/financial_statements/cashflow-account-transactions`,
|
||||
url: `/api/banking/transactions`,
|
||||
params: { page: pageParam, ...query },
|
||||
});
|
||||
return response.data;
|
||||
@@ -157,7 +157,7 @@ export function useAccountUncategorizedTransactionsInfinity(
|
||||
const response = await apiRequest.http({
|
||||
...axios,
|
||||
method: 'get',
|
||||
url: `/api/cashflow/transactions/${accountId}/uncategorized`,
|
||||
url: `/api/banking/transactions/${accountId}/uncategorized`,
|
||||
params: { page: pageParam, ...query },
|
||||
});
|
||||
return response.data;
|
||||
@@ -231,7 +231,7 @@ export function useUncategorizedTransaction(
|
||||
[t.CASHFLOW_UNCAATEGORIZED_TRANSACTION, uncategorizedTranasctionId],
|
||||
{
|
||||
method: 'get',
|
||||
url: `cashflow/transactions/uncategorized/${uncategorizedTranasctionId}`,
|
||||
url: `banking/transactions/uncategorized/${uncategorizedTranasctionId}`,
|
||||
},
|
||||
{
|
||||
select: (res) => res.data?.data,
|
||||
@@ -248,7 +248,7 @@ export function useCategorizeTransaction(props) {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(values) => apiRequest.post(`cashflow/transactions/categorize`, values),
|
||||
(values) => apiRequest.post(`banking/transactions/categorize`, values),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
// Invalidate queries.
|
||||
@@ -274,7 +274,7 @@ export function useUncategorizeTransaction(props) {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
return useMutation(
|
||||
(id: number) => apiRequest.post(`cashflow/transactions/${id}/uncategorize`),
|
||||
(id: number) => apiRequest.post(`banking/transactions/${id}/uncategorize`),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
// Invalidate queries.
|
||||
|
||||
@@ -185,7 +185,7 @@ export function useInvoice(invoiceId, props, requestProps) {
|
||||
[t.SALE_INVOICE, invoiceId],
|
||||
{ method: 'get', url: `sale-invoices/${invoiceId}`, ...requestProps },
|
||||
{
|
||||
select: (res) => res.data.sale_invoice,
|
||||
select: (res) => res.data,
|
||||
defaultData: {},
|
||||
...props,
|
||||
},
|
||||
@@ -338,7 +338,7 @@ export function useInvoicePaymentTransactions(invoiceId, props) {
|
||||
[t.SALE_INVOICE_PAYMENT_TRANSACTIONS, invoiceId],
|
||||
{
|
||||
method: 'get',
|
||||
url: `sale-invoices/${invoiceId}/payment-transactions`,
|
||||
url: `sale-invoices/${invoiceId}/payments`,
|
||||
},
|
||||
{
|
||||
select: (res) => res.data.data,
|
||||
|
||||
@@ -230,7 +230,7 @@ export const useGetPdfTemplateBrandingState = (
|
||||
() =>
|
||||
apiRequest
|
||||
.get('/pdf-templates/state')
|
||||
.then((res) => transformToCamelCase(res.data?.data)),
|
||||
.then((res) => transformToCamelCase(res.data)),
|
||||
options,
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user