update context API
All checks were successful
Deploy to Production / deploy (push) Successful in 19s

This commit is contained in:
silverpro89
2026-02-06 11:28:06 +07:00
parent 97dbbd4d12
commit aaba22b40c
12 changed files with 1375 additions and 49 deletions

View File

@@ -15,11 +15,18 @@ const Context = sequelize.define('Context', {
},
context: {
type: DataTypes.TEXT,
allowNull: false,
allowNull: true,
comment: 'Context description'
},
grade : {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100,
comment: 'It is number of gradeX100 + unitX10 + lesson (e.g., Grade 1 Unit 2 Lesson 3 = 123)'
},
knowledge: {
type: DataTypes.TEXT,
allowNull: true,
comment: 'Additional knowledge or information'
},
type: {
@@ -31,7 +38,7 @@ const Context = sequelize.define('Context', {
type: DataTypes.TEXT,
comment: 'Detailed description or requirement'
},
prompt: {
img_prompt: {
type: DataTypes.JSON,
comment: 'Prompt configuration object'
},
@@ -39,30 +46,15 @@ const Context = sequelize.define('Context', {
type: DataTypes.JSON,
comment: 'Array of image URLs'
},
difficulty: {
type: DataTypes.INTEGER,
defaultValue: 1,
comment: 'Difficulty level (1-10)'
},
max: {
type: DataTypes.INTEGER,
defaultValue: 0,
defaultValue: 1,
comment: 'Maximum number of images or items'
},
isPrompt: {
type: DataTypes.BOOLEAN,
defaultValue: false,
comment: 'Prompt created (0/1)'
},
isList: {
type: DataTypes.BOOLEAN,
defaultValue: false,
comment: 'Waiting for more images (0/1)'
},
isApprove: {
type: DataTypes.BOOLEAN,
defaultValue: false,
comment: 'Teacher approval status (0/1)'
status: {
type: DataTypes.INTEGER, // Hoặc DataTypes.ENUM('DRAFT', 'ENRICHED', 'PENDING_IMAGE', ...)
defaultValue: 0,
comment: '0: Draft, 1: Enriched, 2: Prompt_Ready, 3: Generating, 4: Image_Ready, 5: Approved'
},
created_at: {
type: DataTypes.DATE,
@@ -75,6 +67,7 @@ const Context = sequelize.define('Context', {
}, {
tableName: 'context',
timestamps: true,
underscored: false,
createdAt: 'created_at',
updatedAt: 'updated_at',
indexes: [