From 36ae90b7af5f2ccc08a27e2eadcc6415b5f38482 Mon Sep 17 00:00:00 2001 From: rainbow napkin Date: Thu, 4 Jun 2026 00:18:36 -0400 Subject: [PATCH] Started work on dedicated channel/user playlist models. --- .../media/playlist/channelPlaylistSchema.js | 40 +++++++++++++++++++ .../media/playlist/userPlaylistSchema.js | 40 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 src/schemas/channel/media/playlist/channelPlaylistSchema.js create mode 100644 src/schemas/channel/media/playlist/userPlaylistSchema.js diff --git a/src/schemas/channel/media/playlist/channelPlaylistSchema.js b/src/schemas/channel/media/playlist/channelPlaylistSchema.js new file mode 100644 index 0000000..e6d7bc7 --- /dev/null +++ b/src/schemas/channel/media/playlist/channelPlaylistSchema.js @@ -0,0 +1,40 @@ +/*Canopy - The next generation of stoner streaming software +Copyright (C) 2024-2025 Rainbownapkin and the TTN Community + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .*/ + +//NPM Imports +const {mongoose} = require('mongoose'); + +//Local Imports +const playlistSchema = require('./playlistSchema'); + +/** + * DB Schema for Documents representing channel playlists + */ +const channelPlaylistProperties = new mongoose.Schema({ + channel: { + type: mongoose.SchemaTypes.ObjectID, + ref: "channel", + required: true + } +}, +{ + discriminatorKey: 'location' +}); +//Create 'channelPlaylistSchema' as descriminator of playlistSchema +var channelPlaylistSchema = playlistSchema.discriminator('channel', channelPlaylistProperties); + +//Export mongoose model based on channelPlaylistSchema +module.exports = mongoose.model("channelPlaylists", channelPlaylistSchema); \ No newline at end of file diff --git a/src/schemas/channel/media/playlist/userPlaylistSchema.js b/src/schemas/channel/media/playlist/userPlaylistSchema.js new file mode 100644 index 0000000..1dedcdc --- /dev/null +++ b/src/schemas/channel/media/playlist/userPlaylistSchema.js @@ -0,0 +1,40 @@ +/*Canopy - The next generation of stoner streaming software +Copyright (C) 2024-2025 Rainbownapkin and the TTN Community + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .*/ + +//NPM Imports +const {mongoose} = require('mongoose'); + +//Local Imports +const playlistSchema = require('./playlistSchema'); + +/** + * DB Schema for Documents representing user playlists + */ +const userPlaylistProperties = new mongoose.Schema({ + user:{ + type: mongoose.SchemaTypes.ObjectID, + ref: "user", + required: true + } +}, +{ + discriminatorKey: 'location' +}); +//Create 'userPlaylistSchema' as descriminator of playlistSchema +var userPlaylistSchema = playlistSchema.discriminator('user', userPlaylistProperties); + +//Export mongoose model based on userPlaylistSchema +module.exports = mongoose.model("userPlaylists", userPlaylistSchema); \ No newline at end of file