Natsuki's API! https://api.natsuki.app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
api/db/ani/series.js

88 lines
4.1 KiB

const {Schema} = require("mongoose");
module.exports = (connection) => connection.model('series', new Schema({
id: {type: String, unique: true, required: true, maxLength: 25}, //!REQ
numericalId: {type: Number, unique: true, required: true, min: 1}, //!REQ
meta: {
locked: {type: Boolean, default: false},
creator: {type: String, required: true}, //uid //!REQ
edits: {type: [{
user: String, //uid
timestamp: String, //Date.getTime(),
action: String
}], default: []},
completed: {type: Boolean, default: false}, //SUBMISSION completed
approved: {type: Schema.Types.Mixed, default: false}, //boolean or {approved: Boolean, by: <uid>}
submitted: Schema.Types.Mixed, //can be false or a string with the ID of the submitter, //!REQ
hidden: {type: Boolean, default: false},
reviewFlags: {type: [{
by: String,
reason: String,
}], default: []}
}, //!REQ
name: {type: String, required: true, maxLength: 150}, //!REQ
romaji: {type: String, required: true, maxLength: 150}, //!REQ
kanji: {type: String, maxLength: 150, default: null},
altNames: {type: [{type: String, maxLength: 150}], default: []},
synopsis: {type: {
synopsis: {type: String, required: true, maxLength: 1000},
by: String //uid
}, required: true}, //if not present, use "Synopsis not available yet" //!REQ
genres: {type: [{type: String, maxLength: 25}], required: true}, //!REQ
//TODO database for genres or cache
tags: {default: [], type: [{type: String, maxLength: 25}]},
nsfw: {type: Boolean, default: false},
nsfwReason: {type: String, default: null}, //gore, language, nudity, strong themes
completed: {type: Boolean, default: false}, //SERIES completed
streamAt: {type: [{type: String, maxLength: 25}], default: []},
publishers: {type: [{type: String, maxLength: 50}], default: []},
studios: {type: [{type: String, maxLength: 50}], default: []},
air: {
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
},
externalLinks: {type: Object, default: {}}, //streaming services, other databases, etc. //TODO externalLinks
officialSite: {type: String, default: null},
videos: {type: Object, default: {}}, //OPs, EDs, trailers, etc.
art: {
cover: {type: [String], default: []}, //first item of any list is default item
icon: {type: [String], default: []}, //small 128x128 icon
banner: {type: [String], default: []},
poster: {type: [String], default: []}, //used for BGs, portrait
widePoster: {type: [String], default: []}, //used for desktop, client should format banners or displays at its discretion if unavailable
display: {type: [String], default: []}, //used for some content BGs, landscape standard desktop res.
},
ratings: {type: [{
user: String,
rating: Number
}], default: []}, //all ratings mapped by user
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
likes: {type: Number, default: 0}, //no need to map by user here
reviews: {type: [{ //full review vs rating
user: String,
ratings: {
plot: Number,
characters: Number,
soundtrack: Number,
animation: Number
},
comments: {type: String, maxLength: 2000}
}], default: []},
/**
* !API-DEPENDENT FIELDS
* TODO add API-dependent fields for series schema
*
* Stores only IDs and barebones data, requires clients to fetch their contents
*/
seasons: {type: [String], default: []},
characters: {type: [String], default: []},
related: {type: [String], default: []} //TODO this shit even necessary?
}));