Started work on dedicated channel/user playlist models.
This commit is contained in:
parent
c5c484b8c1
commit
36ae90b7af
2 changed files with 80 additions and 0 deletions
40
src/schemas/channel/media/playlist/channelPlaylistSchema.js
Normal file
40
src/schemas/channel/media/playlist/channelPlaylistSchema.js
Normal file
|
|
@ -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 <https://www.gnu.org/licenses/>.*/
|
||||
|
||||
//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);
|
||||
40
src/schemas/channel/media/playlist/userPlaylistSchema.js
Normal file
40
src/schemas/channel/media/playlist/userPlaylistSchema.js
Normal file
|
|
@ -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 <https://www.gnu.org/licenses/>.*/
|
||||
|
||||
//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);
|
||||
Loading…
Add table
Add a link
Reference in a new issue