You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.4 KiB
85 lines
2.4 KiB
const { DataTypes } = require('sequelize');
|
|
|
|
module.exports = (sequelize) => {
|
|
const TicketItem = sequelize.define('TicketItem', {
|
|
id: {
|
|
type: DataTypes.INTEGER,
|
|
primaryKey: true,
|
|
autoIncrement: true
|
|
},
|
|
ticket_id: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
references: {
|
|
model: 'tickets',
|
|
key: 'id'
|
|
},
|
|
comment: 'ID du ticket'
|
|
},
|
|
commande_item_id: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: true,
|
|
comment: 'ID de l\'item de commande (si applicable)'
|
|
},
|
|
nom_item: {
|
|
type: DataTypes.STRING(100),
|
|
allowNull: false,
|
|
comment: 'Nom de l\'item'
|
|
},
|
|
description: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true,
|
|
comment: 'Description de l\'item'
|
|
},
|
|
quantite: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 1,
|
|
comment: 'Quantité'
|
|
},
|
|
prix_unitaire_ht: {
|
|
type: DataTypes.DECIMAL(10, 2),
|
|
allowNull: false,
|
|
comment: 'Prix unitaire HT'
|
|
},
|
|
prix_unitaire_ttc: {
|
|
type: DataTypes.DECIMAL(10, 2),
|
|
allowNull: false,
|
|
comment: 'Prix unitaire TTC'
|
|
},
|
|
montant_ht: {
|
|
type: DataTypes.DECIMAL(10, 2),
|
|
allowNull: false,
|
|
comment: 'Montant total HT pour cet item'
|
|
},
|
|
montant_tva: {
|
|
type: DataTypes.DECIMAL(10, 2),
|
|
allowNull: false,
|
|
comment: 'Montant de la TVA pour cet item'
|
|
},
|
|
montant_ttc: {
|
|
type: DataTypes.DECIMAL(10, 2),
|
|
allowNull: false,
|
|
comment: 'Montant total TTC pour cet item'
|
|
},
|
|
taux_tva: {
|
|
type: DataTypes.DECIMAL(5, 2),
|
|
allowNull: false,
|
|
defaultValue: 20.00,
|
|
comment: 'Taux de TVA appliqué'
|
|
},
|
|
remise_unitaire: {
|
|
type: DataTypes.DECIMAL(10, 2),
|
|
allowNull: false,
|
|
defaultValue: 0.00,
|
|
comment: 'Remise par unité'
|
|
}
|
|
}, {
|
|
tableName: 'ticket_items',
|
|
timestamps: true,
|
|
createdAt: 'cree_le',
|
|
updatedAt: 'modifie_le'
|
|
});
|
|
|
|
return TicketItem;
|
|
};
|
|
|