fix: manual journal listing api.

This commit is contained in:
a.bouhuolia
2021-01-03 20:00:32 +02:00
parent ccf4fa55d9
commit 15460d13b1
4 changed files with 24 additions and 2 deletions

View File

@@ -244,7 +244,9 @@ export default class ManualJournalsController extends BaseController {
tenantId,
manualJournalId
);
return res.status(200).send({ manualJournal });
return res.status(200).send({
manual_journal: manualJournal
});
} catch (error) {
next(error);
}

View File

@@ -216,7 +216,7 @@ export default class PaymentReceivesController extends BaseController {
* @param {Response} res -
*/
async getPaymentReceive(req: Request, res: Response, next: NextFunction) {
const { tenantId } = req;
const { tenantId, user } = req;
const { id: paymentReceiveId } = req.params;
try {

View File

@@ -15,4 +15,22 @@ export default class ManualJournalEntry extends TenantModel {
get timestamps() {
return [];
}
/**
* Relationship mapping.
*/
static get relationMappings() {
const Account = require('models/Account');
return {
account: {
relation: Model.BelongsToOneRelation,
modelClass: Account.default,
join: {
from: 'manual_journals_entries.accountId',
to: 'accounts.id',
},
},
};
}
}

View File

@@ -17,6 +17,7 @@ import {
IPaymentReceiveEntryDTO,
IPaymentReceivesFilter,
ISaleInvoice,
ISystemService,
ISystemUser,
} from 'interfaces';
import AccountsService from 'services/Accounts/AccountsService';
@@ -481,6 +482,7 @@ export default class PaymentReceiveService {
public async getPaymentReceive(
tenantId: number,
paymentReceiveId: number,
authorizedUser: ISystemService
): Promise<{
paymentReceive: IPaymentReceive;
receivableInvoices: ISaleInvoice[];