Compare commits

...

2 commits

6 changed files with 87 additions and 4 deletions

View file

@ -30,7 +30,7 @@ const emoteModel = require('../emoteSchema');
const channelPermissionSchema = require('./channelPermissionSchema'); const channelPermissionSchema = require('./channelPermissionSchema');
const channelBanSchema = require('./channelBanSchema'); const channelBanSchema = require('./channelBanSchema');
const queuedMediaSchema = require('./media/queuedMediaSchema'); const queuedMediaSchema = require('./media/queuedMediaSchema');
const playlistSchema = require('./media/playlistSchema'); const playlistSchema = require('./media/playlist/playlistSchema');
const chatSchema = require('./chatSchema'); const chatSchema = require('./chatSchema');
//Utils //Utils
const { exceptionHandler, errorHandler } = require('../../utils/loggerUtils'); const { exceptionHandler, errorHandler } = require('../../utils/loggerUtils');

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

View file

@ -18,8 +18,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
const {mongoose} = require('mongoose'); const {mongoose} = require('mongoose');
//Local Imports //Local Imports
const mediaSchema = require('./mediaSchema'); const mediaSchema = require('../mediaSchema');
const media = require('../../../app/channel/media/media'); const media = require('../../../../app/channel/media/media');
/** /**
* DB Schema for documents represnting a piece of media held in a playlist * DB Schema for documents represnting a piece of media held in a playlist

View file

@ -34,6 +34,9 @@ const playlistSchema = new mongoose.Schema({
required: false, required: false,
default: [] default: []
}] }]
},
{
discriminatorKey: 'location'
}); });
//methods //methods

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

View file

@ -27,7 +27,7 @@ const flairModel = require('../flairSchema');
const permissionModel = require('../permissionSchema'); const permissionModel = require('../permissionSchema');
const emoteModel = require('../emoteSchema'); const emoteModel = require('../emoteSchema');
const emailChangeModel = require('./emailChangeSchema'); const emailChangeModel = require('./emailChangeSchema');
const playlistSchema = require('../channel/media/playlistSchema'); const playlistSchema = require('../channel/media/playlist/playlistSchema');
const rememberMeModel = require('./rememberMeSchema'); const rememberMeModel = require('./rememberMeSchema');
//Utils //Utils
const hashUtil = require('../../utils/hashUtils'); const hashUtil = require('../../utils/hashUtils');