Files
zen-kanji/server/src/models/Vocabulary.js
T
Crylia b1d4f9f71b
Release Build / build-docker (push) Successful in 2m44s
Release Build / build-android-and-release (push) Failing after 1m27s
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
2026-04-28 21:57:34 +02:00

32 lines
967 B
JavaScript

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);