mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
refactor: gl entries
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import * as moment from 'moment';
|
||||||
import { sumBy } from 'lodash';
|
import { sumBy } from 'lodash';
|
||||||
import { BillPayment } from '../models/BillPayment';
|
import { BillPayment } from '../models/BillPayment';
|
||||||
import { AccountNormal } from '@/interfaces/Account';
|
import { AccountNormal } from '@/interfaces/Account';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { sumBy } from 'lodash';
|
import { sumBy } from 'lodash';
|
||||||
|
import * as moment from 'moment';
|
||||||
import { ILedgerEntry } from '@/modules/Ledger/types/Ledger.types';
|
import { ILedgerEntry } from '@/modules/Ledger/types/Ledger.types';
|
||||||
import { ItemEntry } from '@/modules/TransactionItemEntry/models/ItemEntry';
|
import { ItemEntry } from '@/modules/TransactionItemEntry/models/ItemEntry';
|
||||||
import { Bill } from '../models/Bill';
|
import { Bill } from '../models/Bill';
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { ToNumber } from '@/common/decorators/Validators';
|
import { ToNumber } from '@/common/decorators/Validators';
|
||||||
|
import { parseBoolean } from '@/utils/parse-boolean';
|
||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Type } from 'class-transformer';
|
import { Transform, Type } from 'class-transformer';
|
||||||
import {
|
import {
|
||||||
IsArray,
|
IsArray,
|
||||||
IsBoolean,
|
IsBoolean,
|
||||||
@@ -41,6 +42,7 @@ export class ExpenseCategoryDto {
|
|||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
|
@Transform(({ value }) => parseBoolean(value, false))
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
landedCost?: boolean;
|
landedCost?: boolean;
|
||||||
|
|
||||||
@@ -103,6 +105,7 @@ export class CommandExpenseDto {
|
|||||||
currencyCode?: string;
|
currencyCode?: string;
|
||||||
|
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
|
@Transform(({ value }) => parseBoolean(value, false))
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
description: 'The publish status of the expense',
|
description: 'The publish status of the expense',
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
Delete,
|
Delete,
|
||||||
Get,
|
Get,
|
||||||
Param,
|
Param,
|
||||||
|
Patch,
|
||||||
Post,
|
Post,
|
||||||
Put,
|
Put,
|
||||||
Query,
|
Query,
|
||||||
@@ -67,7 +68,7 @@ export class ManualJournalsController {
|
|||||||
return this.manualJournalsApplication.deleteManualJournal(manualJournalId);
|
return this.manualJournalsApplication.deleteManualJournal(manualJournalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put(':id/publish')
|
@Patch(':id/publish')
|
||||||
@ApiOperation({ summary: 'Publish the given manual journal.' })
|
@ApiOperation({ summary: 'Publish the given manual journal.' })
|
||||||
@ApiResponse({
|
@ApiResponse({
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
import { ApplyVendorCreditToBillsService } from './command/ApplyVendorCreditToBills.service';
|
import { ApplyVendorCreditToBillsService } from './command/ApplyVendorCreditToBills.service';
|
||||||
import { DeleteApplyVendorCreditToBillService } from './command/DeleteApplyVendorCreditToBill.service';
|
import { DeleteApplyVendorCreditToBillService } from './command/DeleteApplyVendorCreditToBill.service';
|
||||||
import { GetAppliedBillsToVendorCreditService } from './queries/GetAppliedBillsToVendorCredit.service';
|
import { GetAppliedBillsToVendorCreditService } from './queries/GetAppliedBillsToVendorCredit.service';
|
||||||
import { GetVendorCreditToApplyBills } from './queries/GetVendorCreditToApplyBills.service';
|
import { GetVendorCreditToApplyBills } from './queries/GetVendorCreditToApplyBills.service';
|
||||||
import { IVendorCreditApplyToInvoicesDTO } from './types/VendorCreditApplyBills.types';
|
import { IVendorCreditApplyToInvoicesDTO } from './types/VendorCreditApplyBills.types';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
export class VendorCreditApplyBillsApplicationService {
|
export class VendorCreditApplyBillsApplicationService {
|
||||||
/**
|
/**
|
||||||
* @param {ApplyVendorCreditToBillsService} applyVendorCreditToBillsService
|
* @param {ApplyVendorCreditToBillsService} applyVendorCreditToBillsService
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export function useEditExpense(props) {
|
|||||||
const apiRequest = useApiRequest();
|
const apiRequest = useApiRequest();
|
||||||
|
|
||||||
return useMutation(
|
return useMutation(
|
||||||
([id, values]) => apiRequest.post(`expenses/${id}`, values),
|
([id, values]) => apiRequest.put(`expenses/${id}`, values),
|
||||||
{
|
{
|
||||||
onSuccess: (res, [id, values]) => {
|
onSuccess: (res, [id, values]) => {
|
||||||
// Invalidate specific expense.
|
// Invalidate specific expense.
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export function useEditJournal(props) {
|
|||||||
const apiRequest = useApiRequest();
|
const apiRequest = useApiRequest();
|
||||||
|
|
||||||
return useMutation(
|
return useMutation(
|
||||||
([id, values]) => apiRequest.post(`manual-journals/${id}`, values),
|
([id, values]) => apiRequest.put(`manual-journals/${id}`, values),
|
||||||
{
|
{
|
||||||
onSuccess: (res, [id]) => {
|
onSuccess: (res, [id]) => {
|
||||||
// Invalidate specific manual journal.
|
// Invalidate specific manual journal.
|
||||||
@@ -95,7 +95,7 @@ export function usePublishJournal(props) {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const apiRequest = useApiRequest();
|
const apiRequest = useApiRequest();
|
||||||
|
|
||||||
return useMutation((id) => apiRequest.post(`manual-journals/${id}/publish`), {
|
return useMutation((id) => apiRequest.patch(`manual-journals/${id}/publish`), {
|
||||||
onSuccess: (res, id) => {
|
onSuccess: (res, id) => {
|
||||||
// Invalidate specific manual journal.
|
// Invalidate specific manual journal.
|
||||||
queryClient.invalidateQueries(t.MANUAL_JOURNAL, id);
|
queryClient.invalidateQueries(t.MANUAL_JOURNAL, id);
|
||||||
|
|||||||
Reference in New Issue
Block a user