mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-27 10:09:48 +00:00
Add withDateSessionMixin for proper timestamp handling and fix models to return empty timestamps array when database tables don't have created_at/updated_at columns. This prevents ORM insert/update errors. Models updated: - Branch, Role, RolePermission, ViewColumn, ViewRole - InventoryAdjustment, InventoryAdjustmentEntry, InventoryTransactionMeta - BillLandedCostEntry, CreditNote, CreditNoteAppliedInvoice, RefundCreditNote - PaymentReceived, SaleInvoice, SaleReceipt, Item, ItemEntry - RefundVendorCredit, VendorCreditAppliedBill - ItemWarehouseQuantity, Warehouse, WarehouseTransfer, WarehouseTransferEntry - Setting, TenantMetadataModel, TenantUser Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
41 lines
867 B
TypeScript
41 lines
867 B
TypeScript
import { BaseModel } from '@/models/Model';
|
|
import { Model, raw } from 'objection';
|
|
|
|
export class InventoryTransactionMeta extends BaseModel {
|
|
transactionNumber!: string;
|
|
description!: string;
|
|
inventoryTransactionId!: number;
|
|
|
|
/**
|
|
* Table name
|
|
*/
|
|
static get tableName() {
|
|
return 'inventory_transaction_meta';
|
|
}
|
|
|
|
/**
|
|
* Timestamps columns.
|
|
*/
|
|
get timestamps() {
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* Relationship mapping.
|
|
*/
|
|
static get relationMappings() {
|
|
const { InventoryTransaction } = require('./InventoryTransaction');
|
|
|
|
return {
|
|
inventoryTransaction: {
|
|
relation: Model.BelongsToOneRelation,
|
|
modelClass: InventoryTransaction,
|
|
join: {
|
|
from: 'inventory_transaction_meta.inventoryTransactionId',
|
|
to: 'inventory_transactions.inventoryTransactionId'
|
|
}
|
|
}
|
|
};
|
|
}
|
|
}
|