mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
- Introduces a new Music Library system for managing favorites (tracks, playlists, releases), replacing the previous TrackLike model. - Completely revamps the Studio TV profile page, adding live statistics, stream configuration, restream management, and media URL display. - Enhances the media player with a custom seekbar and improved audio playback logic for MPD and non-MPD sources. - Lays foundational groundwork for chat encryption with new models and APIs. - Refactors critical UI components like PlaylistView and PagePanel. - Standardizes monorepo development scripts to use npm. - Updates comty.js submodule and adds various new UI components.
36 lines
739 B
JavaScript
Executable File
36 lines
739 B
JavaScript
Executable File
import mongoose, { Schema } from "mongoose"
|
|
import fs from "fs"
|
|
import path from "path"
|
|
|
|
function generateModels() {
|
|
let models = {}
|
|
|
|
const dirs = fs.readdirSync(__dirname).filter((file) => file !== "index.js")
|
|
|
|
dirs.forEach((file) => {
|
|
const model = require(path.join(__dirname, file)).default
|
|
|
|
if (mongoose.models[model.name]) {
|
|
return (models[model.name] = mongoose.model(model.name))
|
|
}
|
|
|
|
model.schema = new Schema(model.schema)
|
|
|
|
if (model.extend) {
|
|
Object.keys(model.extend).forEach((key) => {
|
|
model.schema.statics[key] = model.extend[key]
|
|
})
|
|
}
|
|
|
|
return (models[model.name] = mongoose.model(
|
|
model.name,
|
|
model.schema,
|
|
model.collection,
|
|
))
|
|
})
|
|
|
|
return models
|
|
}
|
|
|
|
module.exports = generateModels()
|