Skip to content

Commit

Permalink
Delete notifications
Browse files Browse the repository at this point in the history
Deleted all files and code that had to do with notifications as that is not needed anymore.
  • Loading branch information
MichaelLaffan1 committed Nov 10, 2023
1 parent 9259257 commit 257637b
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 230 deletions.
7 changes: 1 addition & 6 deletions server/controller/apis/friendController.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const ApiMessage = require( '../../model/util/ApiMessage' );
// import services
const friendService = require( '../../service/friendService' );
const userService = require( '../../service/userService' );
const notificationService = require( '../../service/notificationService' );

//Returns all friends of a user.
exports.getAllFriends = async ( req, res ) => {
Expand Down Expand Up @@ -110,11 +109,7 @@ exports.sendFriendRequest = async ( req, res ) => {
if ( request ) {
res.set( "x-agora-message-title", "Success" );
res.set( "x-agora-message-detail", "Friend Request Sent" );
res.status( 201 ).json( "Success" );

// Add a Notification after a user
const message = "You have received a new friend request from " + req.user.username;
await notificationService.addNotification( friendUsername, message );
res.status( 201 ).json( "Success" );
}
}
else {
Expand Down
55 changes: 0 additions & 55 deletions server/controller/notificationController.js

This file was deleted.

11 changes: 0 additions & 11 deletions server/db/createDatabase.sql
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,6 @@ CREATE TABLE IF NOT EXISTS agora.friendships (

GRANT ALL PRIVILEGES ON TABLE friendships TO agora;

-- Notifications table
CREATE TABLE IF NOT EXISTS agora.notifications (
notification_id SERIAL PRIMARY KEY,
user_id UUID NOT NULL REFERENCES users(user_id),
message TEXT NOT NULL,
notification_time TIMESTAMP DEFAULT current_timestamp,
read_status BOOLEAN DEFAULT FALSE
);

GRANT ALL PRIVILEGES ON TABLE notifications TO agora;

INSERT INTO products (
product_name, product_type, product_description_1, product_description_2, product_purchase_text, stripe_product_id, stripe_price_id, price, product_url, product_static_image, active
)
Expand Down
54 changes: 0 additions & 54 deletions server/model/notification.js

This file was deleted.

6 changes: 0 additions & 6 deletions server/routes/apiAuthRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,6 @@ router.use( '/user', userRoutes );
const friendRoutes = require( './apis/friendRoutes' );
router.use( '/friends', friendRoutes);

/**
* Notification APIs
*/
const notificationRoutes = require ( './apis/notificationRoutes');
router.use( '/notifications', notificationRoutes );

/**
* Discussion APIs
*/
Expand Down
34 changes: 0 additions & 34 deletions server/routes/apis/notificationRoutes.js

This file was deleted.

3 changes: 0 additions & 3 deletions server/service/friendService.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
const db = require( '../db/connection' );

// import models
const notificationService = require( '../service/notificationService' );
const userService = require( '../../server/service/userService' );
const { ormFriendship } = require( '../model/friendship' );

Expand Down Expand Up @@ -79,8 +78,6 @@ exports.sendFriendRequest = async ( requesterID, recipientID ) => {
let res = await db.query( text, values );

if ( res.rows.length > 0 ){
let requesterUsername = await userService.getActiveUserById( requesterID );
await notificationService.addNotification( recipientID, "You have received a friend request from " + requesterUsername.username );
return res.rows[0];
}
else{
Expand Down
61 changes: 0 additions & 61 deletions server/service/notificationService.js

This file was deleted.

0 comments on commit 257637b

Please sign in to comment.