diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..48ac150 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +auth.json +package-lock.json +node_modules/ \ No newline at end of file diff --git a/db/ani/users.js b/db/ani/users.js new file mode 100644 index 0000000..0d984b2 --- /dev/null +++ b/db/ani/users.js @@ -0,0 +1,10 @@ +const {model, Schema} = require("mongoose"); + +module.exports = (connection) => connection.model('users', new Schema({ + name: String, + id: {type: String, unique: true}, + discord: {type: String, unique: true}, + permissions: [String], + password: String, + apiToken: {type: String, unique: true} +})); \ No newline at end of file diff --git a/db/build.js b/db/build.js new file mode 100644 index 0000000..cdd3b41 --- /dev/null +++ b/db/build.js @@ -0,0 +1,10 @@ +const fs = require('fs'); + +module.exports = app => { + app.db.models = {ani: {}, bot: {}}; + fs.readdirSync('../db/ani').filter(file => file.endsWith('.js')).forEach(file => { + const model = require(`./ani/${file}`)(app.db.ani); + app.db.models.ani[model.modelName] = model; + }); + console.log(`Built ${Object.keys(app.db.models.ani).length} models\n`); +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..4db2813 --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "natsuki-api", + "version": "1.0.0", + "main": "index.js", + "dependencies": { + "bcrypt": "^5.1.0", + "body-parser": "^1.20.1", + "cors": "^2.8.5", + "discord.js": "^14.7.1", + "express": "^4.18.2", + "helmet": "^6.0.1", + "jsonwebtoken": "^9.0.0", + "mongoose": "^6.8.4" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "wubzygd", + "license": "ISC", + "description": "" +}