Fixed post ID's not working in WaraWara. Added status endpoint to check server status

This commit is contained in:
Jemma Poffinbarger
2022-09-17 19:52:43 -05:00
parent a33b30af63
commit dae68dfc67
5 changed files with 20 additions and 3 deletions

View File

@@ -3,7 +3,7 @@ const util = require('../util/util');
const xml = require("object-to-xml");
function auth(req, res, next) {
if(req.path.includes('/topics') || req.path.includes('/v1/endpoint'))
if(req.path.includes('/topics') || req.path.includes('/v1/endpoint') || req.path.includes('/v1/status'))
return next();
const token = req.headers["x-nintendo-servicetoken"] || req.headers['olive service token'];
let paramPackData = req.headers["x-nintendo-parampack"];

View File

@@ -31,5 +31,6 @@ api.use('/v1/communities/', routes.COMMUNITY);
api.use('/v1/people/', routes.PEOPLE);
api.use('/v1/topics/', routes.TOPICS);
api.use('/v1/users/', routes.USERS);
api.use('/v1/status/', routes.PING);
module.exports = router;

View File

@@ -5,5 +5,6 @@ module.exports = {
COMMUNITY: require('./communities'),
PEOPLE: require('./people'),
TOPICS: require('./topics'),
USERS: require('./users')
USERS: require('./users'),
PING: require('./ping')
};

View File

@@ -0,0 +1,15 @@
var express = require('express');
var router = express.Router();
const database = require('../../../database');
router.get('/', async function(req, res, next) {
res.send('Pong!');
});
router.get('/database', async function(req, res, next) {
let document = await database.getEndpoints();
if(document)
res.send('DB Connection Working! :D');
});
module.exports = router;

View File

@@ -222,7 +222,7 @@ class CommunityPostGen {
.e("country_id", post.country_id || 0).up()
.e("created_at", moment(post.created_at).format('YYYY-MM-DD HH:MM:SS')).up()
.e("feeling_id", post.feeling_id).up()
.e("id", '').up()
.e("id", post.id).up()
.e("is_autopost", post.is_autopost).up()
.e("is_community_private_autopost", post.is_community_private_autopost).up()
.e("is_spoiler", post.is_spoiler).up()