Spaces:
Runtime error
Runtime error
File size: 1,135 Bytes
f11f54f 1421ecc f11f54f 1421ecc f11f54f a1cd0dd f11f54f 1421ecc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import {
DataTypes,
Model,
InferAttributes,
InferCreationAttributes,
CreationOptional,
} from 'sequelize';
import { sequelize } from './index';
import { ErrorLogInterface } from '../shared/interfaces/errorLog.interface';
import Invoice from './invoice';
class ErrorLog extends Model<ErrorLogInterface>implements ErrorLogInterface {
declare id?: CreationOptional<number>;
declare invoice_id?: number;
declare error_type: string;
declare error_details: string;
}
ErrorLog.init(
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
invoice_id: {
type: DataTypes.INTEGER,
references: {
model: Invoice,
key: 'id'
},
onDelete: 'CASCADE'
},
error_type: {
type: DataTypes.STRING
},
error_details: {
type: DataTypes.TEXT
},
},
{
sequelize,
tableName: 'error_log',
underscored: true,
freezeTableName: true,
timestamps: true,
createdAt: "created_at",
updatedAt: "updated_at"
}
);
ErrorLog.belongsTo(Invoice, { foreignKey: 'invoice_id' });
export default ErrorLog
|