mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 10:18:48 +00:00
Removing hard-coded user info.
This commit is contained in:
parent
724adc9b0b
commit
07e9271132
@ -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,13 +146,8 @@ 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);
|
||||||
if (!valid) return res.status(400).json(errors);
|
if (!valid) return res.status(400).json(errors);
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user