diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100644 index 0000000..e69de29 diff --git a/scripts/users.sql b/scripts/users.sql new file mode 100644 index 0000000..8110242 --- /dev/null +++ b/scripts/users.sql @@ -0,0 +1,17 @@ +CREATE TABLE `notes`.`Users` ( + `id` bigint(20) NOT NULL, + `username` text, + `password` text, + `email` text, + `phone` text, + `ip` text, ` + token` text, + `lastupdated` text, + `verified` tinyint(4) NOT NULL DEFAULT '0', + `authcode` text, + `timeauthed` text NOT NULL, + `admin` tinyint(4) DEFAULT NULL +) + +ENGINE=InnoDB DEFAULT CHARSET=latin1; +ALTER TABLE `notes`.`Users` ADD PRIMARY KEY (`id`); \ No newline at end of file diff --git a/src/controllers/controllerHandler.js b/src/controllers/controllerHandler.js new file mode 100644 index 0000000..a4bf905 --- /dev/null +++ b/src/controllers/controllerHandler.js @@ -0,0 +1,3 @@ +export class ControllerHandler { + +} diff --git a/src/controllers/index.js b/src/controllers/index.js index 2e20bff..38623dd 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -1,8 +1,3 @@ -import {Logger} from '../models/logger'; +export let Controllers = {}; -module.exports.Controller - -Controller.UserController = () => {} - - -class ControllerHandler {} +Controllers.UserController = require('./user').UserController; diff --git a/src/controllers/routes/router.js b/src/controllers/routes/router.js index 7931d92..3ef2686 100644 --- a/src/controllers/routes/router.js +++ b/src/controllers/routes/router.js @@ -2,6 +2,7 @@ import {Logger} from '../../models/logger'; import {Server} from '../../server'; import {MiddleWare} from '../middleware'; import {StatusCodes} from '../status'; +import {Controllers} from '../index'; let app; @@ -12,9 +13,9 @@ export class Router { app = Server.App; app.get('/', [MiddleWare.analytics, Router.frontPage]); - app.get('/user/:id', (req, res) => [MiddleWare.analytics, Controllers.getUser]); + app.get('/user/:id', (req, res) => [MiddleWare.analytics]); app.delete('/user/:id', (req, res) => {}); - app.post('/user', (req, res) => {}); + app.post('/user', [MiddleWare.analytics, Controllers.UserController.newUser]); app.use([MiddleWare.analytics, StatusCodes.pageNotFound]); Logger.info('HTTP endpoints settup'); diff --git a/src/controllers/user.js b/src/controllers/user.js new file mode 100644 index 0000000..ab75381 --- /dev/null +++ b/src/controllers/user.js @@ -0,0 +1,9 @@ +import {Logger} from '../models/logger'; +import {ControllerHandler} from './controllerHandler'; + +export class UserController extends ControllerHandler { + static newUser(req, res, next) { + Logger.info('NEW USER'); + next(); + } +}