mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
fix: formatted transaction type
This commit is contained in:
24
packages/server/src/i18n/en/transaction_type.json
Normal file
24
packages/server/src/i18n/en/transaction_type.json
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"sale_invoice": "Sale invoice",
|
||||||
|
"sale_receipt": "Sale receipt",
|
||||||
|
"payment_received": "Payment received",
|
||||||
|
"bill": "Bill",
|
||||||
|
"bill_payment": "Payment made",
|
||||||
|
"vendor_opening_balance": "Vendor opening balance",
|
||||||
|
"customer_opening_balance": "Customer opening balance",
|
||||||
|
"inventory_adjustment": "Inventory adjustment",
|
||||||
|
"manual_journal": "Manual journal",
|
||||||
|
"expense": "Expense",
|
||||||
|
"owner_contribution": "Owner contribution",
|
||||||
|
"transfer_to_account": "Transfer to account",
|
||||||
|
"transfer_from_account": "Transfer from account",
|
||||||
|
"other_income": "Other income",
|
||||||
|
"other_expense": "Other expense",
|
||||||
|
"owner_drawing": "Owner drawing",
|
||||||
|
"invoice_write_off": "Invoice write-off",
|
||||||
|
"credit_note": "Credit Note",
|
||||||
|
"vendor_credit": "Vendor Credit",
|
||||||
|
"refund_credit_note": "Refund Credit Note",
|
||||||
|
"refund_vendor_credit": "Refund Vendor Credit",
|
||||||
|
"landed_cost": "Landed Cost"
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import { ServiceErrorFilter } from './common/filters/service-error.filter';
|
|||||||
import { ValidationPipe } from './common/pipes/ClassValidation.pipe';
|
import { ValidationPipe } from './common/pipes/ClassValidation.pipe';
|
||||||
import { ToJsonInterceptor } from './common/interceptors/to-json.interceptor';
|
import { ToJsonInterceptor } from './common/interceptors/to-json.interceptor';
|
||||||
|
|
||||||
|
global.__public_dirname = path.join(__dirname, '..', 'public');
|
||||||
global.__static_dirname = path.join(__dirname, '../static');
|
global.__static_dirname = path.join(__dirname, '../static');
|
||||||
global.__views_dirname = path.join(global.__static_dirname, '/views');
|
global.__views_dirname = path.join(global.__static_dirname, '/views');
|
||||||
global.__images_dirname = path.join(global.__static_dirname, '/images');
|
global.__images_dirname = path.join(global.__static_dirname, '/images');
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { unitOfTime } from 'moment';
|
|||||||
import { isEmpty, castArray } from 'lodash';
|
import { isEmpty, castArray } from 'lodash';
|
||||||
import { BaseModel } from '@/models/Model';
|
import { BaseModel } from '@/models/Model';
|
||||||
import { Account } from './Account.model';
|
import { Account } from './Account.model';
|
||||||
|
import { getTransactionTypeLabel } from '@/modules/BankingTransactions/utils';
|
||||||
// import { getTransactionTypeLabel } from '@/utils/transactions-types';
|
// import { getTransactionTypeLabel } from '@/utils/transactions-types';
|
||||||
|
|
||||||
export class AccountTransaction extends BaseModel {
|
export class AccountTransaction extends BaseModel {
|
||||||
@@ -19,7 +20,6 @@ export class AccountTransaction extends BaseModel {
|
|||||||
public readonly date: Date | string;
|
public readonly date: Date | string;
|
||||||
public readonly transactionType: string;
|
public readonly transactionType: string;
|
||||||
public readonly currencyCode: string;
|
public readonly currencyCode: string;
|
||||||
public readonly referenceTypeFormatted: string;
|
|
||||||
public readonly transactionNumber!: string;
|
public readonly transactionNumber!: string;
|
||||||
public readonly referenceNumber!: string;
|
public readonly referenceNumber!: string;
|
||||||
public readonly note!: string;
|
public readonly note!: string;
|
||||||
@@ -72,13 +72,13 @@ export class AccountTransaction extends BaseModel {
|
|||||||
return this.debit * this.exchangeRate;
|
return this.debit * this.exchangeRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Retrieve formatted reference type.
|
* Retrieve formatted reference type.
|
||||||
// * @return {string}
|
* @return {string}
|
||||||
// */
|
*/
|
||||||
// get referenceTypeFormatted() {
|
get referenceTypeFormatted() {
|
||||||
// return getTransactionTypeLabel(this.referenceType, this.transactionType);
|
return getTransactionTypeLabel(this.referenceType, this.transactionType);
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model modifiers.
|
* Model modifiers.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { ConfigModule, ConfigService } from '@nestjs/config';
|
|||||||
import { EventEmitterModule } from '@nestjs/event-emitter';
|
import { EventEmitterModule } from '@nestjs/event-emitter';
|
||||||
import { APP_INTERCEPTOR } from '@nestjs/core';
|
import { APP_INTERCEPTOR } from '@nestjs/core';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
import { ServeStaticModule } from '@nestjs/serve-static';
|
||||||
import { RedisModule } from '@liaoliaots/nestjs-redis';
|
import { RedisModule } from '@liaoliaots/nestjs-redis';
|
||||||
import {
|
import {
|
||||||
AcceptLanguageResolver,
|
AcceptLanguageResolver,
|
||||||
@@ -96,6 +97,10 @@ import { BillLandedCostsModule } from '../BillLandedCosts/BillLandedCosts.module
|
|||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
ServeStaticModule.forRoot({
|
||||||
|
rootPath: join(__dirname, '../../..', 'public'),
|
||||||
|
serveRoot: '/public',
|
||||||
|
}),
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
envFilePath: '.env',
|
envFilePath: '.env',
|
||||||
load: config,
|
load: config,
|
||||||
@@ -220,7 +225,7 @@ import { BillLandedCostsModule } from '../BillLandedCosts/BillLandedCosts.module
|
|||||||
CurrenciesModule,
|
CurrenciesModule,
|
||||||
MiscellaneousModule,
|
MiscellaneousModule,
|
||||||
UsersModule,
|
UsersModule,
|
||||||
ContactsModule
|
ContactsModule,
|
||||||
],
|
],
|
||||||
controllers: [AppController],
|
controllers: [AppController],
|
||||||
providers: [
|
providers: [
|
||||||
|
|||||||
@@ -34,7 +34,10 @@ export class AuthController {
|
|||||||
@UseGuards(LocalAuthGuard)
|
@UseGuards(LocalAuthGuard)
|
||||||
@ApiOperation({ summary: 'Sign in a user' })
|
@ApiOperation({ summary: 'Sign in a user' })
|
||||||
@ApiBody({ type: AuthSigninDto })
|
@ApiBody({ type: AuthSigninDto })
|
||||||
async signin(@Request() req: Request & { user: SystemUser }, @Body() signinDto: AuthSigninDto) {
|
async signin(
|
||||||
|
@Request() req: Request & { user: SystemUser },
|
||||||
|
@Body() signinDto: AuthSigninDto,
|
||||||
|
) {
|
||||||
const { user } = req;
|
const { user } = req;
|
||||||
const tenant = await this.tenantModel.query().findById(user.tenantId);
|
const tenant = await this.tenantModel.query().findById(user.tenantId);
|
||||||
|
|
||||||
@@ -68,7 +71,6 @@ export class AuthController {
|
|||||||
return this.authApp.signUpConfirm(email, token);
|
return this.authApp.signUpConfirm(email, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Post('/send_reset_password')
|
@Post('/send_reset_password')
|
||||||
@ApiOperation({ summary: 'Send reset password email' })
|
@ApiOperation({ summary: 'Send reset password email' })
|
||||||
@ApiBody({
|
@ApiBody({
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
import { IsNotEmpty, IsString } from 'class-validator';
|
import { IsNotEmpty, IsString } from 'class-validator';
|
||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
|
||||||
export class AuthSigninDto {
|
export class AuthSigninDto {
|
||||||
|
@ApiProperty({ example: 'password123', description: 'User password' })
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsString()
|
@IsString()
|
||||||
password: string;
|
password: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
example: 'user@example.com',
|
||||||
|
description: 'User email address',
|
||||||
|
})
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsString()
|
@IsString()
|
||||||
email: string;
|
email: string;
|
||||||
|
|||||||
@@ -1,19 +1,27 @@
|
|||||||
import { IsEmail, IsNotEmpty, IsString } from 'class-validator';
|
import { IsEmail, IsNotEmpty, IsString } from 'class-validator';
|
||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
|
||||||
export class AuthSignupDto {
|
export class AuthSignupDto {
|
||||||
|
@ApiProperty({ example: 'John', description: 'User first name' })
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsString()
|
@IsString()
|
||||||
firstName: string;
|
firstName: string;
|
||||||
|
|
||||||
|
@ApiProperty({ example: 'Doe', description: 'User last name' })
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsString()
|
@IsString()
|
||||||
lastName: string;
|
lastName: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
example: 'john.doe@example.com',
|
||||||
|
description: 'User email address',
|
||||||
|
})
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsEmail()
|
@IsEmail()
|
||||||
email: string;
|
email: string;
|
||||||
|
|
||||||
|
@ApiProperty({ example: 'password123', description: 'User password' })
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsString()
|
@IsString()
|
||||||
password: string;
|
password: string;
|
||||||
|
|||||||
@@ -1,26 +1,31 @@
|
|||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { IsNotEmpty, IsString } from 'class-validator';
|
import { IsNotEmpty, IsString } from 'class-validator';
|
||||||
|
|
||||||
export class PlaidItemDto {
|
export class PlaidItemDto {
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ApiProperty({ example: '123', description: 'The public token' })
|
||||||
publicToken: string;
|
publicToken: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ApiProperty({ example: '123', description: 'The institution ID' })
|
||||||
institutionId: string;
|
institutionId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PlaidWebhookDto {
|
export class PlaidWebhookDto {
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ApiProperty({ example: '123', description: 'The Plaid item ID' })
|
||||||
itemId: string;
|
itemId: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ApiProperty({ example: '123', description: 'The Plaid webhook type' })
|
||||||
webhookType: string;
|
webhookType: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ApiProperty({ example: '123', description: 'The Plaid webhook code' })
|
||||||
webhookCode: string;
|
webhookCode: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import { ACCOUNT_TYPE } from "@/constants/accounts";
|
import { ACCOUNT_TYPE } from '@/constants/accounts';
|
||||||
|
|
||||||
|
|
||||||
export const ERRORS = {
|
export const ERRORS = {
|
||||||
CASHFLOW_TRANSACTION_TYPE_INVALID: 'CASHFLOW_TRANSACTION_TYPE_INVALID',
|
CASHFLOW_TRANSACTION_TYPE_INVALID: 'CASHFLOW_TRANSACTION_TYPE_INVALID',
|
||||||
@@ -111,35 +110,34 @@ export const BankTransactionsSampleData = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
export const CashflowTransactionTypes = {
|
export const CashflowTransactionTypes = {
|
||||||
OtherIncome: 'Other income',
|
OtherIncome: 'transaction_type.other_income',
|
||||||
OtherExpense: 'Other expense',
|
OtherExpense: 'transaction_type.other_expense',
|
||||||
OwnerDrawing: 'Owner drawing',
|
OwnerDrawing: 'transaction_type.owner_drawing',
|
||||||
OwnerContribution: 'Owner contribution',
|
OwnerContribution: 'transaction_type.owner_contribution',
|
||||||
TransferToAccount: 'Transfer to account',
|
TransferToAccount: 'transaction_type.transfer_to_account',
|
||||||
TransferFromAccount: 'Transfer from account',
|
TransferFromAccount: 'transaction_type.transfer_from_account',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TransactionTypes = {
|
export const TransactionTypes = {
|
||||||
SaleInvoice: 'Sale invoice',
|
SaleInvoice: 'transaction_type.sale_invoice',
|
||||||
SaleReceipt: 'Sale receipt',
|
SaleReceipt: 'transaction_type.sale_receipt',
|
||||||
PaymentReceive: 'Payment received',
|
PaymentReceive: 'transaction_type.payment_received',
|
||||||
Bill: 'Bill',
|
Bill: 'transaction_type.bill',
|
||||||
BillPayment: 'Payment made',
|
BillPayment: 'transaction_type.payment_made',
|
||||||
VendorOpeningBalance: 'Vendor opening balance',
|
VendorOpeningBalance: 'transaction_type.vendor_opening_balance',
|
||||||
CustomerOpeningBalance: 'Customer opening balance',
|
CustomerOpeningBalance: 'transaction_type.customer_opening_balance',
|
||||||
InventoryAdjustment: 'Inventory adjustment',
|
InventoryAdjustment: 'transaction_type.inventory_adjustment',
|
||||||
ManualJournal: 'Manual journal',
|
ManualJournal: 'transaction_type.manual_journal',
|
||||||
Journal: 'Manual journal',
|
Journal: 'transaction_type.manual_journal',
|
||||||
Expense: 'Expense',
|
Expense: 'transaction_type.expense',
|
||||||
OwnerContribution: 'Owner contribution',
|
OwnerContribution: 'transaction_type.owner_contribution',
|
||||||
TransferToAccount: 'Transfer to account',
|
TransferToAccount: 'transaction_type.transfer_to_account',
|
||||||
TransferFromAccount: 'Transfer from account',
|
TransferFromAccount: 'transaction_type.transfer_from_account',
|
||||||
OtherIncome: 'Other income',
|
OtherIncome: 'transaction_type.other_income',
|
||||||
OtherExpense: 'Other expense',
|
OtherExpense: 'transaction_type.other_expense',
|
||||||
OwnerDrawing: 'Owner drawing',
|
OwnerDrawing: 'transaction_type.owner_drawing',
|
||||||
InvoiceWriteOff: 'Invoice write-off',
|
InvoiceWriteOff: 'transaction_type.invoice_write_off',
|
||||||
CreditNote: 'transaction_type.credit_note',
|
CreditNote: 'transaction_type.credit_note',
|
||||||
VendorCredit: 'transaction_type.vendor_credit',
|
VendorCredit: 'transaction_type.vendor_credit',
|
||||||
RefundCreditNote: 'transaction_type.refund_credit_note',
|
RefundCreditNote: 'transaction_type.refund_credit_note',
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ import { getBankAccountTransactionsDefaultQuery } from './_utils';
|
|||||||
import { GetBankAccountTransactionsRepository } from './GetBankAccountTransactionsRepo.service';
|
import { GetBankAccountTransactionsRepository } from './GetBankAccountTransactionsRepo.service';
|
||||||
import { GetBankAccountTransactions } from './GetBankAccountTransactions';
|
import { GetBankAccountTransactions } from './GetBankAccountTransactions';
|
||||||
import { GetBankTransactionsQueryDto } from '../../dtos/GetBankTranasctionsQuery.dto';
|
import { GetBankTransactionsQueryDto } from '../../dtos/GetBankTranasctionsQuery.dto';
|
||||||
|
import { I18nService } from 'nestjs-i18n';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GetBankAccountTransactionsService {
|
export class GetBankAccountTransactionsService {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly getBankAccountTransactionsRepository: GetBankAccountTransactionsRepository,
|
private readonly getBankAccountTransactionsRepository: GetBankAccountTransactionsRepository,
|
||||||
|
private readonly i18nService: I18nService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,6 +32,7 @@ export class GetBankAccountTransactionsService {
|
|||||||
const report = new GetBankAccountTransactions(
|
const report = new GetBankAccountTransactions(
|
||||||
this.getBankAccountTransactionsRepository,
|
this.getBankAccountTransactionsRepository,
|
||||||
parsedQuery,
|
parsedQuery,
|
||||||
|
this.i18nService
|
||||||
);
|
);
|
||||||
const transactions = report.reportData();
|
const transactions = report.reportData();
|
||||||
const pagination = this.getBankAccountTransactionsRepository.pagination;
|
const pagination = this.getBankAccountTransactionsRepository.pagination;
|
||||||
|
|||||||
@@ -11,11 +11,13 @@ import { FinancialSheet } from '@/modules/FinancialStatements/common/FinancialSh
|
|||||||
import { formatBankTransactionsStatus } from './_utils';
|
import { formatBankTransactionsStatus } from './_utils';
|
||||||
import { GetBankAccountTransactionsRepository } from './GetBankAccountTransactionsRepo.service';
|
import { GetBankAccountTransactionsRepository } from './GetBankAccountTransactionsRepo.service';
|
||||||
import { runningBalance } from '@/utils/running-balance';
|
import { runningBalance } from '@/utils/running-balance';
|
||||||
|
import { I18nService } from 'nestjs-i18n';
|
||||||
|
|
||||||
export class GetBankAccountTransactions extends FinancialSheet {
|
export class GetBankAccountTransactions extends FinancialSheet {
|
||||||
private runningBalance: any;
|
private runningBalance: any;
|
||||||
private query: ICashflowAccountTransactionsQuery;
|
private query: ICashflowAccountTransactionsQuery;
|
||||||
private repo: GetBankAccountTransactionsRepository;
|
private repo: GetBankAccountTransactionsRepository;
|
||||||
|
private i18n: I18nService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor method.
|
* Constructor method.
|
||||||
@@ -26,11 +28,14 @@ export class GetBankAccountTransactions extends FinancialSheet {
|
|||||||
constructor(
|
constructor(
|
||||||
repo: GetBankAccountTransactionsRepository,
|
repo: GetBankAccountTransactionsRepository,
|
||||||
query: ICashflowAccountTransactionsQuery,
|
query: ICashflowAccountTransactionsQuery,
|
||||||
|
i18n: I18nService,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.repo = repo;
|
this.repo = repo;
|
||||||
this.query = query;
|
this.query = query;
|
||||||
|
this.i18n = i18n;
|
||||||
|
|
||||||
this.runningBalance = runningBalance(this.repo.openingBalance);
|
this.runningBalance = runningBalance(this.repo.openingBalance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +109,7 @@ export class GetBankAccountTransactions extends FinancialSheet {
|
|||||||
referenceId: transaction.referenceId,
|
referenceId: transaction.referenceId,
|
||||||
referenceType: transaction.referenceType,
|
referenceType: transaction.referenceType,
|
||||||
|
|
||||||
formattedTransactionType: transaction.referenceTypeFormatted,
|
formattedTransactionType: this.i18n.t(transaction.referenceTypeFormatted),
|
||||||
|
|
||||||
transactionNumber: transaction.transactionNumber,
|
transactionNumber: transaction.transactionNumber,
|
||||||
referenceNumber: transaction.referenceNumber,
|
referenceNumber: transaction.referenceNumber,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { ToNumber } from '@/common/decorators/Validators';
|
import { ToNumber } from '@/common/decorators/Validators';
|
||||||
import { ItemEntryDto } from '@/modules/TransactionItemEntry/dto/ItemEntry.dto';
|
import { ItemEntryDto } from '@/modules/TransactionItemEntry/dto/ItemEntry.dto';
|
||||||
import { Type } from 'class-transformer';
|
import { Type } from 'class-transformer';
|
||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import {
|
import {
|
||||||
ArrayMinSize,
|
ArrayMinSize,
|
||||||
IsArray,
|
IsArray,
|
||||||
@@ -23,93 +24,187 @@ enum DiscountType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class BillEntryDto extends ItemEntryDto {
|
export class BillEntryDto extends ItemEntryDto {
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Flag indicating whether the entry contributes to landed cost',
|
||||||
|
example: true,
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
landedCost?: boolean;
|
landedCost?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AttachmentDto {
|
class AttachmentDto {
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Storage key of the attachment file',
|
||||||
|
example: 'attachments/bills/receipt.pdf',
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
key: string;
|
key: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CommandBillDto {
|
export class CommandBillDto {
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Unique bill number',
|
||||||
|
example: 'BILL-0001',
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
billNumber: string;
|
billNumber: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Reference number',
|
||||||
|
example: 'REF-12345',
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
referenceNo?: string;
|
referenceNo?: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Date the bill was issued',
|
||||||
|
example: '2025-06-01',
|
||||||
|
})
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@IsDateString()
|
@IsDateString()
|
||||||
billDate: Date;
|
billDate: Date;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Date the bill is due',
|
||||||
|
example: '2025-07-01',
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsDateString()
|
@IsDateString()
|
||||||
dueDate?: Date;
|
dueDate?: Date;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Vendor identifier',
|
||||||
|
example: 10,
|
||||||
|
})
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
vendorId: number;
|
vendorId: number;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Exchange rate applied to bill amounts',
|
||||||
|
example: 3.67,
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@ToNumber()
|
@ToNumber()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsPositive()
|
@IsPositive()
|
||||||
exchangeRate?: number;
|
exchangeRate?: number;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Warehouse identifier',
|
||||||
|
example: 4,
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@ToNumber()
|
@ToNumber()
|
||||||
@IsInt()
|
@IsInt()
|
||||||
warehouseId?: number;
|
warehouseId?: number;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Branch identifier',
|
||||||
|
example: 2,
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@ToNumber()
|
@ToNumber()
|
||||||
@IsInt()
|
@IsInt()
|
||||||
branchId?: number;
|
branchId?: number;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Project identifier',
|
||||||
|
example: 5,
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@ToNumber()
|
@ToNumber()
|
||||||
@IsInt()
|
@IsInt()
|
||||||
projectId?: number;
|
projectId?: number;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Additional notes about the bill',
|
||||||
|
example: 'Payment due next month',
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsString()
|
@IsString()
|
||||||
note?: string;
|
note?: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Indicates if the bill is open',
|
||||||
|
example: true,
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
open: boolean = false;
|
open: boolean = false;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Indicates if tax is inclusive in prices',
|
||||||
|
example: false,
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
isInclusiveTax: boolean = false;
|
isInclusiveTax: boolean = false;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Bill line items',
|
||||||
|
type: () => BillEntryDto,
|
||||||
|
isArray: true,
|
||||||
|
})
|
||||||
@IsArray()
|
@IsArray()
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
@Type(() => BillEntryDto)
|
@Type(() => BillEntryDto)
|
||||||
@ArrayMinSize(1)
|
@ArrayMinSize(1)
|
||||||
entries: BillEntryDto[];
|
entries: BillEntryDto[];
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'File attachments associated with the bill',
|
||||||
|
type: () => AttachmentDto,
|
||||||
|
isArray: true,
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsArray()
|
@IsArray()
|
||||||
@ValidateNested({ each: true })
|
@ValidateNested({ each: true })
|
||||||
@Type(() => AttachmentDto)
|
@Type(() => AttachmentDto)
|
||||||
attachments?: AttachmentDto[];
|
attachments?: AttachmentDto[];
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Type of discount applied',
|
||||||
|
example: DiscountType.Amount,
|
||||||
|
enum: DiscountType,
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsEnum(DiscountType)
|
@IsEnum(DiscountType)
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
discountType: DiscountType = DiscountType.Amount;
|
discountType: DiscountType = DiscountType.Amount;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Discount value',
|
||||||
|
example: 100,
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@ToNumber()
|
@ToNumber()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsPositive()
|
@IsPositive()
|
||||||
discount?: number;
|
discount?: number;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Adjustment value',
|
||||||
|
example: 50,
|
||||||
|
required: false,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@ToNumber()
|
@ToNumber()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ export const getPdfFilesStorageDir = (filename: string) => {
|
|||||||
|
|
||||||
export const getPdfFilePath = (filename: string) => {
|
export const getPdfFilePath = (filename: string) => {
|
||||||
const storageDir = getPdfFilesStorageDir(filename);
|
const storageDir = getPdfFilesStorageDir(filename);
|
||||||
return path.join(global.__static_dirname, storageDir);
|
return path.join(global.__public_dirname, storageDir);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { RefundCreditNote } from './models/RefundCreditNote';
|
|||||||
import { CreditNoteRefundDto } from './dto/CreditNoteRefund.dto';
|
import { CreditNoteRefundDto } from './dto/CreditNoteRefund.dto';
|
||||||
|
|
||||||
@Controller('credit-notes')
|
@Controller('credit-notes')
|
||||||
@ApiTags('credit-notes-refunds')
|
@ApiTags('Credit Note Refunds')
|
||||||
export class CreditNoteRefundsController {
|
export class CreditNoteRefundsController {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly creditNotesRefundsApplication: CreditNotesRefundsApplication,
|
private readonly creditNotesRefundsApplication: CreditNotesRefundsApplication,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { ICreditNotesQueryDTO } from './types/CreditNotes.types';
|
|||||||
import { CreateCreditNoteDto, EditCreditNoteDto } from './dtos/CreditNote.dto';
|
import { CreateCreditNoteDto, EditCreditNoteDto } from './dtos/CreditNote.dto';
|
||||||
|
|
||||||
@Controller('credit-notes')
|
@Controller('credit-notes')
|
||||||
@ApiTags('credit-notes')
|
@ApiTags('Credit Notes')
|
||||||
export class CreditNotesController {
|
export class CreditNotesController {
|
||||||
/**
|
/**
|
||||||
* @param {CreditNoteApplication} creditNoteApplication - The credit note application service.
|
* @param {CreditNoteApplication} creditNoteApplication - The credit note application service.
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
|
import { ApiProperty } from "@nestjs/swagger";
|
||||||
import { IsNotEmpty } from "class-validator";
|
import { IsNotEmpty } from "class-validator";
|
||||||
import { IsString } from "class-validator";
|
import { IsString } from "class-validator";
|
||||||
|
|
||||||
export class CreateCurrencyDto {
|
export class CreateCurrencyDto {
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ApiProperty({ example: 'USD', description: 'The currency name' })
|
||||||
currencyName: string;
|
currencyName: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ApiProperty({ example: 'USD', description: 'The currency code' })
|
||||||
currencyCode: string;
|
currencyCode: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ApiProperty({ example: '$', description: 'The currency sign' })
|
||||||
currencySign: string;
|
currencySign: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
|
import { ApiProperty } from "@nestjs/swagger";
|
||||||
import { IsNotEmpty } from "class-validator";
|
import { IsNotEmpty } from "class-validator";
|
||||||
import { IsString } from "class-validator";
|
import { IsString } from "class-validator";
|
||||||
|
|
||||||
export class EditCurrencyDto {
|
export class EditCurrencyDto {
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ApiProperty({ example: 'USD', description: 'The currency name' })
|
||||||
currencyName: string;
|
currencyName: string;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ApiProperty({ example: '$', description: 'The currency sign' })
|
||||||
currencySign: string;
|
currencySign: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,31 +24,52 @@ class AttachmentDto {
|
|||||||
export class ExpenseCategoryDto {
|
export class ExpenseCategoryDto {
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
@ApiProperty({ example: 1, description: 'The index of the expense category' })
|
||||||
index: number;
|
index: number;
|
||||||
|
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@ToNumber()
|
@ToNumber()
|
||||||
@IsInt()
|
@IsInt()
|
||||||
|
@ApiProperty({
|
||||||
|
example: 1,
|
||||||
|
description: 'The expense account id of the expense category',
|
||||||
|
})
|
||||||
expenseAccountId: number;
|
expenseAccountId: number;
|
||||||
|
|
||||||
@ToNumber()
|
@ToNumber()
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
|
@ApiProperty({
|
||||||
|
example: 100,
|
||||||
|
description: 'The amount of the expense category',
|
||||||
|
})
|
||||||
amount?: number;
|
amount?: number;
|
||||||
|
|
||||||
@IsString()
|
@IsString()
|
||||||
@MaxLength(255)
|
@MaxLength(255)
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
|
@ApiProperty({
|
||||||
|
example: 'This is a description',
|
||||||
|
description: 'The description of the expense category',
|
||||||
|
})
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
@Transform(({ value }) => parseBoolean(value, false))
|
@Transform(({ value }) => parseBoolean(value, false))
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
|
@ApiProperty({
|
||||||
|
example: true,
|
||||||
|
description: 'The landed cost of the expense category',
|
||||||
|
})
|
||||||
landedCost?: boolean;
|
landedCost?: boolean;
|
||||||
|
|
||||||
@ToNumber()
|
@ToNumber()
|
||||||
@IsInt()
|
@IsInt()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
|
@ApiProperty({
|
||||||
|
example: 1,
|
||||||
|
description: 'The project id of the expense category',
|
||||||
|
})
|
||||||
projectId?: number;
|
projectId?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export class TableSheetPdf {
|
|||||||
|
|
||||||
// Generate HTML content from the template
|
// Generate HTML content from the template
|
||||||
const htmlContent = await this.templateInjectable.render(
|
const htmlContent = await this.templateInjectable.render(
|
||||||
'modules/financial-sheet',
|
'financial-sheet',
|
||||||
{
|
{
|
||||||
table: { rows, columns },
|
table: { rows, columns },
|
||||||
sheetName,
|
sheetName,
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
import { TableSheetPdf } from '../../common/TableSheetPdf';
|
import { TableSheetPdf } from '../../common/TableSheetPdf';
|
||||||
import { ICashFlowStatementQuery } from './Cashflow.types';
|
import { ICashFlowStatementQuery } from './Cashflow.types';
|
||||||
import { CashflowTableInjectable } from './CashflowTableInjectable';
|
import { CashflowTableInjectable } from './CashflowTableInjectable';
|
||||||
import { HtmlTableCustomCss } from './constants';
|
import { HtmlTableCustomCss } from './constants';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class CashflowTablePdfInjectable {
|
export class CashflowTablePdfInjectable {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly cashflowTable: CashflowTableInjectable,
|
private readonly cashflowTable: CashflowTableInjectable,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export class ProfitLossSheetController {
|
|||||||
);
|
);
|
||||||
res.send(sheet);
|
res.send(sheet);
|
||||||
// Retrieves the json format.
|
// Retrieves the json format.
|
||||||
} else if (acceptHeader.includes(AcceptType.ApplicationJson)) {
|
} else if (acceptHeader.includes(AcceptType.ApplicationPdf)) {
|
||||||
const pdfContent = await this.profitLossSheetApp.pdf(query);
|
const pdfContent = await this.profitLossSheetApp.pdf(query);
|
||||||
|
|
||||||
res.set({
|
res.set({
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
Req,
|
Req,
|
||||||
Res,
|
Res,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ISalesByItemsReportQuery } from './SalesByItems.types';
|
|
||||||
import { AcceptType } from '@/constants/accept-type';
|
import { AcceptType } from '@/constants/accept-type';
|
||||||
import { SalesByItemsApplication } from './SalesByItemsApplication';
|
import { SalesByItemsApplication } from './SalesByItemsApplication';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
@@ -21,7 +20,10 @@ export class SalesByItemsController {
|
|||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
@ApiResponse({ status: 200, description: 'Sales by items report' })
|
@ApiResponse({ status: 200, description: 'Sales by items report' })
|
||||||
@ApiOperation({ summary: 'Get sales by items report' })
|
@ApiOperation({
|
||||||
|
summary: 'Sales by items report',
|
||||||
|
description: 'Retrieves the sales by items report.',
|
||||||
|
})
|
||||||
public async salesByitems(
|
public async salesByitems(
|
||||||
@Query() filter: SalesByItemsQueryDto,
|
@Query() filter: SalesByItemsQueryDto,
|
||||||
@Res({ passthrough: true }) res: Response,
|
@Res({ passthrough: true }) res: Response,
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ export class InventoryAdjustmentsGLEntries {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverts the adjustment transactions GL entries.
|
* Reverts the adjustment transactions GL entries.
|
||||||
* @param {number} tenantId
|
* @param {number} inventoryAdjustmentId
|
||||||
* @param {number} inventoryAdjustmentId
|
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
public revertAdjustmentGLEntries = (
|
public revertAdjustmentGLEntries = (
|
||||||
@@ -63,7 +62,6 @@ export class InventoryAdjustmentsGLEntries {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Rewrite inventory adjustment GL entries.
|
* Rewrite inventory adjustment GL entries.
|
||||||
* @param {number} tenantId
|
|
||||||
* @param {number} inventoryAdjustmentId
|
* @param {number} inventoryAdjustmentId
|
||||||
* @param {Knex.Transaction} trx
|
* @param {Knex.Transaction} trx
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,13 +21,12 @@ import {
|
|||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiTags,
|
ApiTags,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
import { IItemsFilter } from './types/Items.types';
|
|
||||||
import { CreateItemDto, EditItemDto } from './dtos/Item.dto';
|
import { CreateItemDto, EditItemDto } from './dtos/Item.dto';
|
||||||
import { GetItemsQueryDto } from './dtos/GetItemsQuery.dto';
|
import { GetItemsQueryDto } from './dtos/GetItemsQuery.dto';
|
||||||
|
|
||||||
@Controller('/items')
|
@Controller('/items')
|
||||||
@UseGuards(SubscriptionGuard)
|
@UseGuards(SubscriptionGuard)
|
||||||
@ApiTags('items')
|
@ApiTags('Items')
|
||||||
export class ItemsController extends TenantController {
|
export class ItemsController extends TenantController {
|
||||||
constructor(private readonly itemsApplication: ItemsApplicationService) {
|
constructor(private readonly itemsApplication: ItemsApplicationService) {
|
||||||
super();
|
super();
|
||||||
@@ -118,6 +117,12 @@ export class ItemsController extends TenantController {
|
|||||||
description: 'The item has been successfully updated.',
|
description: 'The item has been successfully updated.',
|
||||||
})
|
})
|
||||||
@ApiResponse({ status: 404, description: 'The item not found.' })
|
@ApiResponse({ status: 404, description: 'The item not found.' })
|
||||||
|
@ApiParam({
|
||||||
|
name: 'id',
|
||||||
|
required: true,
|
||||||
|
type: Number,
|
||||||
|
description: 'The item id',
|
||||||
|
})
|
||||||
async editItem(
|
async editItem(
|
||||||
@Param('id') id: string,
|
@Param('id') id: string,
|
||||||
@Body() editItemDto: EditItemDto,
|
@Body() editItemDto: EditItemDto,
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ export class CommandTaxRateDto {
|
|||||||
*/
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@ApiProperty({
|
@ApiProperty({ description: 'The name of the tax rate.', example: 'VAT' })
|
||||||
description: 'The name of the tax rate.',
|
|
||||||
example: 'VAT',
|
|
||||||
})
|
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,10 +22,7 @@ export class CommandTaxRateDto {
|
|||||||
*/
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@ApiProperty({
|
@ApiProperty({ description: 'The code of the tax rate.', example: 'VAT' })
|
||||||
description: 'The code of the tax rate.',
|
|
||||||
example: 'VAT',
|
|
||||||
})
|
|
||||||
code: string;
|
code: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ import * as path from 'path';
|
|||||||
import * as pug from 'pug';
|
import * as pug from 'pug';
|
||||||
|
|
||||||
export function templateRender(filePath: string, options: Record<string, any>) {
|
export function templateRender(filePath: string, options: Record<string, any>) {
|
||||||
const basePath = path.join(global.__resources_dir, '/views');
|
const templatePath = path.join(global.__views_dirname, `${filePath}.pug`);
|
||||||
return pug.renderFile(`${basePath}/${filePath}.pug`, options);
|
return pug.renderFile(templatePath, options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export function useBalanceSheet(query, props) {
|
|||||||
*/
|
*/
|
||||||
export const useBalanceSheetXlsxExport = (query, args) => {
|
export const useBalanceSheetXlsxExport = (query, args) => {
|
||||||
return useDownloadFile({
|
return useDownloadFile({
|
||||||
url: '/reports/balance_sheet',
|
url: '/reports/balance-sheet',
|
||||||
config: {
|
config: {
|
||||||
headers: {
|
headers: {
|
||||||
accept: 'application/xlsx',
|
accept: 'application/xlsx',
|
||||||
@@ -57,7 +57,7 @@ export const useBalanceSheetXlsxExport = (query, args) => {
|
|||||||
*/
|
*/
|
||||||
export const useBalanceSheetCsvExport = (query, args) => {
|
export const useBalanceSheetCsvExport = (query, args) => {
|
||||||
return useDownloadFile({
|
return useDownloadFile({
|
||||||
url: '/reports/balance_sheet',
|
url: '/reports/balance-sheet',
|
||||||
config: {
|
config: {
|
||||||
headers: {
|
headers: {
|
||||||
accept: 'application/csv',
|
accept: 'application/csv',
|
||||||
@@ -76,7 +76,7 @@ export const useBalanceSheetCsvExport = (query, args) => {
|
|||||||
*/
|
*/
|
||||||
export function useBalanceSheetPdf(query = {}) {
|
export function useBalanceSheetPdf(query = {}) {
|
||||||
return useRequestPdf({
|
return useRequestPdf({
|
||||||
url: `/reports/balance_sheet`,
|
url: `/reports/balance-sheet`,
|
||||||
params: query,
|
params: query,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export function useCashflowTransaction(id, props) {
|
|||||||
[t.CASH_FLOW_TRANSACTIONS, id],
|
[t.CASH_FLOW_TRANSACTIONS, id],
|
||||||
{ method: 'get', url: `banking/transactions/${id}` },
|
{ method: 'get', url: `banking/transactions/${id}` },
|
||||||
{
|
{
|
||||||
select: (res) => res.data.cashflow_transaction,
|
select: (res) => res.data,
|
||||||
defaultData: [],
|
defaultData: [],
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export function useEditItem(props) {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const apiRequest = useApiRequest();
|
const apiRequest = useApiRequest();
|
||||||
|
|
||||||
return useMutation(([id, values]) => apiRequest.post(`items/${id}`, values), {
|
return useMutation(([id, values]) => apiRequest.put(`items/${id}`, values), {
|
||||||
onSuccess: (res, [id, values]) => {
|
onSuccess: (res, [id, values]) => {
|
||||||
// Invalidate specific item.
|
// Invalidate specific item.
|
||||||
queryClient.invalidateQueries([t.ITEM, id]);
|
queryClient.invalidateQueries([t.ITEM, id]);
|
||||||
|
|||||||
Reference in New Issue
Block a user