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

View File

@@ -0,0 +1,95 @@
const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/database');
/**
* ParentAssignedTask Model - Phụ huynh gán bài tập cho con
*/
const ParentAssignedTask = sequelize.define('parent_assigned_tasks', {
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true,
},
parent_id: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'users_auth',
key: 'id',
},
comment: 'Phụ huynh gán',
},
student_id: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'student_details',
key: 'id',
},
comment: 'Học sinh được gán',
},
grade_item_id: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'grade_items',
key: 'id',
},
comment: 'Bài tập được gán',
},
assigned_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
comment: 'Thời gian gán',
},
due_date: {
type: DataTypes.DATEONLY,
comment: 'Hạn hoàn thành',
},
status: {
type: DataTypes.ENUM('pending', 'in_progress', 'completed', 'overdue'),
defaultValue: 'pending',
comment: 'Trạng thái',
},
message: {
type: DataTypes.TEXT,
comment: 'Lời nhắn của phụ huynh',
},
priority: {
type: DataTypes.ENUM('low', 'normal', 'high'),
defaultValue: 'normal',
comment: 'Độ ưu tiên',
},
completion_date: {
type: DataTypes.DATE,
comment: 'Ngày hoàn thành',
},
student_notes: {
type: DataTypes.TEXT,
comment: 'Ghi chú của học sinh khi hoàn thành',
},
created_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
updated_at: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
}, {
tableName: 'parent_assigned_tasks',
timestamps: true,
underscored: true,
indexes: [
{ fields: ['parent_id'] },
{ fields: ['student_id'] },
{ fields: ['status'] },
{ fields: ['due_date'] },
],
comment: 'Bảng quản lý bài tập phụ huynh gán cho con',
});
module.exports = ParentAssignedTask;