mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -1,14 +1,14 @@
|
||||
const { DataTypes } = require("sequelize");
|
||||
const sequelize = require("../../config/db.config");
|
||||
|
||||
// Standalone entity — no course_id / order_index here. A Unit is attached to
|
||||
// zero or more Courses through course_units, where per-course ordering lives.
|
||||
const Unit = sequelize.define("Unit", {
|
||||
unit_id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true, hidden: true, order: 0, filterable: false },
|
||||
uuid: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, allowNull: false, unique: true, hidden: true, order: 0, filterable: false },
|
||||
course_id: { type: DataTypes.BIGINT, allowNull: false, hidden: true, order: 0, filterable: false },
|
||||
title: { type: DataTypes.STRING(255), allowNull: false, label: "Title", hidden: false, order: 1, filterable: true },
|
||||
description: { type: DataTypes.TEXT, allowNull: true, label: "Description", hidden: true, order: 0, filterable: false },
|
||||
order_index: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0, label: "Order", hidden: false, order: 2, filterable: false },
|
||||
duration_seconds: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0, hidden: false, order: 3, filterable: false },
|
||||
duration_seconds: { type: DataTypes.INTEGER, allowNull: true, defaultValue: 0, hidden: false, order: 2, filterable: false },
|
||||
createdBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true },
|
||||
updatedBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true },
|
||||
deletedBy: { type: DataTypes.BIGINT, allowNull: true, filterable: true },
|
||||
@@ -18,10 +18,8 @@ const Unit = sequelize.define("Unit", {
|
||||
paranoid: true,
|
||||
indexes: [
|
||||
{ fields: ["uuid"] },
|
||||
{ fields: ["course_id"] },
|
||||
{ fields: ["order_index"] },
|
||||
{ fields: ["deletedAt"] },
|
||||
],
|
||||
});
|
||||
|
||||
module.exports = Unit;
|
||||
module.exports = Unit;
|
||||
|
||||
Reference in New Issue
Block a user