123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713 |
- var Schemas = {};
- Schemas.FullSong = new SimpleSchema({
- "id": {
- type: String,
- label: "Song YouTube id"
- },
- "mid": {
- type: String,
- label: "Song mid"
- },
- "likes": {
- type: Number,
- label: "Song likes",
- defaultValue: 0
- },
- "dislikes": {
- type: Number,
- label: "Song dislikes",
- defaultValue: 0
- },
- "title": {
- type: String,
- label: "Song title"
- },
- "artist": {
- type: String,
- label: "Song artist"
- },
- "img": {
- type: String,
- label: "Song img"
- },
- "duration": {
- type: Number,
- label: "Song duration",
- min: 0,
- decimal: true
- },
- "skipDuration": {
- type: Number,
- label: "Song skipDuration",
- min: 0,
- decimal: true
- },
- "genres": {
- type: Array,
- label: "Array of song genre's"
- },
- "genres.$": {
- type: String,
- label: "Song genre"
- },
- "requestedBy": {
- type: String,
- label: "User ID of the person who requested the song"
- },
- "approvedBy": {
- type: String,
- label: "User ID of the person who approved the song"
- }
- });
- Schemas.UserSong = new SimpleSchema({
- "id": {
- type: String,
- label: "Song YouTube id"
- },
- "title": {
- type: String,
- label: "Song title"
- },
- "duration": {
- type: Number,
- label: "Song duration",
- min: 0,
- decimal: true
- }
- });
- Schemas.QueueSong = new SimpleSchema({
- "id": {
- type: String,
- label: "Song YouTube id"
- },
- "mid": {
- type: String,
- label: "Song mid"
- },
- "likes": {
- type: Number,
- label: "Song likes",
- defaultValue: 0
- },
- "dislikes": {
- type: Number,
- label: "Song dislikes",
- defaultValue: 0
- },
- "title": {
- type: String,
- label: "Song title"
- },
- "artist": {
- type: String,
- label: "Song artist"
- },
- "img": {
- type: String,
- label: "Song img"
- },
- "duration": {
- type: Number,
- label: "Song duration",
- min: 0,
- decimal: true
- },
- "skipDuration": {
- type: Number,
- label: "Song skipDuration",
- min: 0,
- decimal: true
- },
- "genres": {
- type: Array,
- label: "Array of song genre's"
- },
- "genres.$": {
- type: String,
- label: "Song genre"
- },
- "requestedBy": {
- type: String,
- label: "User ID of the person who requested the song"
- }
- });
- Schemas.Chat = new SimpleSchema({
- type: {
- type: String,
- label: "Type of the room a message was sent in",
- regEx: /^[a-z0-9_]{1,20}$/
- },
- rawrank: {
- type: String,
- label: "Rank of the user who sent the message"
- },
- rank: {
- type: String,
- label: "Display tag of the rank of the user who sent a message",
- optional: true
- },
- message: {
- type: String,
- label: "The message",
- max: 300
- },
- username: {
- type: String,
- label: "Username of the user who sent the message"
- },
- time: {
- type: Date,
- label: "Date of the time the message was sent"
- }
- });
- Schemas.Alert = new SimpleSchema({
- description: {
- type: String,
- label: "The Alert's Description"
- },
- active: {
- type: Boolean,
- label: "Whether or not the alert is active or not"
- },
- createdBy: {
- type: String,
- label: "Username of the person who created an alert"
- }
- });
- Schemas.Feedback = new SimpleSchema({
- username: {
- type: String,
- label: "Username of user who submitted feedback"
- },
- message: {
- type: String,
- label: "Feedback message"
- },
- upvotes: {
- type: Number,
- label: "Number of upvotes for a feedback"
- },
- upvotedBy: {
- type: Array,
- label: "Array of usernames of users who upvoted a feedback"
- },
- "upvotedBy.$": {
- type: String,
- label: "Username of user who upvoted a feedback"
- }
- });
- Schemas.Room = new SimpleSchema({
- display: {
- type: String,
- label: "Room Display Name",
- regEx: /^[a-z0-9A-Z_\s]{1,30}$/
- },
- type: {
- type: String,
- label: "Room Type",
- regEx: /^[a-z0-9_]{1,20}$/
- },
- currentSong: {
- type: Object,
- defaultValue: {},
- label: "Current Song"
- },
- "currentSong.song": {
- type: Schemas.FullSong,
- label: "Current Song Object"
- },
- "currentSong.started": {
- type: Number,
- label: "Current Song Start Date"
- },
- timePaused: {
- type: Number,
- defaultValue: 0,
- label: "Amount of time a room has been paused for"
- },
- users: {
- type: Number,
- defaultValue: 0,
- label: "Users Online",
- min: 0
- },
- state: {
- type: String,
- defaultValue: "paused",
- allowedValues: ["paused", "playing"],
- label: "Room State"
- },
- votes: {
- type: Number,
- defaultValue: 0,
- label: "Current votes to skip current song",
- min: 0
- },
- private: {
- type: Boolean,
- defaultValue: false,
- label: "Room private or not"
- },
- roomDesc: {
- type: String,
- label: "Room description"
- },
- userList: {
- type: Array,
- label: "List of currently online people",
- defaultValue: []
- },
- "userList.$": {
- type: String,
- label: "Username of user currently in a room"
- },
- "playlist": {
- type: String,
- optional: true,
- label: "Name of current playlist selected from owner"
- }
- });
- Schemas.CommunityStation = new SimpleSchema({
- name: {
- type: String,
- label: "Room Name",
- regEx: /^[a-z0-9A-Z_\s]{1,30}$/
- },
- displayName: {
- type: String,
- label: "Room Display Name"
- },
- currentSong: {
- type: Object,
- defaultValue: {song: {id: "60ItHLz5WEA", duration: 213, title: "Alan Walker - Faded"}, started: 0},
- label: "Current Song Object",
- blackbox: true
- },
- "currentSong.song": {
- type: Schemas.UserSong,
- label: "Current Song Object"
- },
- "currentSong.started": {
- type: Number,
- label: "Current Song Start Date"
- },
- "currentSong.requestedBy": {
- type: String,
- label: "Current Song requested by",
- optional: true
- },
- timePaused: {
- type: Number,
- defaultValue: 0,
- label: "Amount of time a room has been paused for"
- },
- users: {
- type: Number,
- defaultValue: 0,
- label: "Users Online",
- min: 0
- },
- state: {
- type: String,
- defaultValue: "playing",
- allowedValues: ["paused", "playing"],
- label: "Room State"
- },
- votes: {
- type: Number,
- defaultValue: 0,
- label: "Current votes to skip current song",
- min: 0
- },
- privacy: {
- type: String,
- defaultValue: "private",
- label: "Room privacy",
- allowedValues: ["public", "unlisted", "private"]
- },
- roomDesc: {
- type: String,
- label: "Room description"
- },
- userList: {
- type: Array,
- label: "List of currently online people",
- defaultValue: []
- },
- "userList.$": {
- type: String,
- label: "Username of user currently in a room"
- },
- allowed: {
- type: Array,
- label: "List of allowed users in the room",
- defaultValue: []
- },
- "allowed.$": {
- type: String,
- label: "Username of user allowed in room"
- },
- "playlist": {
- type: String,
- optional: true,
- label: "Playlist in room"
- },
- "owner": {
- type: String,
- label: "User id of owner"
- },
- lastSong: {
- type: Number,
- label: "Index of the previous song",
- defaultValue: 0
- },
- partyModeEnabled: {
- type: Boolean,
- label: "Party mode",
- defaultValue: false
- },
- queue: {
- type: Array,
- label: "Community station queue",
- defaultValue: []
- },
- "queue.$": {
- type: new SimpleSchema({
- song: {
- type: Schemas.UserSong,
- label: "Queue song object"
- },
- requestedBy: {
- type: String,
- label: "User id of person who added song to queue"
- }
- }),
- label: "Queue song"
- }
- });
- Schemas.PrivatePlaylist = new SimpleSchema({
- name: {
- type: String,
- label: "Name of playlist",
- regEx: /^[a-z0-9_]{1,20}$/
- },
- displayName: {
- type: String,
- label: "Displayname of playlist"
- },
- songs: {
- type: Array,
- label: "Array of song objects"
- },
- "songs.$": {
- type: Schemas.UserSong,
- label: "Song Object"
- },
- owner: {
- type: String,
- label: "Owner of playlist"
- }
- });
- Schemas.Playlist = new SimpleSchema({
- type: {
- type: String,
- label: "Type of the room the playlist is for",
- regEx: /^[a-z0-9_]{1,20}$/
- },
- songs: {
- type: Array,
- label: "Array of song MID's"
- },
- "songs.$": {
- type: String,
- label: "Song mid"
- },
- lastSong: {
- type: Number,
- label: "Index of the previous song",
- defaultValue: 0
- }
- });
- Schemas.UserProfile = new SimpleSchema({
- username: {
- type: String,
- label: "Username",
- regEx: /^[a-zA-Z0-9_]+$/,
- min: 3,
- max: 26
- },
- usernameL: {
- type: String,
- label: "Username in lowercase",
- regEx: /^[a-z0-9_]+$/
- },
- realname: {
- type: String,
- label: "Real Name",
- regEx: /^[A-Za-z0-9 .'-]+$/,
- optional: true
- },
- rank: {
- type: String,
- label: "Rank",
- allowedValues: ["default", "moderator", "admin"]
- },
- liked: {
- type: Array,
- label: "User's Liked songs"
- },
- "liked.$": {
- type: String,
- label: "A MID of a song a user liked"
- },
- disliked: {
- type: Array,
- label: "User's Disliked songs"
- },
- "disliked.$": {
- type: String,
- label: "A MID of a song a user disliked"
- },
- settings: {
- type: Object,
- label: "The settings of a user"
- },
- "settings.showRating": {
- type: Boolean,
- label: "If a user wants their liked and disliked songs to show up for everyone",
- defaultValue: false
- },
- statistics: {
- type: Object,
- label: "The statistics of a user"
- },
- "statistics.songsRequested": {
- type: Number,
- label: "Amount of songs the user has requested",
- defaultValue: 0
- }
- });
- Schemas.UserPunishments = new SimpleSchema({
- mute: {
- type: Object,
- label: "User's Current Mute Info",
- optional: true
- },
- "mute.mutedBy": {
- type: String,
- label: "Muted By"
- },
- "mute.mutedAt": {
- type: Date,
- label: "Muted At"
- },
- "mute.mutedUntil": {
- type: Date,
- label: "Muted Until"
- },
- mutes: {
- type: Array,
- label: "All of the mutes of a user",
- optional: true
- },
- "mutes.$": {
- type: Object,
- label: "One of the mutes of a user"
- },
- "mutes.$.mutedBy": {
- type: String,
- label: "Muted By"
- },
- "mutes.$.mutedAt": {
- type: Date,
- label: "Muted At"
- },
- "mutes.$.mutedUntil": {
- type: Date,
- label: "Muted Until"
- },
- ban: {
- type: Object,
- label: "User's Current Ban Info",
- optional: true
- },
- "ban.bannedBy": {
- type: String,
- label: "Banned By"
- },
- "ban.bannedReason": {
- type: String,
- label: "Banned Reason"
- },
- "ban.bannedAt": {
- type: Date,
- label: "Banned At"
- },
- "ban.bannedUntil": {
- type: Date,
- label: "Banned Until"
- },
- bans: {
- type: Array,
- label: "All of the bans of a user",
- optional: true
- },
- "bans.$": {
- type: Object,
- label: "One of the bans of a user"
- },
- "bans.$.bannedBy": {
- type: String,
- label: "Banned By"
- },
- "bans.$.bannedReason": {
- type: String,
- label: "Banned Reason"
- },
- "bans.$.bannedAt": {
- type: Date,
- label: "Banned At"
- },
- "bans.$.bannedUntil": {
- type: Date,
- label: "Banned Until"
- }
- });
- Schemas.User = new SimpleSchema({
- username: {
- type: String,
- // For accounts-password, either emails or username is required, but not both. It is OK to make this
- // optional here because the accounts-password package does its own validation.
- // Third-party login packages may not require either. Adjust this schema as necessary for your usage.
- optional: true,
- regEx: /^[a-zA-Z0-9_]+$/,
- min: 3,
- max: 26
- },
- emails: {
- type: Array,
- // For accounts-password, either emails or username is required, but not both. It is OK to make this
- // optional here because the accounts-password package does its own validation.
- // Third-party login packages may not require either. Adjust this schema as necessary for your usage.
- optional: true
- },
- "emails.$": {
- type: Object
- },
- "emails.$.address": {
- type: String,
- regEx: SimpleSchema.RegEx.Email
- },
- "emails.$.verified": {
- type: Boolean
- },
- createdAt: {
- type: Date
- },
- profile: {
- type: Schemas.UserProfile
- },
- punishments: {
- type: Schemas.UserPunishments,
- defaultValue: {mutes: [], bans: []}
- },
- // Make sure this services field is in your schema if you're using any of the accounts packages
- services: {
- type: Object,
- optional: true,
- blackbox: true
- },
- // In order to avoid an 'Exception in setInterval callback' from Meteor
- heartbeat: {
- type: Date,
- optional: true
- }
- });
- Schemas.Report = new SimpleSchema({
- room: {
- type: String,
- label: "Type of the room that the reports are from",
- regEx: /^[a-z0-9_]{1,20}$/
- },
- report: {
- type: Array,
- label: "The reports"
- },
- "report.$": {
- type: Object,
- label: "A report"
- },
- "report.$.song": {
- type: String,
- label: "A report's song MID"
- },
- "report.$.type": {
- type: Array,
- label: "The types of things a song was reported for"
- },
- "report.$.type.$": {
- type: String,
- label: "A type of thing a report was reported for",
- allowedValues: ["report-song", "report-title", "report-author", "report-duration", "report-audio", "report-albumart", "report-other"]
- },
- "report.$.reason": {
- type: Array,
- label: "The reasons a song was reported for"
- },
- "report.$.reason.$": {
- type: String,
- label: "A reason a song was reported for",
- allowedValues: ["report-song-not-playing", "report-song-does-not-exist", "report-song-other", "report-title-incorrect", "report-title-inappropriate", "report-title-other", "report-author-incorrect", "report-author-inappropriate", "report-author-other", "report-duration-long", "report-duration-short", "report-duration-other", "report-audio-inappropriate", "report-audio-not-playing", "report-audio-other", "report-albumart-incorrect", "report-albumart-inappropriate", "report-albumart-not-showing", "report-albumart-other"]
- },
- "report.$.other": {
- type: String,
- label: "Other",
- optional: true
- }
- });
- Schemas.Article = new SimpleSchema({
- "title": {
- type: String,
- label: "Article Title"
- },
- "content": {
- type: String,
- label: "Article Content"
- },
- "author": {
- type: String,
- label: "Article's Author"
- },
- "time": {
- type: Date,
- label: "Article's Create Date"
- }
- });
- Rooms.attachSchema(Schemas.Room);
- Alerts.attachSchema(Schemas.Alert);
- Chat.attachSchema(Schemas.Chat);
- Playlists.attachSchema(Schemas.Playlist);
- Queues.attachSchema(Schemas.QueueSong);
- Meteor.users.attachSchema(Schemas.User);
- Reports.attachSchema(Schemas.Report);
- Feedback.attachSchema(Schemas.Feedback);
- Songs.attachSchema(Schemas.FullSong);
- News.attachSchema(Schemas.Article);
- CommunityStations.attachSchema(Schemas.CommunityStation);
- PrivatePlaylists.attachSchema(Schemas.PrivatePlaylist);
|