| 
						
						
						
					 | 
					 | 
					@ -1,7 +1,7 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					const {Schema} = require("mongoose"); | 
					 | 
					 | 
					 | 
					const {Schema} = require("mongoose"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					module.exports = (connection) => connection.model('series', new Schema({ | 
					 | 
					 | 
					 | 
					module.exports = (connection) => connection.model('series', new Schema({ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    id: {type: String, unique: true, required: true, maxLength: 25}, //!REQ
 | 
					 | 
					 | 
					 | 
					    id: {type: String, unique: true, required: true, maxLength: 25, lowercase: true}, //!REQ
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    numericalId: {type: Number, unique: true, required: true, min: 1}, //!REQ
 | 
					 | 
					 | 
					 | 
					    numericalId: {type: Number, unique: true, required: true, min: 1}, //!REQ
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    meta: { | 
					 | 
					 | 
					 | 
					    meta: { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        locked: {type: Boolean, default: false}, | 
					 | 
					 | 
					 | 
					        locked: {type: Boolean, default: false}, | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -33,7 +33,7 @@ module.exports = (connection) => connection.model('series', new Schema({ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }, required: true}, //if not present, use "Synopsis not available yet" //!REQ
 | 
					 | 
					 | 
					 | 
					    }, required: true}, //if not present, use "Synopsis not available yet" //!REQ
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    genres: {type: [{type: String, maxLength: 25}], required: true}, //!REQ
 | 
					 | 
					 | 
					 | 
					    genres: {type: [{type: String, maxLength: 25}], required: true}, //!REQ
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    //TODO database for genres or cache
 | 
					 | 
					 | 
					 | 
					    //TODO database for genres or cache
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    tags: {default: [], type: [{type: String, maxLength: 25}]}, | 
					 | 
					 | 
					 | 
					    tags: {default: [], type: [{type: String, maxLength: 25}], lowercase: true}, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    nsfw: {type: Boolean, default: false}, | 
					 | 
					 | 
					 | 
					    nsfw: {type: Boolean, default: false}, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    nsfwReason: {type: String, default: null}, //gore, language, nudity, strong themes
 | 
					 | 
					 | 
					 | 
					    nsfwReason: {type: String, default: null}, //gore, language, nudity, strong themes
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -45,7 +45,11 @@ module.exports = (connection) => connection.model('series', new Schema({ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        from: {type: String, default: null}, //absence of start date means anime is confirmed but not released //TODO special handling for unstarted series
 | 
					 | 
					 | 
					 | 
					        from: {type: String, default: null}, //absence of start date means anime is confirmed but not released //TODO special handling for unstarted series
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        to: {type: String, default: null} //null indicates still airing; completed: true + non-null "to" value means series is waiting on another season
 | 
					 | 
					 | 
					 | 
					        to: {type: String, default: null} //null indicates still airing; completed: true + non-null "to" value means series is waiting on another season
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }, | 
					 | 
					 | 
					 | 
					    }, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    externalLinks: {type: Object, default: {}}, //streaming services, other databases, etc. //TODO externalLinks
 | 
					 | 
					 | 
					 | 
					    externalLinks: { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        type: [{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }], default: {} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }, //streaming services, other databases, etc. //TODO externalLinks
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    officialSite: {type: String, default: null}, | 
					 | 
					 | 
					 | 
					    officialSite: {type: String, default: null}, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    videos: {type: Object, default: {}}, //OPs, EDs, trailers, etc.
 | 
					 | 
					 | 
					 | 
					    videos: {type: Object, default: {}}, //OPs, EDs, trailers, etc.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -61,7 +65,7 @@ module.exports = (connection) => connection.model('series', new Schema({ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    ratings: {type: [{ | 
					 | 
					 | 
					 | 
					    ratings: {type: [{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        user: String, | 
					 | 
					 | 
					 | 
					        user: String, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        rating: Number | 
					 | 
					 | 
					 | 
					        rating: Number | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }], default: []}, //all ratings mapped by user
 | 
					 | 
					 | 
					 | 
					    }], default: () => ([])}, //all ratings mapped by user
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    rating: {type: Number, default: 0}, //automatic collection of user ratings for avg.
 | 
					 | 
					 | 
					 | 
					    rating: {type: Number, default: 0}, //automatic collection of user ratings for avg.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    watchers: {type: [String], default: []}, //people with this anime on their watching and/or watchlists
 | 
					 | 
					 | 
					 | 
					    watchers: {type: [String], default: []}, //people with this anime on their watching and/or watchlists
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    likes: {type: Number, default: 0}, //no need to map by user here
 | 
					 | 
					 | 
					 | 
					    likes: {type: Number, default: 0}, //no need to map by user here
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -74,7 +78,8 @@ module.exports = (connection) => connection.model('series', new Schema({ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                animation: Number | 
					 | 
					 | 
					 | 
					                animation: Number | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }, | 
					 | 
					 | 
					 | 
					            }, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            comments: {type: String, maxLength: 2000} | 
					 | 
					 | 
					 | 
					            comments: {type: String, maxLength: 2000} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }], default: []}, | 
					 | 
					 | 
					 | 
					        }], default: [] | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * !API-DEPENDENT FIELDS | 
					 | 
					 | 
					 | 
					     * !API-DEPENDENT FIELDS | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |