This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const { sequelize } = require('../config/database');
|
||||
const { ref } = require('joi');
|
||||
|
||||
const Context = sequelize.define('Context', {
|
||||
uuid: {
|
||||
@@ -43,9 +44,17 @@ const Context = sequelize.define('Context', {
|
||||
comment: 'Prompt configuration object'
|
||||
},
|
||||
image: {
|
||||
type: DataTypes.JSON,
|
||||
type: DataTypes.TEXT,
|
||||
comment: 'Array of image URLs'
|
||||
},
|
||||
type_context: {
|
||||
type: DataTypes.STRING(50),
|
||||
comment: 'Type of context (e.g., example_sentence, dialogue)'
|
||||
},
|
||||
type_image: {
|
||||
type: DataTypes.STRING(50),
|
||||
comment: 'Type of image (e.g., small, square, normal)'
|
||||
},
|
||||
max: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 1,
|
||||
@@ -56,6 +65,10 @@ const Context = sequelize.define('Context', {
|
||||
defaultValue: 0,
|
||||
comment: '0: Draft, 1: Enriched, 2: Prompt_Ready, 3: Generating, 4: Image_Ready, 5: Approved'
|
||||
},
|
||||
reference_id: {
|
||||
type: DataTypes.UUID,
|
||||
comment: 'Reference to another entity if applicable'
|
||||
},
|
||||
created_at: {
|
||||
type: DataTypes.DATE,
|
||||
defaultValue: DataTypes.NOW
|
||||
|
||||
@@ -14,6 +14,10 @@ const Vocab = sequelize.define('Vocab', {
|
||||
allowNull: false,
|
||||
index: true
|
||||
},
|
||||
ipa : {
|
||||
type: DataTypes.STRING(100),
|
||||
comment: 'International Phonetic Alphabet representation'
|
||||
},
|
||||
// Từ gốc để nhóm lại (wash, eat...)
|
||||
base_word: {
|
||||
type: DataTypes.STRING(100),
|
||||
@@ -22,37 +26,55 @@ const Vocab = sequelize.define('Vocab', {
|
||||
},
|
||||
// Đã xuất hiện trong khối nào, bài học nào, lesson nào
|
||||
// Ví dụ 111 là grade 1, unit 1, lesson 1
|
||||
location: {
|
||||
grade: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 100,
|
||||
defaultValue: 0,
|
||||
comment: 'It is number of gradeX100 + unitX10 + lesson (e.g., Grade 1 Unit 2 Lesson 3 = 123)'
|
||||
},
|
||||
// Loại biến thể (V1, V2, V3, V_ing, Noun_Form...)
|
||||
form_key: {
|
||||
type: DataTypes.STRING(20),
|
||||
defaultValue: 'base'
|
||||
type: DataTypes.JSON,
|
||||
defaultValue: 'base',
|
||||
comment: 'Form key indicating the type of word form (e.g., base, V1, V2, V3, V_ing, Noun_Form)'
|
||||
},
|
||||
// Nội dung dùng chung (có thể lưu JSON để dễ quản lý hoặc dùng chung cho cả group)
|
||||
translation: {
|
||||
type: DataTypes.STRING(200)
|
||||
},
|
||||
difficulty_score: {
|
||||
type: DataTypes.INTEGER,
|
||||
defaultValue: 1,
|
||||
comment: 'Difficulty level (1-10)'
|
||||
vi: {
|
||||
type: DataTypes.TEXT,
|
||||
defaultValue: '',
|
||||
comment: 'Vietnamese meaning'
|
||||
},
|
||||
category: {
|
||||
type: DataTypes.STRING(100),
|
||||
comment: 'Category of the word (e.g., Action Verbs, Nouns)'
|
||||
},
|
||||
etc : {
|
||||
type: DataTypes.TEXT,
|
||||
comment: 'Book or additional reference'
|
||||
},
|
||||
topic: {
|
||||
type: DataTypes.STRING(100),
|
||||
comment: 'Topic of the word (e.g., Food, Travel, Education)'
|
||||
},
|
||||
images: {
|
||||
image_small: {
|
||||
type: DataTypes.JSON,
|
||||
comment: 'Array of image URLs'
|
||||
},
|
||||
image_square: {
|
||||
type: DataTypes.JSON,
|
||||
comment: 'Array of image URLs'
|
||||
},
|
||||
image_normal: {
|
||||
type: DataTypes.JSON,
|
||||
comment: 'Array of image URLs'
|
||||
},
|
||||
audio : {
|
||||
type: DataTypes.JSON,
|
||||
comment: 'Array of audio URLs'
|
||||
},
|
||||
example_sentences: {
|
||||
type: DataTypes.JSON,
|
||||
comment: 'Array of example sentences'
|
||||
},
|
||||
tags: {
|
||||
type: DataTypes.JSON,
|
||||
comment: 'Array of tags for categorization'
|
||||
@@ -101,8 +123,8 @@ const Vocab = sequelize.define('Vocab', {
|
||||
fields: ['category']
|
||||
},
|
||||
{
|
||||
name: 'idx_location',
|
||||
fields: ['location']
|
||||
name: 'idx_grade',
|
||||
fields: ['grade']
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user