This commit is contained in:
silverpro89
2026-01-26 20:23:08 +07:00
parent 53d97ba5db
commit 2c7b4675a7
49 changed files with 12668 additions and 1 deletions

78
models/VocabForm.js Normal file
View File

@@ -0,0 +1,78 @@
const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/database');
const VocabForm = sequelize.define('VocabForm', {
form_id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true,
comment: 'Unique identifier for word form'
},
vocab_id: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'vocab',
key: 'vocab_id'
},
onDelete: 'CASCADE',
comment: 'Reference to vocabulary entry'
},
form_key: {
type: DataTypes.STRING(50),
allowNull: false,
comment: 'Form identifier (v1, v2, v3, v_s_es, v_ing, etc.)'
},
text: {
type: DataTypes.STRING(100),
allowNull: false,
comment: 'The actual word form (e.g., eat, eats, eating, ate)'
},
phonetic: {
type: DataTypes.STRING(100),
comment: 'IPA phonetic transcription (e.g., /iːt/)'
},
audio_url: {
type: DataTypes.STRING(500),
comment: 'URL to audio pronunciation file'
},
min_grade: {
type: DataTypes.INTEGER,
defaultValue: 1,
comment: 'Minimum grade level to unlock this form'
},
description: {
type: DataTypes.TEXT,
comment: 'Description or usage note for this form'
},
created_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
},
updated_at: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
}
}, {
tableName: 'vocab_form',
timestamps: true,
createdAt: 'created_at',
updatedAt: 'updated_at',
indexes: [
{
name: 'idx_vocab_form_vocab',
fields: ['vocab_id']
},
{
name: 'idx_vocab_form_key',
fields: ['form_key']
},
{
name: 'idx_vocab_form_unique',
unique: true,
fields: ['vocab_id', 'form_key']
}
]
});
module.exports = VocabForm;