Removing hard-coded user info.

This commit is contained in:
Clayton Wilson 2019-10-01 17:30:18 -04:00
parent 724adc9b0b
commit 07e9271132
2 changed files with 16 additions and 25 deletions

View File

@ -134,9 +134,6 @@ exports.login = (req, res) => {
}; };
exports.getProfileInfo = (req, res) => { exports.getProfileInfo = (req, res) => {
// FIXME: Delete this after login is implemented
req.user = {};
req.user.handle = 'itsjimmy';
db.collection('users').doc(req.user.handle).get() db.collection('users').doc(req.user.handle).get()
.then((data) => { .then((data) => {
@ -149,12 +146,7 @@ exports.getProfileInfo = (req, res) => {
}; };
exports.updateProfileInfo = (req, res) => { exports.updateProfileInfo = (req, res) => {
// FIXME: Delete this after login is implemented
req.user = {};
req.user.handle = 'itsjimmy';
// TODO: Add functionality for adding/updating profile images // TODO: Add functionality for adding/updating profile images
// Data validation // Data validation
const {valid, errors, profileData} = validateUpdateProfileInfo(req.body); const {valid, errors, profileData} = validateUpdateProfileInfo(req.body);

View File

@ -1,25 +1,22 @@
/* eslint-disable promise/always-return */ /* eslint-disable promise/always-return */
const functions = require('firebase-functions'); const functions = require('firebase-functions');
const app = require('express')(); const app = require('express')();
const fbAuth = require('./util/fbAuth');
const {db} = require('./util/admin');
const cors = require('cors'); const cors = require('cors');
app.use(cors()); app.use(cors());
const fbAuth = require('./util/fbAuth');
const {db} = require('./util/admin');
// const firebase = require('firebase');
// firebase.initializeApp(config);
/*------------------------------------------------------------------* /*------------------------------------------------------------------*
* handlers/users.js * * handlers/users.js *
*------------------------------------------------------------------*/ *------------------------------------------------------------------*/
const {getUserDetails, getProfileInfo, updateProfileInfo, signup, login} = require('./handlers/users'); const {
getUserDetails,
getProfileInfo,
login,
signup,
updateProfileInfo,
} = require('./handlers/users');
app.post('/signup', signup); app.post('/signup', signup);
@ -28,17 +25,19 @@ app.post('/login', login);
app.get('/getUser/:handle', getUserDetails); app.get('/getUser/:handle', getUserDetails);
// Returns all profile data of the currently logged in user // Returns all profile data of the currently logged in user
// TODO: Add fbAuth app.get('/getProfileInfo', fbAuth, getProfileInfo);
app.get('/getProfileInfo', getProfileInfo);
// Updates the currently logged in user's profile information // Updates the currently logged in user's profile information
// TODO: Add fbAuth app.post('/updateProfileInfo', fbAuth, updateProfileInfo);
app.post('/updateProfileInfo', updateProfileInfo);
/*------------------------------------------------------------------* /*------------------------------------------------------------------*
* handlers/post.js * * handlers/post.js *
*------------------------------------------------------------------*/ *------------------------------------------------------------------*/
const {putPost, getallPostsforUser} = require('./handlers/post'); const {
getallPostsforUser,
putPost,
} = require('./handlers/post');
app.get('/getallPostsforUser', getallPostsforUser); app.get('/getallPostsforUser', getallPostsforUser);