feat: add vocabulary browser with filters, audio playback, and example sentences
- Add Vocabularies page with searchable, level-grouped grid - Implement multi-faceted filter system (word type, verb class, transitivity, reading ending, character count) - Add male/female voice audio playback via WaniKani pronunciation data - Display context sentences from WaniKani API - Collapsible mnemonics section in detail modal - Component kanji chips navigate to Collection with pre-filled search - Vocabulary sync uses upsert to keep data fresh (audio, sentences, normalized POS) - Add Vocabulary model, controller, service, and API route - Add seed data with 28 vocabulary entries including transitive/intransitive verb pairs - Full i18n support (EN, DE, JA) for all new UI elements
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
const vocabularySchema = new mongoose.Schema({
|
||||
userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true },
|
||||
wkSubjectId: { type: Number, required: true },
|
||||
characters: { type: String, required: true },
|
||||
meanings: { type: [String], default: [] },
|
||||
readings: [{
|
||||
reading: String,
|
||||
primary: { type: Boolean, default: false }
|
||||
}],
|
||||
partsOfSpeech: { type: [String], default: [] },
|
||||
level: { type: Number, required: true },
|
||||
meaningMnemonic: { type: String, default: '' },
|
||||
readingMnemonic: { type: String, default: '' },
|
||||
componentSubjectIds: { type: [Number], default: [] },
|
||||
pronunciationAudios: [{
|
||||
url: String,
|
||||
contentType: String,
|
||||
gender: String
|
||||
}],
|
||||
contextSentences: [{
|
||||
ja: String,
|
||||
en: String
|
||||
}]
|
||||
});
|
||||
|
||||
vocabularySchema.index({ userId: 1, wkSubjectId: 1 }, { unique: true });
|
||||
vocabularySchema.index({ userId: 1, level: 1 });
|
||||
|
||||
export const Vocabulary = mongoose.model('Vocabulary', vocabularySchema);
|
||||
Reference in New Issue
Block a user