From 9c80f4703522ffab34432976f55800f5d6301755 Mon Sep 17 00:00:00 2001 From: briangormanly Date: Tue, 28 Nov 2023 23:52:22 -0500 Subject: [PATCH] let the linter do its thing --- package.json | 2 +- server/controller/apis/friendController.js | 6 +++--- server/controller/apis/userController.js | 4 ++-- server/model/friendshipRequest.js | 4 ++-- server/routes/apiAuthRoutes.js | 2 +- server/routes/apis/friendRoutes.js | 8 ++++---- server/service/friendService.js | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 7d82492c..214a82bf 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ }, "homepage": "https://github.com/briangormanly/agora#readme", "devDependencies": { - "eslint": "^8.25.0", + "eslint": "^8.54.0", "nodemon": "^3.0.1" } } diff --git a/server/controller/apis/friendController.js b/server/controller/apis/friendController.js index d443680c..2cddc531 100644 --- a/server/controller/apis/friendController.js +++ b/server/controller/apis/friendController.js @@ -52,7 +52,7 @@ exports.getResources = async ( req, res ) => { let friends = await friendService.getAllFriends( req.user.userId ); let requests = await friendService.getUnreadFriendRequests( req.user.userId ); let count = await friendService.getUnreadFriendRequestCount( req.user.userId ); - resources.push(req.user, friends, requests, count); + resources.push( req.user, friends, requests, count ); res.set( "x-agora-message-title", "Success" ); res.set( "x-agora-message-detail", "Returned all user details" ); res.status( 200 ).json( resources ); @@ -63,7 +63,7 @@ exports.getResources = async ( req, res ) => { res.set( "x-agora-message-detail", "User details not found" ); res.status( 400 ).json( message ); } -} +}; /* //Get a specific friend, by their ID. @@ -175,7 +175,7 @@ exports.rejectFriendRequest = async ( req, res ) => { //Deletes a friend. exports.deleteFriendByID = async ( req, res ) => { - let success = await friendService.deleteFriendByID( req.body.friendshipId); + let success = await friendService.deleteFriendByID( req.body.friendshipId ); if ( success ) { res.set( "x-agora-message-title", "Success" ); res.set( "x-agora-message-detail", "Removed friend" ); diff --git a/server/controller/apis/userController.js b/server/controller/apis/userController.js index 1111d29b..5b261656 100644 --- a/server/controller/apis/userController.js +++ b/server/controller/apis/userController.js @@ -16,9 +16,9 @@ const ApiMessage = require( '../../model/util/ApiMessage' ); exports.getUserByEmail = async function( req, res ) { - let user = await userService.getUserByEmail( req.params.email ) + let user = await userService.getUserByEmail( req.params.email ); if ( user ) { - console.log(user); + console.log( user ); res.set( "x-agora-message-title", "Success" ); res.set( "x-agora-message-detail", "Returned user by email" ); res.status( 200 ).json( user ); diff --git a/server/model/friendshipRequest.js b/server/model/friendshipRequest.js index b476e411..92b21e2d 100644 --- a/server/model/friendshipRequest.js +++ b/server/model/friendshipRequest.js @@ -11,10 +11,10 @@ exports.emptyFriendshipRequest = () => { return new friendshipRequest(); }; -exports.ormFriendshipRequest = function (row) { +exports.ormFriendshipRequest = function ( row ) { let friendshipRequest = exports.emptyFriendshipRequest(); friendshipRequest.request_id = row.request_id; friendshipRequest.requester_id = row.requester_id; friendshipRequest.recipient_id = row.recipient_id; friendshipRequest.request_time = row.request_time; -} \ No newline at end of file +}; \ No newline at end of file diff --git a/server/routes/apiAuthRoutes.js b/server/routes/apiAuthRoutes.js index 86b252d8..61daebd2 100644 --- a/server/routes/apiAuthRoutes.js +++ b/server/routes/apiAuthRoutes.js @@ -132,7 +132,7 @@ router.use( '/user', userRoutes ); */ const friendRoutes = require( './apis/friendRoutes' ); -router.use( '/friends', friendRoutes); +router.use( '/friends', friendRoutes ); /** * Discussion APIs diff --git a/server/routes/apis/friendRoutes.js b/server/routes/apis/friendRoutes.js index 73e71e28..70b00bc6 100644 --- a/server/routes/apis/friendRoutes.js +++ b/server/routes/apis/friendRoutes.js @@ -37,7 +37,7 @@ router.route( '/sendFriendRequest' ) router.route( '/getResources' ) .get( async ( req, res ) => { friendController.getResources( req, res ); - }) + } ); router.route( '/requestResponse' ) .post( async ( req, res ) => { @@ -51,11 +51,11 @@ router.route( '/getFriend/:userID' ) //get a friend by their user ID. .get( async ( req, res ) => { friendController.getFriendByID( req, res ); - } ) + } ); router.route( '/deleteFriend' ) .delete( async ( req, res ) => { - friendController.deleteFriendByID( req, res ); - } ); + friendController.deleteFriendByID( req, res ); + } ); module.exports = router; \ No newline at end of file diff --git a/server/service/friendService.js b/server/service/friendService.js index e1fb5b4d..8ffc9b75 100644 --- a/server/service/friendService.js +++ b/server/service/friendService.js @@ -52,11 +52,11 @@ exports.getAllFriends = async ( userID ) => { exports.getUnreadFriendRequestCount = async ( userID ) => { let text = `SELECT COUNT(*) FROM friendships WHERE recipient_id = $1 AND friendship_status = $2`; - let values = [ userID, 'pending']; + let values = [ userID, 'pending' ]; try{ let res = await db.query( text, values ); - if ( res.rows.length > 0){ + if ( res.rows.length > 0 ){ return res.rows; } else{