mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-27 18:19: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>
44 lines
755 B
TypeScript
44 lines
755 B
TypeScript
import { Model, mixin } from 'objection';
|
|
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
|
|
|
export class RolePermission extends TenantBaseModel {
|
|
value: any;
|
|
ability: any;
|
|
subject: any;
|
|
|
|
/**
|
|
* Table name
|
|
*/
|
|
static get tableName() {
|
|
return 'role_permissions';
|
|
}
|
|
|
|
/**
|
|
* Timestamps columns.
|
|
*/
|
|
get timestamps() {
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* Relationship mapping.
|
|
*/
|
|
static get relationMappings() {
|
|
const { Role } = require('./Role.model');
|
|
|
|
return {
|
|
/**
|
|
*
|
|
*/
|
|
role: {
|
|
relation: Model.BelongsToOneRelation,
|
|
modelClass: Role,
|
|
join: {
|
|
from: 'role_permissions.roleId',
|
|
to: 'roles.id',
|
|
},
|
|
},
|
|
};
|
|
}
|
|
}
|