mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
feat: add sample sheet to accounts and bank transactions
This commit is contained in:
@@ -6,7 +6,7 @@ import { CreateUncategorizedTransaction } from './CreateUncategorizedTransaction
|
||||
import { CreateUncategorizedTransactionDTO } from '@/interfaces';
|
||||
import { ImportableContext } from '../Import/interfaces';
|
||||
import HasTenancyService from '../Tenancy/TenancyService';
|
||||
import { ImportSampleData } from './constants';
|
||||
import { BankTransactionsSampleData } from './constants';
|
||||
|
||||
@Service()
|
||||
export class UncategorizedTransactionsImportable extends Importable {
|
||||
@@ -32,8 +32,8 @@ export class UncategorizedTransactionsImportable extends Importable {
|
||||
|
||||
/**
|
||||
* Transformes the DTO before validating and importing.
|
||||
* @param {CreateUncategorizedTransactionDTO} createDTO
|
||||
* @param {ImportableContext} context
|
||||
* @param {CreateUncategorizedTransactionDTO} createDTO
|
||||
* @param {ImportableContext} context
|
||||
* @returns {CreateUncategorizedTransactionDTO}
|
||||
*/
|
||||
public transform(
|
||||
@@ -51,7 +51,7 @@ export class UncategorizedTransactionsImportable extends Importable {
|
||||
* @returns {Record<string, any>[]}
|
||||
*/
|
||||
public sampleData(): Record<string, any>[] {
|
||||
return ImportSampleData;
|
||||
return BankTransactionsSampleData;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,9 +76,7 @@ export class UncategorizedTransactionsImportable extends Importable {
|
||||
const { Account } = this.tenancy.models(tenantId);
|
||||
|
||||
if (params.accountId) {
|
||||
await Account.query()
|
||||
.findById(params.accountId)
|
||||
.throwIfNotFound({});
|
||||
await Account.query().findById(params.accountId).throwIfNotFound({});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ export const ERRORS = {
|
||||
ACCOUNT_HAS_ASSOCIATED_TRANSACTIONS: 'account_has_associated_transactions',
|
||||
TRANSACTION_ALREADY_CATEGORIZED: 'TRANSACTION_ALREADY_CATEGORIZED',
|
||||
TRANSACTION_ALREADY_UNCATEGORIZED: 'TRANSACTION_ALREADY_UNCATEGORIZED',
|
||||
UNCATEGORIZED_TRANSACTION_TYPE_INVALID: 'UNCATEGORIZED_TRANSACTION_TYPE_INVALID',
|
||||
CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED: 'CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED'
|
||||
UNCATEGORIZED_TRANSACTION_TYPE_INVALID:
|
||||
'UNCATEGORIZED_TRANSACTION_TYPE_INVALID',
|
||||
CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED:
|
||||
'CANNOT_DELETE_TRANSACTION_CONVERTED_FROM_UNCATEGORIZED',
|
||||
};
|
||||
|
||||
export enum CASHFLOW_DIRECTION {
|
||||
@@ -76,24 +78,28 @@ export interface ICashflowTransactionTypeMeta {
|
||||
creditType: string[];
|
||||
}
|
||||
|
||||
|
||||
export const ImportSampleData = [
|
||||
{
|
||||
Amount: 5000,
|
||||
Date: '2024-01-01',
|
||||
Payee: 'John Roberts',
|
||||
Description: 'Cheque deposit',
|
||||
},
|
||||
{
|
||||
Amount: 5000,
|
||||
Date: '2024-01-01',
|
||||
Payee: 'John Roberts',
|
||||
Description: 'Cheque deposit',
|
||||
},
|
||||
{
|
||||
Amount: 5000,
|
||||
Date: '2024-01-01',
|
||||
Payee: 'John Roberts',
|
||||
Description: 'Cheque deposit',
|
||||
},
|
||||
]
|
||||
export const BankTransactionsSampleData = [
|
||||
[
|
||||
{
|
||||
Amount: '6,410.19',
|
||||
Date: '2024-03-26',
|
||||
Payee: 'MacGyver and Sons',
|
||||
'Reference No.': 'REF-1',
|
||||
Description: 'Commodi quo labore.',
|
||||
},
|
||||
{
|
||||
Amount: '8,914.17',
|
||||
Date: '2024-01-05',
|
||||
Payee: 'Eichmann - Bergnaum',
|
||||
'Reference No.': 'REF-1',
|
||||
Description: 'Quia enim et.',
|
||||
},
|
||||
{
|
||||
Amount: '6,200.88',
|
||||
Date: '2024-02-17',
|
||||
Payee: 'Luettgen, Mraz and Legros',
|
||||
'Reference No.': 'REF-1',
|
||||
Description: 'Occaecati consequuntur cum impedit illo.',
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user