This commit is contained in:
Ken
2026-01-19 09:33:35 +07:00
parent 374dc12b2d
commit 70838a4bc1
103 changed files with 16929 additions and 2 deletions

29
models/GradeItem.js Normal file
View File

@@ -0,0 +1,29 @@
const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/database');
const GradeItem = sequelize.define('grade_items', {
id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true },
item_name: { type: DataTypes.STRING(200), allowNull: false },
category_id: { type: DataTypes.UUID, allowNull: false },
class_id: { type: DataTypes.UUID, allowNull: false },
max_score: { type: DataTypes.DECIMAL(5, 2), defaultValue: 100 },
exam_date: { type: DataTypes.DATE },
description: { type: DataTypes.TEXT },
is_premium: { type: DataTypes.BOOLEAN, defaultValue: false, comment: 'Nội dung premium' },
is_training: { type: DataTypes.BOOLEAN, defaultValue: false, comment: 'Nội dung đào tạo nhân sự' },
is_public: { type: DataTypes.BOOLEAN, defaultValue: false, comment: 'Nội dung công khai' },
min_subscription_tier: { type: DataTypes.STRING(50), comment: 'Gói tối thiểu' },
min_interaction_time: { type: DataTypes.INTEGER, defaultValue: 0, comment: 'Thời gian tương tác tối thiểu (giây)' },
created_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
updated_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
}, {
tableName: 'grade_items',
timestamps: true,
underscored: true,
indexes: [
{ fields: ['is_premium'] },
{ fields: ['is_training'] },
],
});
module.exports = GradeItem;