<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ssomang</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ssomang"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Ssomang"/>
	<updated>2026-05-13T02:50:14Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159662</id>
		<title>CSC/ECE 517 Fall 2024 - E2483. Reimplement Notification Controller and Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159662"/>
		<updated>2024-11-18T03:11:48Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: /* Design Pattern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Details about the Notification Model and Controller==&lt;br /&gt;
&lt;br /&gt;
The Notification model in Expertiza serves a critical role in enhancing communication and user engagement on the platform. It is essential because it automates the process of alerting users to significant events, such as receiving feedback, team changes, or assignment updates, without requiring users to actively seek out this information. By streamlining these updates, the model reduces the risk of missed information, helping users stay on top of their responsibilities, collaborate more effectively, and respond in a timely manner. This function is particularly valuable in a platform like Expertiza, where users juggle multiple assignments, peer reviews, and team interactions, and would otherwise need to manually monitor changes and updates or rely on external tools for reminders.&lt;br /&gt;
&lt;br /&gt;
The Notification model also improves the overall user experience by organizing and presenting notifications in a way that makes them easy to access and track. It stores notification details (like type, content, and timestamp) and associates them with specific users, ensuring each user receives personalized, relevant updates. Users can view notifications sorted by date or filtered by read/unread status, making it easier to prioritize tasks and responses. Ultimately, the Notification model supports Expertiza’s usability by helping users stay informed and accountable, contributing to an environment that encourages active participation and smooth collaboration across assignments.&lt;br /&gt;
&lt;br /&gt;
==Objective==&lt;br /&gt;
The objective was to create a Notification model in the backend to handle notifications for the Expertiza system. &lt;br /&gt;
&lt;br /&gt;
This model will manage notifications for different courses and be accessible to students and instructors based on their association with a course. &lt;br /&gt;
Notifications can have attributes such as subject, description, expiration date, and status (active/inactive).&lt;br /&gt;
&lt;br /&gt;
The main objective is to create the Notification controller and model to handle sending and receiving notifications on the Expertiza platform.&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* Create a new Notification model with appropriate attributes and relationships:&lt;br /&gt;
* Define associations with User and Course models&lt;br /&gt;
* Implement scopes for filtering notifications based on roles&lt;br /&gt;
* Add validation rules for notification data&lt;br /&gt;
* Include timestamp fields for proper notification tracking&lt;br /&gt;
* Develop a NotificationsController with:&lt;br /&gt;
    * Standard CRUD operations (create, read, update, delete)&lt;br /&gt;
    * Role-based access control logic&lt;br /&gt;
    * Course enrollment verification&lt;br /&gt;
    * Proper error handling and response formatting&lt;br /&gt;
    * RESTful API endpoints&lt;br /&gt;
    * Implement authorization logic: Add policies to ensure students only see relevant notifications&lt;br /&gt;
* Write comprehensive test cases:&lt;br /&gt;
    * Unit tests for the Notification model&lt;br /&gt;
    * Controller tests covering all CRUD operations&lt;br /&gt;
    * Integration tests for role-based access&lt;br /&gt;
    * Test cases for error scenarios and edge cases&lt;br /&gt;
&lt;br /&gt;
==Design Goals==&lt;br /&gt;
&amp;lt;b&amp;gt;Implement the Notification backend:&amp;lt;/b&amp;gt; Implement the Notification in Ruby on Rails.&lt;br /&gt;
&lt;br /&gt;
1. Model Creation:&lt;br /&gt;
&lt;br /&gt;
Create a Notification model with the following key attributes:&lt;br /&gt;
* id: Primary key (auto-generated).&lt;br /&gt;
* subject: Brief title of the notification.&lt;br /&gt;
* description: Detailed message of the notification.&lt;br /&gt;
* expiration_date: The date when the notification should expire.&lt;br /&gt;
* is_active: Boolean flag to mark if the notification is active or inactive.&lt;br /&gt;
* is_unread: Boolean to mark if a notification is unread (default to true for new notifications).&lt;br /&gt;
&lt;br /&gt;
2. Associations:&lt;br /&gt;
&lt;br /&gt;
* Define associations between Notification, User, and Course models.&lt;br /&gt;
* User Association: Each notification should have a creator (e.g., a teaching assistant or instructor).&lt;br /&gt;
* Course Association: Each notification should be linked to a course, and the enrolled students should be able to view relevant notifications.&lt;br /&gt;
&lt;br /&gt;
3. Relationships:&lt;br /&gt;
&lt;br /&gt;
* One-to-Many: Course to Notification, as each course can have multiple notifications.&lt;br /&gt;
* One-to-Many: User (creator) to Notification, as a user can create multiple notifications.&lt;br /&gt;
* Many-to-Many (indirect): User to Notification via course enrollment, as multiple students can view a notification if they are enrolled in the course associated with the notification.&lt;br /&gt;
&lt;br /&gt;
==Schema==&lt;br /&gt;
[[File:Schema2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
===Associations===&lt;br /&gt;
&lt;br /&gt;
'''Notification'''&lt;br /&gt;
&lt;br /&gt;
* belongs_to :user - Links the notification to its creator (TA, instructor).&lt;br /&gt;
&lt;br /&gt;
* belongs_to :course - Links the notification to a course.&lt;br /&gt;
&lt;br /&gt;
'''User'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Users (instructors, TAs) can create multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :viewable_notifications, through: :courses - Students can view notifications for courses they are enrolled in.&lt;br /&gt;
&lt;br /&gt;
'''Course'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Each course can have multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :students, through: :enrollments - Defines which students are associated with the course.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
[[File:UML notification2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
''' Relationship Explanation''' &lt;br /&gt;
&lt;br /&gt;
* User to Notification: A User (e.g., TA, instructor) can create multiple notifications.&lt;br /&gt;
* Course to Notification: Each Course can have multiple notifications associated with it.&lt;br /&gt;
* User (Student) to Notification (Viewer): Through Course enrollment, students can access notifications related to their courses.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&amp;lt;b&amp;gt;NotificationController Implementation&amp;lt;/b&amp;gt;: Following are the controller methods:&lt;br /&gt;
&lt;br /&gt;
1. create:&lt;br /&gt;
&lt;br /&gt;
* Description: This method is responsible for creating a new notification. It validates the incoming data to ensure that all required fields are present and correctly formatted. Only authorized users (instructors or TAs) can create notifications. Upon successful creation, the method associates the notification with the specified course and user (creator).&lt;br /&gt;
* API Endpoint: POST /notifications&lt;br /&gt;
* Parameters:&lt;br /&gt;
** subject (required): The title of the notification that briefly describes its purpose (limited to 255 characters).&lt;br /&gt;
** description (optional): Detailed content of the notification.&lt;br /&gt;
** expiration_date (optional): The date until which the notification remains valid. Defaults to no expiration.&lt;br /&gt;
** is_active (optional): A boolean flag indicating if the notification is active (default is true).&lt;br /&gt;
** course_id (required): The course associated with the notification.&lt;br /&gt;
* Authorization: Ensures that only users with roles of TA or instructor can create a notification.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the newly created notification with a 201 status.&lt;br /&gt;
** Error: Returns validation errors (e.g., missing fields, invalid data) with a 422 status.&lt;br /&gt;
&lt;br /&gt;
2. index:&lt;br /&gt;
&lt;br /&gt;
* Description: The index method retrieves a list of notifications based on specific filters, such as active status, unread status, or course association. This endpoint ensures that students only see notifications related to the courses they are enrolled in. It supports querying with multiple optional parameters for flexibility.&lt;br /&gt;
* API Endpoint: GET /notifications&lt;br /&gt;
* Parameters: Query parameters (optional):&lt;br /&gt;
** is_active: Filter notifications by their active status.&lt;br /&gt;
** is_unread: Retrieve only unread notifications for the current user.&lt;br /&gt;
** course_id: Fetch notifications specific to a course.&lt;br /&gt;
* Authorization: Students can only access notifications for courses they are enrolled in. Instructors and TAs can view all notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns an array of filtered notifications with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
3. show:&lt;br /&gt;
&lt;br /&gt;
* Description: This method retrieves the details of a specific notification identified by its unique ID. It ensures that the current user is authorized to view the notification (e.g., enrolled in the course or the creator of the notification).&lt;br /&gt;
* API Endpoint: GET /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be retrieved.&lt;br /&gt;
* Authorization: Students can view notifications for courses they are enrolled in. Instructors and TAs can view notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the notification details with a 200 status.&lt;br /&gt;
** Error: Returns a 404 status if the notification is not found or the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
4. update:&lt;br /&gt;
&lt;br /&gt;
* Description: This method allows the creator of a notification (TA or instructor) to update its details. It validates the incoming data and ensures that the user is authorized to make changes.&lt;br /&gt;
* API Endpoint: PUT /notifications/:id&lt;br /&gt;
* Parameters: Fields that can be updated include subject, description, expiration_date, and is_active.&lt;br /&gt;
* Authorization: Only the creator of the notification can update it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if the user does not have the required permissions.&lt;br /&gt;
&lt;br /&gt;
5. destroy:&lt;br /&gt;
&lt;br /&gt;
* Description: This method deletes a specific notification. Only the user who created the notification can perform this action. The method ensures that no unauthorized users can delete notifications.&lt;br /&gt;
* API Endpoint: DELETE /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be deleted.&lt;br /&gt;
* Authorization: Only the creator of the notification can delete it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns a 204 status with no content upon successful deletion.&lt;br /&gt;
** Error: Returns a 403 status if the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
6. toggle_notification_visibility:&lt;br /&gt;
&lt;br /&gt;
* Description: This method toggles the is_active status of a notification. For example, a TA or instructor can deactivate a notification that is no longer relevant. The method ensures that only the creator of the notification can perform this action.&lt;br /&gt;
* API Endpoint: PATCH /notifications/:id/toggle&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be toggled.&lt;br /&gt;
* Authorization: Only the creator of the notification can toggle its visibility.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification status with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Model Implementation&amp;lt;/b&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
1. Notification model:&lt;br /&gt;
&lt;br /&gt;
* Description: The Notification model represents a single notification. It includes all attributes, validations, and associations necessary for managing notifications.&lt;br /&gt;
* Attributes:&lt;br /&gt;
** subject: The title of the notification (required, max length: 255).&lt;br /&gt;
** description: The detailed content of the notification.&lt;br /&gt;
** expiration_date: The date when the notification should expire (validated to be in the future).&lt;br /&gt;
** is_active: Indicates whether the notification is active (default: true).&lt;br /&gt;
** is_unread: Marks if a notification is unread (default: true).&lt;br /&gt;
** course_id: Links the notification to a course.&lt;br /&gt;
** user_id: Links the notification to its creator.&lt;br /&gt;
* Associations:&lt;br /&gt;
** belongs_to :course&lt;br /&gt;
** belongs_to :user&lt;br /&gt;
* Validations:&lt;br /&gt;
** Ensures the presence of subject, course_id, and user_id.&lt;br /&gt;
** Validates expiration_date to ensure it is not in the past.&lt;br /&gt;
* Scopes:&lt;br /&gt;
** active: Filters notifications that are active.&lt;br /&gt;
** unread: Filters unread notifications for a user.&lt;br /&gt;
&lt;br /&gt;
2. User Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications (creator role).&lt;br /&gt;
** has_many :viewable_notifications, through: :courses (student role).&lt;br /&gt;
&lt;br /&gt;
3. Course Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications.&lt;br /&gt;
** has_many :students, through: :enrollments.&lt;br /&gt;
&lt;br /&gt;
== Endpoints for Notification Management ==&lt;br /&gt;
&lt;br /&gt;
Endpoints for Creating, Reading, Updating, and Deleting (CRUD) Notifications&lt;br /&gt;
&lt;br /&gt;
1. POST /notifications - Create a new notification. The create method in the NotificationController implementation aligns with this endpoint, allowing authorized users to create notifications for specific courses.&lt;br /&gt;
&lt;br /&gt;
2. GET /notifications - Get a list of notifications (with optional filters, such as is_active or is_unread). The index method aligns with this endpoint, allowing filtered retrieval of notifications.&lt;br /&gt;
&lt;br /&gt;
3. GET /notifications/:id - View details of a specific notification. The show method aligns with this endpoint, retrieving specific notification details.&lt;br /&gt;
&lt;br /&gt;
4. PUT /notifications/:id - Update a specific notification. The update method allows modification of existing notifications, respecting role-based access.&lt;br /&gt;
&lt;br /&gt;
5. DELETE /notifications/:id - Delete a specific notification. The destroy method aligns with this endpoint, enabling notification deletion by authorized users.&lt;br /&gt;
&lt;br /&gt;
6. PATCH /notifications/:id/toggle - Toggle active state of a notification. The toggle_notification_visibility method handles this functionality, toggling the is_active flag.&lt;br /&gt;
&lt;br /&gt;
=Design Pattern=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;1. Strategy Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Dynamically applying different filtering criteria for notifications (e.g., active notifications, unread notifications, notifications for a specific course).&lt;br /&gt;
** This modularizes the filtering logic, making it easier to extend or change in the future.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Strategy Pattern separates filtering logic into individual strategy classes, making it easy to add new filters without modifying existing code.&lt;br /&gt;
** It also enhances the maintainability and testability of the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;2. Decorator Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Dynamically modifying the presentation of notifications based on user roles or other conditions.&lt;br /&gt;
** For example, students might see a simplified view of notifications, while instructors see a detailed view.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Decorator Pattern adds additional functionality (like role-based formatting) without modifying the original Notification model.&lt;br /&gt;
** It keeps the model clean and focused on core functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;3. Singleton Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Managing a global notification scheduler or manager, ensuring that only one instance exists.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Singleton Pattern ensures that there is only one centralized manager for handling notification-related tasks, such as scheduling or batch operations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;4. Chain of Responsibility Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Modularizing the validation logic for notifications (e.g., checking permissions, validating expiration dates, ensuring uniqueness).&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Chain of Responsibility Pattern allows you to break down validation or processing logic into discrete steps, improving code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Following are the some of the SOLID principles with how they will be applied to the back-end development:&amp;lt;/b&amp;gt;&lt;br /&gt;
* Single Responsibility : Controllers handle HTTP requests, models handle data, and service objects handle business logic (e.g., sending notifications).&lt;br /&gt;
* Open/Closed : Extend functionality (e.g., new notification types or filters) by adding new classes or methods without modifying existing code.&lt;br /&gt;
* Interface Segregation : Create small, role-specific interfaces (e.g., policies for TAs, students, instructors) and separate service objects for different types of notifications.&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
1. Model Tests:&lt;br /&gt;
&lt;br /&gt;
* Validate presence and format of subject and description.&lt;br /&gt;
* Test is_active and is_unread default values.&lt;br /&gt;
&lt;br /&gt;
2. Controller Tests:&lt;br /&gt;
&lt;br /&gt;
* Ensure proper creation, update, and deletion of notifications.&lt;br /&gt;
* Test that only authorized users can manage notifications.&lt;br /&gt;
&lt;br /&gt;
3. Integration Tests:&lt;br /&gt;
&lt;br /&gt;
* Test access control to verify that only eligible users can view or manage notifications based on role and course association.&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
* '''Aditi Killedar''' akilled@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' [https://github.com/SoubarnicaSuresh/reimplementation-back-end reimplementation back-end]&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159379</id>
		<title>CSC/ECE 517 Fall 2024 - E2483. Reimplement Notification Controller and Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159379"/>
		<updated>2024-11-13T02:37:52Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Objective==&lt;br /&gt;
To create a Notification model in the backend to handle notifications for the Expertiza system. This model will manage notifications for different courses and be accessible to students and instructors based on their association with a course. Notifications can have attributes such as subject, description, expiration date, and status (active/inactive).&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* Create a new Notification model with appropriate attributes and relationships:&lt;br /&gt;
* Define associations with User and Course models&lt;br /&gt;
* Implement scopes for filtering notifications based on roles&lt;br /&gt;
* Add validation rules for notification data&lt;br /&gt;
* Include timestamp fields for proper notification tracking&lt;br /&gt;
* Develop a NotificationsController with:&lt;br /&gt;
    * Standard CRUD operations (create, read, update, delete)&lt;br /&gt;
    * Role-based access control logic&lt;br /&gt;
    * Course enrollment verification&lt;br /&gt;
    * Proper error handling and response formatting&lt;br /&gt;
    * RESTful API endpoints&lt;br /&gt;
    * Implement authorization logic: Add policies to ensure students only see relevant notifications&lt;br /&gt;
* Write comprehensive test cases:&lt;br /&gt;
    * Unit tests for the Notification model&lt;br /&gt;
    * Controller tests covering all CRUD operations&lt;br /&gt;
    * Integration tests for role-based access&lt;br /&gt;
    * Test cases for error scenarios and edge cases&lt;br /&gt;
&lt;br /&gt;
==Design Goals==&lt;br /&gt;
&amp;lt;b&amp;gt;Implement the Notification backend:&amp;lt;/b&amp;gt; Implement the Notification in Ruby on Rails.&lt;br /&gt;
&lt;br /&gt;
1. Model Creation:&lt;br /&gt;
&lt;br /&gt;
Create a Notification model with the following key attributes:&lt;br /&gt;
* id: Primary key (auto-generated).&lt;br /&gt;
* subject: Brief title of the notification.&lt;br /&gt;
* description: Detailed message of the notification.&lt;br /&gt;
* expiration_date: The date when the notification should expire.&lt;br /&gt;
* is_active: Boolean flag to mark if the notification is active or inactive.&lt;br /&gt;
* is_unread: Boolean to mark if a notification is unread (default to true for new notifications).&lt;br /&gt;
&lt;br /&gt;
2. Associations:&lt;br /&gt;
&lt;br /&gt;
* Define associations between Notification, User, and Course models.&lt;br /&gt;
* User Association: Each notification should have a creator (e.g., a teaching assistant or instructor).&lt;br /&gt;
* Course Association: Each notification should be linked to a course, and the enrolled students should be able to view relevant notifications.&lt;br /&gt;
&lt;br /&gt;
3. Relationships:&lt;br /&gt;
&lt;br /&gt;
* One-to-Many: Course to Notification, as each course can have multiple notifications.&lt;br /&gt;
* One-to-Many: User (creator) to Notification, as a user can create multiple notifications.&lt;br /&gt;
* Many-to-Many (indirect): User to Notification via course enrollment, as multiple students can view a notification if they are enrolled in the course associated with the notification.&lt;br /&gt;
&lt;br /&gt;
==Schema==&lt;br /&gt;
[[File:Schema2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
===Associations===&lt;br /&gt;
&lt;br /&gt;
'''Notification'''&lt;br /&gt;
&lt;br /&gt;
* belongs_to :user - Links the notification to its creator (TA, instructor).&lt;br /&gt;
&lt;br /&gt;
* belongs_to :course - Links the notification to a course.&lt;br /&gt;
&lt;br /&gt;
'''User'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Users (instructors, TAs) can create multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :viewable_notifications, through: :courses - Students can view notifications for courses they are enrolled in.&lt;br /&gt;
&lt;br /&gt;
'''Course'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Each course can have multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :students, through: :enrollments - Defines which students are associated with the course.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
[[File:UML notification2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
''' Relationship Explanation''' &lt;br /&gt;
&lt;br /&gt;
* User to Notification: A User (e.g., TA, instructor) can create multiple notifications.&lt;br /&gt;
* Course to Notification: Each Course can have multiple notifications associated with it.&lt;br /&gt;
* User (Student) to Notification (Viewer): Through Course enrollment, students can access notifications related to their courses.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&amp;lt;b&amp;gt;NotificationController Implementation&amp;lt;/b&amp;gt;: Following are the controller methods:&lt;br /&gt;
&lt;br /&gt;
1. create:&lt;br /&gt;
&lt;br /&gt;
* Description: This method is responsible for creating a new notification. It validates the incoming data to ensure that all required fields are present and correctly formatted. Only authorized users (instructors or TAs) can create notifications. Upon successful creation, the method associates the notification with the specified course and user (creator).&lt;br /&gt;
* API Endpoint: POST /notifications&lt;br /&gt;
* Parameters:&lt;br /&gt;
** subject (required): The title of the notification that briefly describes its purpose (limited to 255 characters).&lt;br /&gt;
** description (optional): Detailed content of the notification.&lt;br /&gt;
** expiration_date (optional): The date until which the notification remains valid. Defaults to no expiration.&lt;br /&gt;
** is_active (optional): A boolean flag indicating if the notification is active (default is true).&lt;br /&gt;
** course_id (required): The course associated with the notification.&lt;br /&gt;
* Authorization: Ensures that only users with roles of TA or instructor can create a notification.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the newly created notification with a 201 status.&lt;br /&gt;
** Error: Returns validation errors (e.g., missing fields, invalid data) with a 422 status.&lt;br /&gt;
&lt;br /&gt;
2. index:&lt;br /&gt;
&lt;br /&gt;
* Description: The index method retrieves a list of notifications based on specific filters, such as active status, unread status, or course association. This endpoint ensures that students only see notifications related to the courses they are enrolled in. It supports querying with multiple optional parameters for flexibility.&lt;br /&gt;
* API Endpoint: GET /notifications&lt;br /&gt;
* Parameters: Query parameters (optional):&lt;br /&gt;
** is_active: Filter notifications by their active status.&lt;br /&gt;
** is_unread: Retrieve only unread notifications for the current user.&lt;br /&gt;
** course_id: Fetch notifications specific to a course.&lt;br /&gt;
* Authorization: Students can only access notifications for courses they are enrolled in. Instructors and TAs can view all notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns an array of filtered notifications with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
3. show:&lt;br /&gt;
&lt;br /&gt;
* Description: This method retrieves the details of a specific notification identified by its unique ID. It ensures that the current user is authorized to view the notification (e.g., enrolled in the course or the creator of the notification).&lt;br /&gt;
* API Endpoint: GET /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be retrieved.&lt;br /&gt;
* Authorization: Students can view notifications for courses they are enrolled in. Instructors and TAs can view notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the notification details with a 200 status.&lt;br /&gt;
** Error: Returns a 404 status if the notification is not found or the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
4. update:&lt;br /&gt;
&lt;br /&gt;
* Description: This method allows the creator of a notification (TA or instructor) to update its details. It validates the incoming data and ensures that the user is authorized to make changes.&lt;br /&gt;
* API Endpoint: PUT /notifications/:id&lt;br /&gt;
* Parameters: Fields that can be updated include subject, description, expiration_date, and is_active.&lt;br /&gt;
* Authorization: Only the creator of the notification can update it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if the user does not have the required permissions.&lt;br /&gt;
&lt;br /&gt;
5. destroy:&lt;br /&gt;
&lt;br /&gt;
* Description: This method deletes a specific notification. Only the user who created the notification can perform this action. The method ensures that no unauthorized users can delete notifications.&lt;br /&gt;
* API Endpoint: DELETE /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be deleted.&lt;br /&gt;
* Authorization: Only the creator of the notification can delete it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns a 204 status with no content upon successful deletion.&lt;br /&gt;
** Error: Returns a 403 status if the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
6. toggle_notification_visibility:&lt;br /&gt;
&lt;br /&gt;
* Description: This method toggles the is_active status of a notification. For example, a TA or instructor can deactivate a notification that is no longer relevant. The method ensures that only the creator of the notification can perform this action.&lt;br /&gt;
* API Endpoint: PATCH /notifications/:id/toggle&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be toggled.&lt;br /&gt;
* Authorization: Only the creator of the notification can toggle its visibility.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification status with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Model Implementation&amp;lt;/b&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
1. Notification model:&lt;br /&gt;
&lt;br /&gt;
* Description: The Notification model represents a single notification. It includes all attributes, validations, and associations necessary for managing notifications.&lt;br /&gt;
* Attributes:&lt;br /&gt;
** subject: The title of the notification (required, max length: 255).&lt;br /&gt;
** description: The detailed content of the notification.&lt;br /&gt;
** expiration_date: The date when the notification should expire (validated to be in the future).&lt;br /&gt;
** is_active: Indicates whether the notification is active (default: true).&lt;br /&gt;
** is_unread: Marks if a notification is unread (default: true).&lt;br /&gt;
** course_id: Links the notification to a course.&lt;br /&gt;
** user_id: Links the notification to its creator.&lt;br /&gt;
* Associations:&lt;br /&gt;
** belongs_to :course&lt;br /&gt;
** belongs_to :user&lt;br /&gt;
* Validations:&lt;br /&gt;
** Ensures the presence of subject, course_id, and user_id.&lt;br /&gt;
** Validates expiration_date to ensure it is not in the past.&lt;br /&gt;
* Scopes:&lt;br /&gt;
** active: Filters notifications that are active.&lt;br /&gt;
** unread: Filters unread notifications for a user.&lt;br /&gt;
&lt;br /&gt;
2. User Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications (creator role).&lt;br /&gt;
** has_many :viewable_notifications, through: :courses (student role).&lt;br /&gt;
&lt;br /&gt;
3. Course Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications.&lt;br /&gt;
** has_many :students, through: :enrollments.&lt;br /&gt;
&lt;br /&gt;
== Endpoints for Notification Management ==&lt;br /&gt;
&lt;br /&gt;
Endpoints for Creating, Reading, Updating, and Deleting (CRUD) Notifications&lt;br /&gt;
&lt;br /&gt;
1. POST /notifications - Create a new notification. The create method in the NotificationController implementation aligns with this endpoint, allowing authorized users to create notifications for specific courses.&lt;br /&gt;
&lt;br /&gt;
2. GET /notifications - Get a list of notifications (with optional filters, such as is_active or is_unread). The index method aligns with this endpoint, allowing filtered retrieval of notifications.&lt;br /&gt;
&lt;br /&gt;
3. GET /notifications/:id - View details of a specific notification. The show method aligns with this endpoint, retrieving specific notification details.&lt;br /&gt;
&lt;br /&gt;
4. PUT /notifications/:id - Update a specific notification. The update method allows modification of existing notifications, respecting role-based access.&lt;br /&gt;
&lt;br /&gt;
5. DELETE /notifications/:id - Delete a specific notification. The destroy method aligns with this endpoint, enabling notification deletion by authorized users.&lt;br /&gt;
&lt;br /&gt;
6. PATCH /notifications/:id/toggle - Toggle active state of a notification. The toggle_notification_visibility method handles this functionality, toggling the is_active flag.&lt;br /&gt;
&lt;br /&gt;
=Design Pattern=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;1. Observer Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Automatically notify users (e.g., students enrolled in a course) whenever a new notification is created or updated.&lt;br /&gt;
** This ensures users are always informed about important updates without requiring manual intervention.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Notification model acts as the subject, and the students (or their respective notification systems) are observers.&lt;br /&gt;
** When a notification is created or updated, all observers are automatically notified through an after_commit callback.&lt;br /&gt;
** This pattern decouples the logic for creating notifications from the logic for notifying users, making the system easier to maintain and extend.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;2. Factory Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Creating different types of notifications (e.g., course notifications, system notifications, global announcements) with varying attributes or behaviors.&lt;br /&gt;
** This centralizes the creation logic and ensures consistency in object instantiation.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The factory centralizes the creation logic, making it easy to add new notification types in the future.&lt;br /&gt;
** It also reduces clutter in the controller by abstracting the instantiation process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;3. Strategy Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Dynamically applying different filtering criteria for notifications (e.g., active notifications, unread notifications, notifications for a specific course).&lt;br /&gt;
** This modularizes the filtering logic, making it easier to extend or change in the future.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Strategy Pattern separates filtering logic into individual strategy classes, making it easy to add new filters without modifying existing code.&lt;br /&gt;
** It also enhances the maintainability and testability of the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;4. Decorator Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Dynamically modifying the presentation of notifications based on user roles or other conditions.&lt;br /&gt;
** For example, students might see a simplified view of notifications, while instructors see a detailed view.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Decorator Pattern adds additional functionality (like role-based formatting) without modifying the original Notification model.&lt;br /&gt;
** It keeps the model clean and focused on core functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;5. Command Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Encapsulating the logic for sending notifications (e.g., emails, in-app alerts) into discrete, reusable objects.&lt;br /&gt;
** Useful for task queuing or asynchronous operations.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Command Pattern encapsulates the logic for sending notifications, making it easier to queue or log these operations.&lt;br /&gt;
** It improves code reusability and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;6. Template Method Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Defining a common process for creating notifications while allowing specific steps to be overridden for different types of notifications (e.g., course notifications vs. global announcements).&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Template Method Pattern enforces a consistent process for creating notifications while allowing flexibility for specific steps.&lt;br /&gt;
** This ensures uniformity across different notification types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;7. Singleton Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Managing a global notification scheduler or manager, ensuring that only one instance exists.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Singleton Pattern ensures that there is only one centralized manager for handling notification-related tasks, such as scheduling or batch operations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;8. Chain of Responsibility Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Modularizing the validation logic for notifications (e.g., checking permissions, validating expiration dates, ensuring uniqueness).&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Chain of Responsibility Pattern allows you to break down validation or processing logic into discrete steps, improving code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
1. Model Tests:&lt;br /&gt;
&lt;br /&gt;
* Validate presence and format of subject and description.&lt;br /&gt;
* Test is_active and is_unread default values.&lt;br /&gt;
&lt;br /&gt;
2. Controller Tests:&lt;br /&gt;
&lt;br /&gt;
* Ensure proper creation, update, and deletion of notifications.&lt;br /&gt;
* Test that only authorized users can manage notifications.&lt;br /&gt;
&lt;br /&gt;
3. Integration Tests:&lt;br /&gt;
&lt;br /&gt;
* Test access control to verify that only eligible users can view or manage notifications based on role and course association.&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
* '''Aditi Killedar''' akilled@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' [https://github.com/SoubarnicaSuresh/reimplementation-back-end reimplementation back-end]&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159378</id>
		<title>CSC/ECE 517 Fall 2024 - E2483. Reimplement Notification Controller and Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159378"/>
		<updated>2024-11-13T02:36:48Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Objective==&lt;br /&gt;
To create a Notification model in the backend to handle notifications for the Expertiza system. This model will manage notifications for different courses and be accessible to students and instructors based on their association with a course. Notifications can have attributes such as subject, description, expiration date, and status (active/inactive).&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* Create a new Notification model with appropriate attributes and relationships:&lt;br /&gt;
* Define associations with User and Course models&lt;br /&gt;
* Implement scopes for filtering notifications based on roles&lt;br /&gt;
* Add validation rules for notification data&lt;br /&gt;
* Include timestamp fields for proper notification tracking&lt;br /&gt;
* Develop a NotificationsController with:&lt;br /&gt;
    * Standard CRUD operations (create, read, update, delete)&lt;br /&gt;
    * Role-based access control logic&lt;br /&gt;
    * Course enrollment verification&lt;br /&gt;
    * Proper error handling and response formatting&lt;br /&gt;
    * RESTful API endpoints&lt;br /&gt;
    * Implement authorization logic: Add policies to ensure students only see relevant notifications&lt;br /&gt;
* Write comprehensive test cases:&lt;br /&gt;
    * Unit tests for the Notification model&lt;br /&gt;
    * Controller tests covering all CRUD operations&lt;br /&gt;
    * Integration tests for role-based access&lt;br /&gt;
    * Test cases for error scenarios and edge cases&lt;br /&gt;
&lt;br /&gt;
==Design Goals==&lt;br /&gt;
&amp;lt;b&amp;gt;Implement the Notification backend:&amp;lt;/b&amp;gt; Implement the Notification in Ruby on Rails.&lt;br /&gt;
&lt;br /&gt;
1. Model Creation:&lt;br /&gt;
&lt;br /&gt;
Create a Notification model with the following key attributes:&lt;br /&gt;
* id: Primary key (auto-generated).&lt;br /&gt;
* subject: Brief title of the notification.&lt;br /&gt;
* description: Detailed message of the notification.&lt;br /&gt;
* expiration_date: The date when the notification should expire.&lt;br /&gt;
* is_active: Boolean flag to mark if the notification is active or inactive.&lt;br /&gt;
* is_unread: Boolean to mark if a notification is unread (default to true for new notifications).&lt;br /&gt;
&lt;br /&gt;
2. Associations:&lt;br /&gt;
&lt;br /&gt;
* Define associations between Notification, User, and Course models.&lt;br /&gt;
* User Association: Each notification should have a creator (e.g., a teaching assistant or instructor).&lt;br /&gt;
* Course Association: Each notification should be linked to a course, and the enrolled students should be able to view relevant notifications.&lt;br /&gt;
&lt;br /&gt;
3. Relationships:&lt;br /&gt;
&lt;br /&gt;
* One-to-Many: Course to Notification, as each course can have multiple notifications.&lt;br /&gt;
* One-to-Many: User (creator) to Notification, as a user can create multiple notifications.&lt;br /&gt;
* Many-to-Many (indirect): User to Notification via course enrollment, as multiple students can view a notification if they are enrolled in the course associated with the notification.&lt;br /&gt;
&lt;br /&gt;
==Schema==&lt;br /&gt;
[[File:Schema2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
===Associations===&lt;br /&gt;
&lt;br /&gt;
'''Notification'''&lt;br /&gt;
&lt;br /&gt;
* belongs_to :user - Links the notification to its creator (TA, instructor).&lt;br /&gt;
&lt;br /&gt;
* belongs_to :course - Links the notification to a course.&lt;br /&gt;
&lt;br /&gt;
'''User'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Users (instructors, TAs) can create multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :viewable_notifications, through: :courses - Students can view notifications for courses they are enrolled in.&lt;br /&gt;
&lt;br /&gt;
'''Course'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Each course can have multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :students, through: :enrollments - Defines which students are associated with the course.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
[[File:UML notification2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
''' Relationship Explanation''' &lt;br /&gt;
&lt;br /&gt;
* User to Notification: A User (e.g., TA, instructor) can create multiple notifications.&lt;br /&gt;
* Course to Notification: Each Course can have multiple notifications associated with it.&lt;br /&gt;
* User (Student) to Notification (Viewer): Through Course enrollment, students can access notifications related to their courses.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&amp;lt;b&amp;gt;NotificationController Implementation&amp;lt;/b&amp;gt;: Following are the controller methods:&lt;br /&gt;
&lt;br /&gt;
1. create:&lt;br /&gt;
&lt;br /&gt;
* Description: This method is responsible for creating a new notification. It validates the incoming data to ensure that all required fields are present and correctly formatted. Only authorized users (instructors or TAs) can create notifications. Upon successful creation, the method associates the notification with the specified course and user (creator).&lt;br /&gt;
* API Endpoint: POST /notifications&lt;br /&gt;
* Parameters:&lt;br /&gt;
** subject (required): The title of the notification that briefly describes its purpose (limited to 255 characters).&lt;br /&gt;
** description (optional): Detailed content of the notification.&lt;br /&gt;
** expiration_date (optional): The date until which the notification remains valid. Defaults to no expiration.&lt;br /&gt;
** is_active (optional): A boolean flag indicating if the notification is active (default is true).&lt;br /&gt;
** course_id (required): The course associated with the notification.&lt;br /&gt;
* Authorization: Ensures that only users with roles of TA or instructor can create a notification.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the newly created notification with a 201 status.&lt;br /&gt;
** Error: Returns validation errors (e.g., missing fields, invalid data) with a 422 status.&lt;br /&gt;
&lt;br /&gt;
2. index:&lt;br /&gt;
&lt;br /&gt;
* Description: The index method retrieves a list of notifications based on specific filters, such as active status, unread status, or course association. This endpoint ensures that students only see notifications related to the courses they are enrolled in. It supports querying with multiple optional parameters for flexibility.&lt;br /&gt;
* API Endpoint: GET /notifications&lt;br /&gt;
* Parameters: Query parameters (optional):&lt;br /&gt;
** is_active: Filter notifications by their active status.&lt;br /&gt;
** is_unread: Retrieve only unread notifications for the current user.&lt;br /&gt;
** course_id: Fetch notifications specific to a course.&lt;br /&gt;
* Authorization: Students can only access notifications for courses they are enrolled in. Instructors and TAs can view all notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns an array of filtered notifications with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
3. show:&lt;br /&gt;
&lt;br /&gt;
* Description: This method retrieves the details of a specific notification identified by its unique ID. It ensures that the current user is authorized to view the notification (e.g., enrolled in the course or the creator of the notification).&lt;br /&gt;
* API Endpoint: GET /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be retrieved.&lt;br /&gt;
* Authorization: Students can view notifications for courses they are enrolled in. Instructors and TAs can view notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the notification details with a 200 status.&lt;br /&gt;
** Error: Returns a 404 status if the notification is not found or the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
4. update:&lt;br /&gt;
&lt;br /&gt;
* Description: This method allows the creator of a notification (TA or instructor) to update its details. It validates the incoming data and ensures that the user is authorized to make changes.&lt;br /&gt;
* API Endpoint: PUT /notifications/:id&lt;br /&gt;
* Parameters: Fields that can be updated include subject, description, expiration_date, and is_active.&lt;br /&gt;
* Authorization: Only the creator of the notification can update it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if the user does not have the required permissions.&lt;br /&gt;
&lt;br /&gt;
5. destroy:&lt;br /&gt;
&lt;br /&gt;
* Description: This method deletes a specific notification. Only the user who created the notification can perform this action. The method ensures that no unauthorized users can delete notifications.&lt;br /&gt;
* API Endpoint: DELETE /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be deleted.&lt;br /&gt;
* Authorization: Only the creator of the notification can delete it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns a 204 status with no content upon successful deletion.&lt;br /&gt;
** Error: Returns a 403 status if the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
6. toggle_notification_visibility:&lt;br /&gt;
&lt;br /&gt;
* Description: This method toggles the is_active status of a notification. For example, a TA or instructor can deactivate a notification that is no longer relevant. The method ensures that only the creator of the notification can perform this action.&lt;br /&gt;
* API Endpoint: PATCH /notifications/:id/toggle&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be toggled.&lt;br /&gt;
* Authorization: Only the creator of the notification can toggle its visibility.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification status with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Model Implementation&amp;lt;/b&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
1. Notification model:&lt;br /&gt;
&lt;br /&gt;
* Description: The Notification model represents a single notification. It includes all attributes, validations, and associations necessary for managing notifications.&lt;br /&gt;
* Attributes:&lt;br /&gt;
** subject: The title of the notification (required, max length: 255).&lt;br /&gt;
** description: The detailed content of the notification.&lt;br /&gt;
** expiration_date: The date when the notification should expire (validated to be in the future).&lt;br /&gt;
** is_active: Indicates whether the notification is active (default: true).&lt;br /&gt;
** is_unread: Marks if a notification is unread (default: true).&lt;br /&gt;
** course_id: Links the notification to a course.&lt;br /&gt;
** user_id: Links the notification to its creator.&lt;br /&gt;
* Associations:&lt;br /&gt;
** belongs_to :course&lt;br /&gt;
** belongs_to :user&lt;br /&gt;
* Validations:&lt;br /&gt;
** Ensures the presence of subject, course_id, and user_id.&lt;br /&gt;
** Validates expiration_date to ensure it is not in the past.&lt;br /&gt;
* Scopes:&lt;br /&gt;
** active: Filters notifications that are active.&lt;br /&gt;
** unread: Filters unread notifications for a user.&lt;br /&gt;
&lt;br /&gt;
2. User Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications (creator role).&lt;br /&gt;
** has_many :viewable_notifications, through: :courses (student role).&lt;br /&gt;
&lt;br /&gt;
3. Course Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications.&lt;br /&gt;
** has_many :students, through: :enrollments.&lt;br /&gt;
&lt;br /&gt;
== Endpoints for Notification Management ==&lt;br /&gt;
&lt;br /&gt;
Endpoints for Creating, Reading, Updating, and Deleting (CRUD) Notifications&lt;br /&gt;
&lt;br /&gt;
1. POST /notifications - Create a new notification. The create method in the NotificationController implementation aligns with this endpoint, allowing authorized users to create notifications for specific courses.&lt;br /&gt;
&lt;br /&gt;
2. GET /notifications - Get a list of notifications (with optional filters, such as is_active or is_unread). The index method aligns with this endpoint, allowing filtered retrieval of notifications.&lt;br /&gt;
&lt;br /&gt;
3. GET /notifications/:id - View details of a specific notification. The show method aligns with this endpoint, retrieving specific notification details.&lt;br /&gt;
&lt;br /&gt;
4. PUT /notifications/:id - Update a specific notification. The update method allows modification of existing notifications, respecting role-based access.&lt;br /&gt;
&lt;br /&gt;
5. DELETE /notifications/:id - Delete a specific notification. The destroy method aligns with this endpoint, enabling notification deletion by authorized users.&lt;br /&gt;
&lt;br /&gt;
6. PATCH /notifications/:id/toggle - Toggle active state of a notification. The toggle_notification_visibility method handles this functionality, toggling the is_active flag.&lt;br /&gt;
&lt;br /&gt;
=Design Pattern=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;1. Observer Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Automatically notify users (e.g., students enrolled in a course) whenever a new notification is created or updated.&lt;br /&gt;
** This ensures users are always informed about important updates without requiring manual intervention.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Notification model acts as the subject, and the students (or their respective notification systems) are observers.&lt;br /&gt;
** When a notification is created or updated, all observers are automatically notified through an after_commit callback.&lt;br /&gt;
** This pattern decouples the logic for creating notifications from the logic for notifying users, making the system easier to maintain and extend.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;2. Factory Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Creating different types of notifications (e.g., course notifications, system notifications, global announcements) with varying attributes or behaviors.&lt;br /&gt;
** This centralizes the creation logic and ensures consistency in object instantiation.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The factory centralizes the creation logic, making it easy to add new notification types in the future.&lt;br /&gt;
** It also reduces clutter in the controller by abstracting the instantiation process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;3. Strategy Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Dynamically applying different filtering criteria for notifications (e.g., active notifications, unread notifications, notifications for a specific course).&lt;br /&gt;
** This modularizes the filtering logic, making it easier to extend or change in the future.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Strategy Pattern separates filtering logic into individual strategy classes, making it easy to add new filters without modifying existing code.&lt;br /&gt;
** It also enhances the maintainability and testability of the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;4. Decorator Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Dynamically modifying the presentation of notifications based on user roles or other conditions.&lt;br /&gt;
** For example, students might see a simplified view of notifications, while instructors see a detailed view.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Decorator Pattern adds additional functionality (like role-based formatting) without modifying the original Notification model.&lt;br /&gt;
** It keeps the model clean and focused on core functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;5. Command Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Encapsulating the logic for sending notifications (e.g., emails, in-app alerts) into discrete, reusable objects.&lt;br /&gt;
** Useful for task queuing or asynchronous operations.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Command Pattern encapsulates the logic for sending notifications, making it easier to queue or log these operations.&lt;br /&gt;
** It improves code reusability and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;6. Template Method Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Defining a common process for creating notifications while allowing specific steps to be overridden for different types of notifications (e.g., course notifications vs. global announcements).&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Template Method Pattern enforces a consistent process for creating notifications while allowing flexibility for specific steps.&lt;br /&gt;
** This ensures uniformity across different notification types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;7. Singleton Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Managing a global notification scheduler or manager, ensuring that only one instance exists.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Singleton Pattern ensures that there is only one centralized manager for handling notification-related tasks, such as scheduling or batch operations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;8. Chain of Responsibility Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Modularizing the validation logic for notifications (e.g., checking permissions, validating expiration dates, ensuring uniqueness).&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Chain of Responsibility Pattern allows you to break down validation or processing logic into discrete steps, improving code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
1. Model Tests:&lt;br /&gt;
&lt;br /&gt;
* Validate presence and format of subject and description.&lt;br /&gt;
* Test is_active and is_unread default values.&lt;br /&gt;
&lt;br /&gt;
2. Controller Tests:&lt;br /&gt;
&lt;br /&gt;
* Ensure proper creation, update, and deletion of notifications.&lt;br /&gt;
* Test that only authorized users can manage notifications.&lt;br /&gt;
&lt;br /&gt;
3. Integration Tests:&lt;br /&gt;
&lt;br /&gt;
* Test access control to verify that only eligible users can view or manage notifications based on role and course association.&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
* '''Aditi Killedar''' akilled@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' [https://github.com/SoubarnicaSuresh/reimplementation-back-end]&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159309</id>
		<title>CSC/ECE 517 Fall 2024 - E2483. Reimplement Notification Controller and Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159309"/>
		<updated>2024-11-13T01:16:45Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Objective==&lt;br /&gt;
To create a Notification model in the backend to handle notifications for the Expertiza system. This model will manage notifications for different courses and be accessible to students and instructors based on their association with a course. Notifications can have attributes such as subject, description, expiration date, and status (active/inactive).&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* Create a new Notification model with appropriate attributes and relationships:&lt;br /&gt;
* Define associations with User and Course models&lt;br /&gt;
* Implement scopes for filtering notifications based on roles&lt;br /&gt;
* Add validation rules for notification data&lt;br /&gt;
* Include timestamp fields for proper notification tracking&lt;br /&gt;
* Develop a NotificationsController with:&lt;br /&gt;
    * Standard CRUD operations (create, read, update, delete)&lt;br /&gt;
    * Role-based access control logic&lt;br /&gt;
    * Course enrollment verification&lt;br /&gt;
    * Proper error handling and response formatting&lt;br /&gt;
    * RESTful API endpoints&lt;br /&gt;
    * Implement authorization logic: Add policies to ensure students only see relevant notifications&lt;br /&gt;
* Write comprehensive test cases:&lt;br /&gt;
    * Unit tests for the Notification model&lt;br /&gt;
    * Controller tests covering all CRUD operations&lt;br /&gt;
    * Integration tests for role-based access&lt;br /&gt;
    * Test cases for error scenarios and edge cases&lt;br /&gt;
&lt;br /&gt;
==Design Goals==&lt;br /&gt;
&amp;lt;b&amp;gt;Implement the Notification backend:&amp;lt;/b&amp;gt; Implement the Notification in Ruby on Rails.&lt;br /&gt;
&lt;br /&gt;
1. Model Creation:&lt;br /&gt;
&lt;br /&gt;
Create a Notification model with the following key attributes:&lt;br /&gt;
* id: Primary key (auto-generated).&lt;br /&gt;
* subject: Brief title of the notification.&lt;br /&gt;
* description: Detailed message of the notification.&lt;br /&gt;
* expiration_date: The date when the notification should expire.&lt;br /&gt;
* is_active: Boolean flag to mark if the notification is active or inactive.&lt;br /&gt;
* is_unread: Boolean to mark if a notification is unread (default to true for new notifications).&lt;br /&gt;
&lt;br /&gt;
2. Associations:&lt;br /&gt;
&lt;br /&gt;
* Define associations between Notification, User, and Course models.&lt;br /&gt;
* User Association: Each notification should have a creator (e.g., a teaching assistant or instructor).&lt;br /&gt;
* Course Association: Each notification should be linked to a course, and the enrolled students should be able to view relevant notifications.&lt;br /&gt;
&lt;br /&gt;
3. Relationships:&lt;br /&gt;
&lt;br /&gt;
* One-to-Many: Course to Notification, as each course can have multiple notifications.&lt;br /&gt;
* One-to-Many: User (creator) to Notification, as a user can create multiple notifications.&lt;br /&gt;
* Many-to-Many (indirect): User to Notification via course enrollment, as multiple students can view a notification if they are enrolled in the course associated with the notification.&lt;br /&gt;
&lt;br /&gt;
==Schema==&lt;br /&gt;
[[File:Schema2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
===Associations===&lt;br /&gt;
&lt;br /&gt;
'''Notification'''&lt;br /&gt;
&lt;br /&gt;
* belongs_to :user - Links the notification to its creator (TA, instructor).&lt;br /&gt;
&lt;br /&gt;
* belongs_to :course - Links the notification to a course.&lt;br /&gt;
&lt;br /&gt;
'''User'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Users (instructors, TAs) can create multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :viewable_notifications, through: :courses - Students can view notifications for courses they are enrolled in.&lt;br /&gt;
&lt;br /&gt;
'''Course'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Each course can have multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :students, through: :enrollments - Defines which students are associated with the course.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
[[File:UML notification2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
''' Relationship Explanation''' &lt;br /&gt;
&lt;br /&gt;
* User to Notification: A User (e.g., TA, instructor) can create multiple notifications.&lt;br /&gt;
* Course to Notification: Each Course can have multiple notifications associated with it.&lt;br /&gt;
* User (Student) to Notification (Viewer): Through Course enrollment, students can access notifications related to their courses.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&amp;lt;b&amp;gt;NotificationController Implementation&amp;lt;/b&amp;gt;: Following are the controller methods:&lt;br /&gt;
&lt;br /&gt;
1. create:&lt;br /&gt;
&lt;br /&gt;
* Description: This method is responsible for creating a new notification. It validates the incoming data to ensure that all required fields are present and correctly formatted. Only authorized users (instructors or TAs) can create notifications. Upon successful creation, the method associates the notification with the specified course and user (creator).&lt;br /&gt;
* API Endpoint: POST /notifications&lt;br /&gt;
* Parameters:&lt;br /&gt;
** subject (required): The title of the notification that briefly describes its purpose (limited to 255 characters).&lt;br /&gt;
** description (optional): Detailed content of the notification.&lt;br /&gt;
** expiration_date (optional): The date until which the notification remains valid. Defaults to no expiration.&lt;br /&gt;
** is_active (optional): A boolean flag indicating if the notification is active (default is true).&lt;br /&gt;
** course_id (required): The course associated with the notification.&lt;br /&gt;
* Authorization: Ensures that only users with roles of TA or instructor can create a notification.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the newly created notification with a 201 status.&lt;br /&gt;
** Error: Returns validation errors (e.g., missing fields, invalid data) with a 422 status.&lt;br /&gt;
&lt;br /&gt;
2. index:&lt;br /&gt;
&lt;br /&gt;
* Description: The index method retrieves a list of notifications based on specific filters, such as active status, unread status, or course association. This endpoint ensures that students only see notifications related to the courses they are enrolled in. It supports querying with multiple optional parameters for flexibility.&lt;br /&gt;
* API Endpoint: GET /notifications&lt;br /&gt;
* Parameters: Query parameters (optional):&lt;br /&gt;
** is_active: Filter notifications by their active status.&lt;br /&gt;
** is_unread: Retrieve only unread notifications for the current user.&lt;br /&gt;
** course_id: Fetch notifications specific to a course.&lt;br /&gt;
* Authorization: Students can only access notifications for courses they are enrolled in. Instructors and TAs can view all notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns an array of filtered notifications with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
3. show:&lt;br /&gt;
&lt;br /&gt;
* Description: This method retrieves the details of a specific notification identified by its unique ID. It ensures that the current user is authorized to view the notification (e.g., enrolled in the course or the creator of the notification).&lt;br /&gt;
* API Endpoint: GET /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be retrieved.&lt;br /&gt;
* Authorization: Students can view notifications for courses they are enrolled in. Instructors and TAs can view notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the notification details with a 200 status.&lt;br /&gt;
** Error: Returns a 404 status if the notification is not found or the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
4. update:&lt;br /&gt;
&lt;br /&gt;
* Description: This method allows the creator of a notification (TA or instructor) to update its details. It validates the incoming data and ensures that the user is authorized to make changes.&lt;br /&gt;
* API Endpoint: PUT /notifications/:id&lt;br /&gt;
* Parameters: Fields that can be updated include subject, description, expiration_date, and is_active.&lt;br /&gt;
* Authorization: Only the creator of the notification can update it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if the user does not have the required permissions.&lt;br /&gt;
&lt;br /&gt;
5. destroy:&lt;br /&gt;
&lt;br /&gt;
* Description: This method deletes a specific notification. Only the user who created the notification can perform this action. The method ensures that no unauthorized users can delete notifications.&lt;br /&gt;
* API Endpoint: DELETE /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be deleted.&lt;br /&gt;
* Authorization: Only the creator of the notification can delete it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns a 204 status with no content upon successful deletion.&lt;br /&gt;
** Error: Returns a 403 status if the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
6. toggle_notification_visibility:&lt;br /&gt;
&lt;br /&gt;
* Description: This method toggles the is_active status of a notification. For example, a TA or instructor can deactivate a notification that is no longer relevant. The method ensures that only the creator of the notification can perform this action.&lt;br /&gt;
* API Endpoint: PATCH /notifications/:id/toggle&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be toggled.&lt;br /&gt;
* Authorization: Only the creator of the notification can toggle its visibility.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification status with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Model Implementation&amp;lt;/b&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
1. Notification model:&lt;br /&gt;
&lt;br /&gt;
* Description: The Notification model represents a single notification. It includes all attributes, validations, and associations necessary for managing notifications.&lt;br /&gt;
* Attributes:&lt;br /&gt;
** subject: The title of the notification (required, max length: 255).&lt;br /&gt;
** description: The detailed content of the notification.&lt;br /&gt;
** expiration_date: The date when the notification should expire (validated to be in the future).&lt;br /&gt;
** is_active: Indicates whether the notification is active (default: true).&lt;br /&gt;
** is_unread: Marks if a notification is unread (default: true).&lt;br /&gt;
** course_id: Links the notification to a course.&lt;br /&gt;
** user_id: Links the notification to its creator.&lt;br /&gt;
* Associations:&lt;br /&gt;
** belongs_to :course&lt;br /&gt;
** belongs_to :user&lt;br /&gt;
* Validations:&lt;br /&gt;
** Ensures the presence of subject, course_id, and user_id.&lt;br /&gt;
** Validates expiration_date to ensure it is not in the past.&lt;br /&gt;
* Scopes:&lt;br /&gt;
** active: Filters notifications that are active.&lt;br /&gt;
** unread: Filters unread notifications for a user.&lt;br /&gt;
&lt;br /&gt;
2. User Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications (creator role).&lt;br /&gt;
** has_many :viewable_notifications, through: :courses (student role).&lt;br /&gt;
&lt;br /&gt;
3. Course Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications.&lt;br /&gt;
** has_many :students, through: :enrollments.&lt;br /&gt;
&lt;br /&gt;
== Endpoints for Notification Management ==&lt;br /&gt;
&lt;br /&gt;
Endpoints for Creating, Reading, Updating, and Deleting (CRUD) Notifications&lt;br /&gt;
&lt;br /&gt;
1. POST /notifications - Create a new notification. The create method in the NotificationController implementation aligns with this endpoint, allowing authorized users to create notifications for specific courses.&lt;br /&gt;
&lt;br /&gt;
2. GET /notifications - Get a list of notifications (with optional filters, such as is_active or is_unread). The index method aligns with this endpoint, allowing filtered retrieval of notifications.&lt;br /&gt;
&lt;br /&gt;
3. GET /notifications/:id - View details of a specific notification. The show method aligns with this endpoint, retrieving specific notification details.&lt;br /&gt;
&lt;br /&gt;
4. PUT /notifications/:id - Update a specific notification. The update method allows modification of existing notifications, respecting role-based access.&lt;br /&gt;
&lt;br /&gt;
5. DELETE /notifications/:id - Delete a specific notification. The destroy method aligns with this endpoint, enabling notification deletion by authorized users.&lt;br /&gt;
&lt;br /&gt;
6. PATCH /notifications/:id/toggle - Toggle active state of a notification. The toggle_notification_visibility method handles this functionality, toggling the is_active flag.&lt;br /&gt;
&lt;br /&gt;
=Design Pattern=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;1. Observer Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Automatically notify users (e.g., students enrolled in a course) whenever a new notification is created or updated.&lt;br /&gt;
** This ensures users are always informed about important updates without requiring manual intervention.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Notification model acts as the subject, and the students (or their respective notification systems) are observers.&lt;br /&gt;
** When a notification is created or updated, all observers are automatically notified through an after_commit callback.&lt;br /&gt;
** This pattern decouples the logic for creating notifications from the logic for notifying users, making the system easier to maintain and extend.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;2. Factory Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Creating different types of notifications (e.g., course notifications, system notifications, global announcements) with varying attributes or behaviors.&lt;br /&gt;
** This centralizes the creation logic and ensures consistency in object instantiation.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The factory centralizes the creation logic, making it easy to add new notification types in the future.&lt;br /&gt;
** It also reduces clutter in the controller by abstracting the instantiation process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;3. Strategy Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Dynamically applying different filtering criteria for notifications (e.g., active notifications, unread notifications, notifications for a specific course).&lt;br /&gt;
** This modularizes the filtering logic, making it easier to extend or change in the future.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Strategy Pattern separates filtering logic into individual strategy classes, making it easy to add new filters without modifying existing code.&lt;br /&gt;
** It also enhances the maintainability and testability of the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;4. Decorator Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Dynamically modifying the presentation of notifications based on user roles or other conditions.&lt;br /&gt;
** For example, students might see a simplified view of notifications, while instructors see a detailed view.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Decorator Pattern adds additional functionality (like role-based formatting) without modifying the original Notification model.&lt;br /&gt;
** It keeps the model clean and focused on core functionality.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;5. Command Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Encapsulating the logic for sending notifications (e.g., emails, in-app alerts) into discrete, reusable objects.&lt;br /&gt;
** Useful for task queuing or asynchronous operations.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Command Pattern encapsulates the logic for sending notifications, making it easier to queue or log these operations.&lt;br /&gt;
** It improves code reusability and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;6. Template Method Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Defining a common process for creating notifications while allowing specific steps to be overridden for different types of notifications (e.g., course notifications vs. global announcements).&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Template Method Pattern enforces a consistent process for creating notifications while allowing flexibility for specific steps.&lt;br /&gt;
** This ensures uniformity across different notification types.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;7. Singleton Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Managing a global notification scheduler or manager, ensuring that only one instance exists.&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Singleton Pattern ensures that there is only one centralized manager for handling notification-related tasks, such as scheduling or batch operations.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;8. Chain of Responsibility Pattern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Modularizing the validation logic for notifications (e.g., checking permissions, validating expiration dates, ensuring uniqueness).&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Chain of Responsibility Pattern allows you to break down validation or processing logic into discrete steps, improving code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
1. Model Tests:&lt;br /&gt;
&lt;br /&gt;
* Validate presence and format of subject and description.&lt;br /&gt;
* Test is_active and is_unread default values.&lt;br /&gt;
&lt;br /&gt;
2. Controller Tests:&lt;br /&gt;
&lt;br /&gt;
* Ensure proper creation, update, and deletion of notifications.&lt;br /&gt;
* Test that only authorized users can manage notifications.&lt;br /&gt;
&lt;br /&gt;
3. Integration Tests:&lt;br /&gt;
&lt;br /&gt;
* Test access control to verify that only eligible users can view or manage notifications based on role and course association.&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
* '''Aditi Killedar''' akilled@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' &lt;br /&gt;
* '''Pull Request:'''&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159298</id>
		<title>CSC/ECE 517 Fall 2024 - E2483. Reimplement Notification Controller and Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159298"/>
		<updated>2024-11-13T01:10:06Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Objective==&lt;br /&gt;
To create a Notification model in the backend to handle notifications for the Expertiza system. This model will manage notifications for different courses and be accessible to students and instructors based on their association with a course. Notifications can have attributes such as subject, description, expiration date, and status (active/inactive).&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* Create a new Notification model with appropriate attributes and relationships:&lt;br /&gt;
* Define associations with User and Course models&lt;br /&gt;
* Implement scopes for filtering notifications based on roles&lt;br /&gt;
* Add validation rules for notification data&lt;br /&gt;
* Include timestamp fields for proper notification tracking&lt;br /&gt;
* Develop a NotificationsController with:&lt;br /&gt;
    * Standard CRUD operations (create, read, update, delete)&lt;br /&gt;
    * Role-based access control logic&lt;br /&gt;
    * Course enrollment verification&lt;br /&gt;
    * Proper error handling and response formatting&lt;br /&gt;
    * RESTful API endpoints&lt;br /&gt;
    * Implement authorization logic: Add policies to ensure students only see relevant notifications&lt;br /&gt;
* Write comprehensive test cases:&lt;br /&gt;
    * Unit tests for the Notification model&lt;br /&gt;
    * Controller tests covering all CRUD operations&lt;br /&gt;
    * Integration tests for role-based access&lt;br /&gt;
    * Test cases for error scenarios and edge cases&lt;br /&gt;
&lt;br /&gt;
==Design Goals==&lt;br /&gt;
&amp;lt;b&amp;gt;Implement the Notification backend:&amp;lt;/b&amp;gt; Implement the Notification in Ruby on Rails.&lt;br /&gt;
&lt;br /&gt;
1. Model Creation:&lt;br /&gt;
&lt;br /&gt;
Create a Notification model with the following key attributes:&lt;br /&gt;
* id: Primary key (auto-generated).&lt;br /&gt;
* subject: Brief title of the notification.&lt;br /&gt;
* description: Detailed message of the notification.&lt;br /&gt;
* expiration_date: The date when the notification should expire.&lt;br /&gt;
* is_active: Boolean flag to mark if the notification is active or inactive.&lt;br /&gt;
* is_unread: Boolean to mark if a notification is unread (default to true for new notifications).&lt;br /&gt;
&lt;br /&gt;
2. Associations:&lt;br /&gt;
&lt;br /&gt;
* Define associations between Notification, User, and Course models.&lt;br /&gt;
* User Association: Each notification should have a creator (e.g., a teaching assistant or instructor).&lt;br /&gt;
* Course Association: Each notification should be linked to a course, and the enrolled students should be able to view relevant notifications.&lt;br /&gt;
&lt;br /&gt;
3. Relationships:&lt;br /&gt;
&lt;br /&gt;
* One-to-Many: Course to Notification, as each course can have multiple notifications.&lt;br /&gt;
* One-to-Many: User (creator) to Notification, as a user can create multiple notifications.&lt;br /&gt;
* Many-to-Many (indirect): User to Notification via course enrollment, as multiple students can view a notification if they are enrolled in the course associated with the notification.&lt;br /&gt;
&lt;br /&gt;
==Schema==&lt;br /&gt;
[[File:Schema2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
===Associations===&lt;br /&gt;
&lt;br /&gt;
'''Notification'''&lt;br /&gt;
&lt;br /&gt;
* belongs_to :user - Links the notification to its creator (TA, instructor).&lt;br /&gt;
&lt;br /&gt;
* belongs_to :course - Links the notification to a course.&lt;br /&gt;
&lt;br /&gt;
'''User'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Users (instructors, TAs) can create multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :viewable_notifications, through: :courses - Students can view notifications for courses they are enrolled in.&lt;br /&gt;
&lt;br /&gt;
'''Course'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Each course can have multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :students, through: :enrollments - Defines which students are associated with the course.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
[[File:UML notification2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
''' Relationship Explanation''' &lt;br /&gt;
&lt;br /&gt;
* User to Notification: A User (e.g., TA, instructor) can create multiple notifications.&lt;br /&gt;
* Course to Notification: Each Course can have multiple notifications associated with it.&lt;br /&gt;
* User (Student) to Notification (Viewer): Through Course enrollment, students can access notifications related to their courses.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&amp;lt;b&amp;gt;NotificationController Implementation&amp;lt;/b&amp;gt;: Following are the controller methods:&lt;br /&gt;
&lt;br /&gt;
1. create:&lt;br /&gt;
&lt;br /&gt;
* Description: This method is responsible for creating a new notification. It validates the incoming data to ensure that all required fields are present and correctly formatted. Only authorized users (instructors or TAs) can create notifications. Upon successful creation, the method associates the notification with the specified course and user (creator).&lt;br /&gt;
* API Endpoint: POST /notifications&lt;br /&gt;
* Parameters:&lt;br /&gt;
** subject (required): The title of the notification that briefly describes its purpose (limited to 255 characters).&lt;br /&gt;
** description (optional): Detailed content of the notification.&lt;br /&gt;
** expiration_date (optional): The date until which the notification remains valid. Defaults to no expiration.&lt;br /&gt;
** is_active (optional): A boolean flag indicating if the notification is active (default is true).&lt;br /&gt;
** course_id (required): The course associated with the notification.&lt;br /&gt;
* Authorization: Ensures that only users with roles of TA or instructor can create a notification.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the newly created notification with a 201 status.&lt;br /&gt;
** Error: Returns validation errors (e.g., missing fields, invalid data) with a 422 status.&lt;br /&gt;
&lt;br /&gt;
2. index:&lt;br /&gt;
&lt;br /&gt;
* Description: The index method retrieves a list of notifications based on specific filters, such as active status, unread status, or course association. This endpoint ensures that students only see notifications related to the courses they are enrolled in. It supports querying with multiple optional parameters for flexibility.&lt;br /&gt;
* API Endpoint: GET /notifications&lt;br /&gt;
* Parameters: Query parameters (optional):&lt;br /&gt;
** is_active: Filter notifications by their active status.&lt;br /&gt;
** is_unread: Retrieve only unread notifications for the current user.&lt;br /&gt;
** course_id: Fetch notifications specific to a course.&lt;br /&gt;
* Authorization: Students can only access notifications for courses they are enrolled in. Instructors and TAs can view all notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns an array of filtered notifications with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
3. show:&lt;br /&gt;
&lt;br /&gt;
* Description: This method retrieves the details of a specific notification identified by its unique ID. It ensures that the current user is authorized to view the notification (e.g., enrolled in the course or the creator of the notification).&lt;br /&gt;
* API Endpoint: GET /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be retrieved.&lt;br /&gt;
* Authorization: Students can view notifications for courses they are enrolled in. Instructors and TAs can view notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the notification details with a 200 status.&lt;br /&gt;
** Error: Returns a 404 status if the notification is not found or the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
4. update:&lt;br /&gt;
&lt;br /&gt;
* Description: This method allows the creator of a notification (TA or instructor) to update its details. It validates the incoming data and ensures that the user is authorized to make changes.&lt;br /&gt;
* API Endpoint: PUT /notifications/:id&lt;br /&gt;
* Parameters: Fields that can be updated include subject, description, expiration_date, and is_active.&lt;br /&gt;
* Authorization: Only the creator of the notification can update it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if the user does not have the required permissions.&lt;br /&gt;
&lt;br /&gt;
5. destroy:&lt;br /&gt;
&lt;br /&gt;
* Description: This method deletes a specific notification. Only the user who created the notification can perform this action. The method ensures that no unauthorized users can delete notifications.&lt;br /&gt;
* API Endpoint: DELETE /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be deleted.&lt;br /&gt;
* Authorization: Only the creator of the notification can delete it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns a 204 status with no content upon successful deletion.&lt;br /&gt;
** Error: Returns a 403 status if the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
6. toggle_notification_visibility:&lt;br /&gt;
&lt;br /&gt;
* Description: This method toggles the is_active status of a notification. For example, a TA or instructor can deactivate a notification that is no longer relevant. The method ensures that only the creator of the notification can perform this action.&lt;br /&gt;
* API Endpoint: PATCH /notifications/:id/toggle&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be toggled.&lt;br /&gt;
* Authorization: Only the creator of the notification can toggle its visibility.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification status with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Model Implementation&amp;lt;/b&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
1. Notification model:&lt;br /&gt;
&lt;br /&gt;
* Description: The Notification model represents a single notification. It includes all attributes, validations, and associations necessary for managing notifications.&lt;br /&gt;
* Attributes:&lt;br /&gt;
** subject: The title of the notification (required, max length: 255).&lt;br /&gt;
** description: The detailed content of the notification.&lt;br /&gt;
** expiration_date: The date when the notification should expire (validated to be in the future).&lt;br /&gt;
** is_active: Indicates whether the notification is active (default: true).&lt;br /&gt;
** is_unread: Marks if a notification is unread (default: true).&lt;br /&gt;
** course_id: Links the notification to a course.&lt;br /&gt;
** user_id: Links the notification to its creator.&lt;br /&gt;
* Associations:&lt;br /&gt;
** belongs_to :course&lt;br /&gt;
** belongs_to :user&lt;br /&gt;
* Validations:&lt;br /&gt;
** Ensures the presence of subject, course_id, and user_id.&lt;br /&gt;
** Validates expiration_date to ensure it is not in the past.&lt;br /&gt;
* Scopes:&lt;br /&gt;
** active: Filters notifications that are active.&lt;br /&gt;
** unread: Filters unread notifications for a user.&lt;br /&gt;
&lt;br /&gt;
2. User Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications (creator role).&lt;br /&gt;
** has_many :viewable_notifications, through: :courses (student role).&lt;br /&gt;
&lt;br /&gt;
3. Course Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications.&lt;br /&gt;
** has_many :students, through: :enrollments.&lt;br /&gt;
&lt;br /&gt;
== Endpoints for Notification Management ==&lt;br /&gt;
&lt;br /&gt;
Endpoints for Creating, Reading, Updating, and Deleting (CRUD) Notifications&lt;br /&gt;
&lt;br /&gt;
1. POST /notifications - Create a new notification. The create method in the NotificationController implementation aligns with this endpoint, allowing authorized users to create notifications for specific courses.&lt;br /&gt;
&lt;br /&gt;
2. GET /notifications - Get a list of notifications (with optional filters, such as is_active or is_unread). The index method aligns with this endpoint, allowing filtered retrieval of notifications.&lt;br /&gt;
&lt;br /&gt;
3. GET /notifications/:id - View details of a specific notification. The show method aligns with this endpoint, retrieving specific notification details.&lt;br /&gt;
&lt;br /&gt;
4. PUT /notifications/:id - Update a specific notification. The update method allows modification of existing notifications, respecting role-based access.&lt;br /&gt;
&lt;br /&gt;
5. DELETE /notifications/:id - Delete a specific notification. The destroy method aligns with this endpoint, enabling notification deletion by authorized users.&lt;br /&gt;
&lt;br /&gt;
6. PATCH /notifications/:id/toggle - Toggle active state of a notification. The toggle_notification_visibility method handles this functionality, toggling the is_active flag.&lt;br /&gt;
&lt;br /&gt;
=Design Pattern=&lt;br /&gt;
&lt;br /&gt;
1. Observer Pattern&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Automatically notify users (e.g., students enrolled in a course) whenever a new notification is created or updated.&lt;br /&gt;
** This ensures users are always informed about important updates without requiring manual intervention.&lt;br /&gt;
* Implementation:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class Notification &amp;lt; ApplicationRecord&lt;br /&gt;
  after_commit :notify_users, on: [:create]&lt;br /&gt;
  private&lt;br /&gt;
  def notify_users&lt;br /&gt;
    course.students.each do |student|&lt;br /&gt;
      NotificationMailer.new_notification(student, self).deliver_later&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Notification model acts as the subject, and the students (or their respective notification systems) are observers.&lt;br /&gt;
** When a notification is created or updated, all observers are automatically notified through an after_commit callback.&lt;br /&gt;
** This pattern decouples the logic for creating notifications from the logic for notifying users, making the system easier to maintain and extend.&lt;br /&gt;
&lt;br /&gt;
2. Factory Pattern&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Creating different types of notifications (e.g., course notifications, system notifications, global announcements) with varying attributes or behaviors.&lt;br /&gt;
** This centralizes the creation logic and ensures consistency in object instantiation.&lt;br /&gt;
* Implementation:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class NotificationFactory&lt;br /&gt;
  def self.create_notification(type, attributes)&lt;br /&gt;
    case type&lt;br /&gt;
    when 'course'&lt;br /&gt;
      CourseNotification.new(attributes)&lt;br /&gt;
    when 'system'&lt;br /&gt;
      SystemNotification.new(attributes)&lt;br /&gt;
    else&lt;br /&gt;
      raise ArgumentError, &amp;quot;Unknown notification type: #{type}&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Usage Example&lt;br /&gt;
notification = NotificationFactory.create_notification('course', {&lt;br /&gt;
  subject: 'New Assignment',&lt;br /&gt;
  description: 'Assignment 3 is due next week.',&lt;br /&gt;
  course_id: 1,&lt;br /&gt;
  user_id: current_user.id&lt;br /&gt;
})&lt;br /&gt;
notification.save&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The factory centralizes the creation logic, making it easy to add new notification types in the future.&lt;br /&gt;
** It also reduces clutter in the controller by abstracting the instantiation process.&lt;br /&gt;
&lt;br /&gt;
3. Strategy Pattern&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Dynamically applying different filtering criteria for notifications (e.g., active notifications, unread notifications, notifications for a specific course).&lt;br /&gt;
** This modularizes the filtering logic, making it easier to extend or change in the future.&lt;br /&gt;
* Implementation:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class ActiveNotificationStrategy&lt;br /&gt;
  def filter(notifications)&lt;br /&gt;
    notifications.where(is_active: true)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class UnreadNotificationStrategy&lt;br /&gt;
  def filter(notifications, user)&lt;br /&gt;
    notifications.joins(:user_notifications).where(user_notifications: { is_unread: true, user_id: user.id })&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class NotificationFilter&lt;br /&gt;
  def initialize(strategy)&lt;br /&gt;
    @strategy = strategy&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def filter(notifications, user = nil)&lt;br /&gt;
    @strategy.filter(notifications, user)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Usage in Controller&lt;br /&gt;
def index&lt;br /&gt;
  strategy = case params[:filter]&lt;br /&gt;
             when 'active'&lt;br /&gt;
               ActiveNotificationStrategy.new&lt;br /&gt;
             when 'unread'&lt;br /&gt;
               UnreadNotificationStrategy.new&lt;br /&gt;
             else&lt;br /&gt;
               ActiveNotificationStrategy.new&lt;br /&gt;
             end&lt;br /&gt;
&lt;br /&gt;
  @notifications = NotificationFilter.new(strategy).filter(Notification.all, current_user)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Strategy Pattern separates filtering logic into individual strategy classes, making it easy to add new filters without modifying existing code.&lt;br /&gt;
** It also enhances the maintainability and testability of the system.&lt;br /&gt;
&lt;br /&gt;
4. Decorator Pattern&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Dynamically modifying the presentation of notifications based on user roles or other conditions.&lt;br /&gt;
** For example, students might see a simplified view of notifications, while instructors see a detailed view.&lt;br /&gt;
* Implementation:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class NotificationDecorator &amp;lt; SimpleDelegator&lt;br /&gt;
  def formatted_subject&lt;br /&gt;
    if user.role == 'student'&lt;br /&gt;
      &amp;quot;[Student] #{subject}&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      &amp;quot;[Instructor] #{subject} (Created by #{creator.name})&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def readable_description&lt;br /&gt;
    description.truncate(100)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Usage&lt;br /&gt;
@notification = NotificationDecorator.new(notification)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Decorator Pattern adds additional functionality (like role-based formatting) without modifying the original Notification model.&lt;br /&gt;
** It keeps the model clean and focused on core functionality.&lt;br /&gt;
&lt;br /&gt;
5. Command Pattern&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Encapsulating the logic for sending notifications (e.g., emails, in-app alerts) into discrete, reusable objects.&lt;br /&gt;
** Useful for task queuing or asynchronous operations.&lt;br /&gt;
* Implementation:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class SendNotificationCommand&lt;br /&gt;
  def initialize(user, notification)&lt;br /&gt;
    @user = user&lt;br /&gt;
    @notification = notification&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def execute&lt;br /&gt;
    NotificationMailer.new_notification(@user, @notification).deliver_later&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Usage&lt;br /&gt;
course.students.each do |student|&lt;br /&gt;
  SendNotificationCommand.new(student, notification).execute&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Command Pattern encapsulates the logic for sending notifications, making it easier to queue or log these operations.&lt;br /&gt;
** It improves code reusability and separation of concerns.&lt;br /&gt;
&lt;br /&gt;
6. Template Method Pattern&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Defining a common process for creating notifications while allowing specific steps to be overridden for different types of notifications (e.g., course notifications vs. global announcements).&lt;br /&gt;
* Implementation:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class NotificationBase&lt;br /&gt;
  def create_notification&lt;br /&gt;
    validate_data&lt;br /&gt;
    save_notification&lt;br /&gt;
    send_notification&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  private&lt;br /&gt;
&lt;br /&gt;
  def validate_data&lt;br /&gt;
    raise NotImplementedError, 'Subclasses must define validate_data'&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def save_notification&lt;br /&gt;
    Notification.create(subject: @subject, description: @description)&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def send_notification&lt;br /&gt;
    raise NotImplementedError, 'Subclasses must define send_notification'&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class CourseNotification &amp;lt; NotificationBase&lt;br /&gt;
  def validate_data&lt;br /&gt;
    # Validation logic specific to course notifications&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def send_notification&lt;br /&gt;
    # Logic to notify enrolled students&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Template Method Pattern enforces a consistent process for creating notifications while allowing flexibility for specific steps.&lt;br /&gt;
** This ensures uniformity across different notification types.&lt;br /&gt;
&lt;br /&gt;
7. Singleton Pattern&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Managing a global notification scheduler or manager, ensuring that only one instance exists.&lt;br /&gt;
* Implementation:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class NotificationScheduler&lt;br /&gt;
  include Singleton&lt;br /&gt;
&lt;br /&gt;
  def schedule_notifications&lt;br /&gt;
    # Logic to schedule notifications&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Usage&lt;br /&gt;
NotificationScheduler.instance.schedule_notifications&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Singleton Pattern ensures that there is only one centralized manager for handling notification-related tasks, such as scheduling or batch operations.&lt;br /&gt;
&lt;br /&gt;
8. Chain of Responsibility Pattern&lt;br /&gt;
&lt;br /&gt;
* Use Case:&lt;br /&gt;
** Modularizing the validation logic for notifications (e.g., checking permissions, validating expiration dates, ensuring uniqueness).&lt;br /&gt;
* Implementation:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
class BaseHandler&lt;br /&gt;
  def set_next(handler)&lt;br /&gt;
    @next_handler = handler&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def handle(request)&lt;br /&gt;
    return @next_handler.handle(request) if @next_handler&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class RoleValidationHandler &amp;lt; BaseHandler&lt;br /&gt;
  def handle(request)&lt;br /&gt;
    raise 'Unauthorized' unless request.user.role == 'instructor'&lt;br /&gt;
    super(request)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
class ExpiryValidationHandler &amp;lt; BaseHandler&lt;br /&gt;
  def handle(request)&lt;br /&gt;
    raise 'Invalid expiration date' if request.expiration_date &amp;lt; Date.today&lt;br /&gt;
    super(request)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
# Usage&lt;br /&gt;
role_handler = RoleValidationHandler.new&lt;br /&gt;
expiry_handler = ExpiryValidationHandler.new&lt;br /&gt;
&lt;br /&gt;
role_handler.set_next(expiry_handler)&lt;br /&gt;
role_handler.handle(request)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Explanation:&lt;br /&gt;
** The Chain of Responsibility Pattern allows you to break down validation or processing logic into discrete steps, improving code readability and maintainability.&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
1. Model Tests:&lt;br /&gt;
&lt;br /&gt;
* Validate presence and format of subject and description.&lt;br /&gt;
* Test is_active and is_unread default values.&lt;br /&gt;
&lt;br /&gt;
2. Controller Tests:&lt;br /&gt;
&lt;br /&gt;
* Ensure proper creation, update, and deletion of notifications.&lt;br /&gt;
* Test that only authorized users can manage notifications.&lt;br /&gt;
&lt;br /&gt;
3. Integration Tests:&lt;br /&gt;
&lt;br /&gt;
* Test access control to verify that only eligible users can view or manage notifications based on role and course association.&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
* '''Aditi Killedar''' akilled@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' &lt;br /&gt;
* '''Pull Request:'''&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159216</id>
		<title>CSC/ECE 517 Fall 2024 - E2483. Reimplement Notification Controller and Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159216"/>
		<updated>2024-11-13T00:23:15Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Objective==&lt;br /&gt;
To create a Notification model in the backend to handle notifications for the Expertiza system. This model will manage notifications for different courses and be accessible to students and instructors based on their association with a course. Notifications can have attributes such as subject, description, expiration date, and status (active/inactive).&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* Create a new Notification model with appropriate attributes and relationships:&lt;br /&gt;
* Define associations with User and Course models&lt;br /&gt;
* Implement scopes for filtering notifications based on roles&lt;br /&gt;
* Add validation rules for notification data&lt;br /&gt;
* Include timestamp fields for proper notification tracking&lt;br /&gt;
* Develop a NotificationsController with:&lt;br /&gt;
    * Standard CRUD operations (create, read, update, delete)&lt;br /&gt;
    * Role-based access control logic&lt;br /&gt;
    * Course enrollment verification&lt;br /&gt;
    * Proper error handling and response formatting&lt;br /&gt;
    * RESTful API endpoints&lt;br /&gt;
    * Implement authorization logic: Add policies to ensure students only see relevant notifications&lt;br /&gt;
* Write comprehensive test cases:&lt;br /&gt;
    * Unit tests for the Notification model&lt;br /&gt;
    * Controller tests covering all CRUD operations&lt;br /&gt;
    * Integration tests for role-based access&lt;br /&gt;
    * Test cases for error scenarios and edge cases&lt;br /&gt;
&lt;br /&gt;
==Design Goals==&lt;br /&gt;
&amp;lt;b&amp;gt;Implement the Notification backend:&amp;lt;/b&amp;gt; Implement the Notification in Ruby on Rails.&lt;br /&gt;
&lt;br /&gt;
1. Model Creation:&lt;br /&gt;
&lt;br /&gt;
Create a Notification model with the following key attributes:&lt;br /&gt;
* id: Primary key (auto-generated).&lt;br /&gt;
* subject: Brief title of the notification.&lt;br /&gt;
* description: Detailed message of the notification.&lt;br /&gt;
* expiration_date: The date when the notification should expire.&lt;br /&gt;
* is_active: Boolean flag to mark if the notification is active or inactive.&lt;br /&gt;
* is_unread: Boolean to mark if a notification is unread (default to true for new notifications).&lt;br /&gt;
&lt;br /&gt;
2. Associations:&lt;br /&gt;
&lt;br /&gt;
* Define associations between Notification, User, and Course models.&lt;br /&gt;
* User Association: Each notification should have a creator (e.g., a teaching assistant or instructor).&lt;br /&gt;
* Course Association: Each notification should be linked to a course, and the enrolled students should be able to view relevant notifications.&lt;br /&gt;
&lt;br /&gt;
3. Relationships:&lt;br /&gt;
&lt;br /&gt;
* One-to-Many: Course to Notification, as each course can have multiple notifications.&lt;br /&gt;
* One-to-Many: User (creator) to Notification, as a user can create multiple notifications.&lt;br /&gt;
* Many-to-Many (indirect): User to Notification via course enrollment, as multiple students can view a notification if they are enrolled in the course associated with the notification.&lt;br /&gt;
&lt;br /&gt;
==Schema==&lt;br /&gt;
[[File:Schema2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
===Associations===&lt;br /&gt;
&lt;br /&gt;
'''Notification'''&lt;br /&gt;
&lt;br /&gt;
* belongs_to :user - Links the notification to its creator (TA, instructor).&lt;br /&gt;
&lt;br /&gt;
* belongs_to :course - Links the notification to a course.&lt;br /&gt;
&lt;br /&gt;
'''User'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Users (instructors, TAs) can create multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :viewable_notifications, through: :courses - Students can view notifications for courses they are enrolled in.&lt;br /&gt;
&lt;br /&gt;
'''Course'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Each course can have multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :students, through: :enrollments - Defines which students are associated with the course.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
[[File:UML notification2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
''' Relationship Explanation''' &lt;br /&gt;
&lt;br /&gt;
* User to Notification: A User (e.g., TA, instructor) can create multiple notifications.&lt;br /&gt;
* Course to Notification: Each Course can have multiple notifications associated with it.&lt;br /&gt;
* User (Student) to Notification (Viewer): Through Course enrollment, students can access notifications related to their courses.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&amp;lt;b&amp;gt;NotificationController Implementation&amp;lt;/b&amp;gt;: Following are the controller methods:&lt;br /&gt;
&lt;br /&gt;
1. create:&lt;br /&gt;
&lt;br /&gt;
* Description: This method is responsible for creating a new notification. It validates the incoming data to ensure that all required fields are present and correctly formatted. Only authorized users (instructors or TAs) can create notifications. Upon successful creation, the method associates the notification with the specified course and user (creator).&lt;br /&gt;
* API Endpoint: POST /notifications&lt;br /&gt;
* Parameters:&lt;br /&gt;
** subject (required): The title of the notification that briefly describes its purpose (limited to 255 characters).&lt;br /&gt;
** description (optional): Detailed content of the notification.&lt;br /&gt;
** expiration_date (optional): The date until which the notification remains valid. Defaults to no expiration.&lt;br /&gt;
** is_active (optional): A boolean flag indicating if the notification is active (default is true).&lt;br /&gt;
** course_id (required): The course associated with the notification.&lt;br /&gt;
* Authorization: Ensures that only users with roles of TA or instructor can create a notification.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the newly created notification with a 201 status.&lt;br /&gt;
** Error: Returns validation errors (e.g., missing fields, invalid data) with a 422 status.&lt;br /&gt;
&lt;br /&gt;
2. index:&lt;br /&gt;
&lt;br /&gt;
* Description: The index method retrieves a list of notifications based on specific filters, such as active status, unread status, or course association. This endpoint ensures that students only see notifications related to the courses they are enrolled in. It supports querying with multiple optional parameters for flexibility.&lt;br /&gt;
* API Endpoint: GET /notifications&lt;br /&gt;
* Parameters: Query parameters (optional):&lt;br /&gt;
** is_active: Filter notifications by their active status.&lt;br /&gt;
** is_unread: Retrieve only unread notifications for the current user.&lt;br /&gt;
** course_id: Fetch notifications specific to a course.&lt;br /&gt;
* Authorization: Students can only access notifications for courses they are enrolled in. Instructors and TAs can view all notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns an array of filtered notifications with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
3. show:&lt;br /&gt;
&lt;br /&gt;
* Description: This method retrieves the details of a specific notification identified by its unique ID. It ensures that the current user is authorized to view the notification (e.g., enrolled in the course or the creator of the notification).&lt;br /&gt;
* API Endpoint: GET /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be retrieved.&lt;br /&gt;
* Authorization: Students can view notifications for courses they are enrolled in. Instructors and TAs can view notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the notification details with a 200 status.&lt;br /&gt;
** Error: Returns a 404 status if the notification is not found or the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
4. update:&lt;br /&gt;
&lt;br /&gt;
* Description: This method allows the creator of a notification (TA or instructor) to update its details. It validates the incoming data and ensures that the user is authorized to make changes.&lt;br /&gt;
* API Endpoint: PUT /notifications/:id&lt;br /&gt;
* Parameters: Fields that can be updated include subject, description, expiration_date, and is_active.&lt;br /&gt;
* Authorization: Only the creator of the notification can update it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if the user does not have the required permissions.&lt;br /&gt;
&lt;br /&gt;
5. destroy:&lt;br /&gt;
&lt;br /&gt;
* Description: This method deletes a specific notification. Only the user who created the notification can perform this action. The method ensures that no unauthorized users can delete notifications.&lt;br /&gt;
* API Endpoint: DELETE /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be deleted.&lt;br /&gt;
* Authorization: Only the creator of the notification can delete it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns a 204 status with no content upon successful deletion.&lt;br /&gt;
** Error: Returns a 403 status if the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
6. toggle_notification_visibility:&lt;br /&gt;
&lt;br /&gt;
* Description: This method toggles the is_active status of a notification. For example, a TA or instructor can deactivate a notification that is no longer relevant. The method ensures that only the creator of the notification can perform this action.&lt;br /&gt;
* API Endpoint: PATCH /notifications/:id/toggle&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be toggled.&lt;br /&gt;
* Authorization: Only the creator of the notification can toggle its visibility.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification status with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Model Implementation&amp;lt;/b&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
1. Notification model:&lt;br /&gt;
&lt;br /&gt;
* Description: The Notification model represents a single notification. It includes all attributes, validations, and associations necessary for managing notifications.&lt;br /&gt;
* Attributes:&lt;br /&gt;
** subject: The title of the notification (required, max length: 255).&lt;br /&gt;
** description: The detailed content of the notification.&lt;br /&gt;
** expiration_date: The date when the notification should expire (validated to be in the future).&lt;br /&gt;
** is_active: Indicates whether the notification is active (default: true).&lt;br /&gt;
** is_unread: Marks if a notification is unread (default: true).&lt;br /&gt;
** course_id: Links the notification to a course.&lt;br /&gt;
** user_id: Links the notification to its creator.&lt;br /&gt;
* Associations:&lt;br /&gt;
** belongs_to :course&lt;br /&gt;
** belongs_to :user&lt;br /&gt;
* Validations:&lt;br /&gt;
** Ensures the presence of subject, course_id, and user_id.&lt;br /&gt;
** Validates expiration_date to ensure it is not in the past.&lt;br /&gt;
* Scopes:&lt;br /&gt;
** active: Filters notifications that are active.&lt;br /&gt;
** unread: Filters unread notifications for a user.&lt;br /&gt;
&lt;br /&gt;
2. User Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications (creator role).&lt;br /&gt;
** has_many :viewable_notifications, through: :courses (student role).&lt;br /&gt;
&lt;br /&gt;
3. Course Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications.&lt;br /&gt;
** has_many :students, through: :enrollments.&lt;br /&gt;
&lt;br /&gt;
== Endpoints for Notification Management ==&lt;br /&gt;
&lt;br /&gt;
Endpoints for Creating, Reading, Updating, and Deleting (CRUD) Notifications&lt;br /&gt;
&lt;br /&gt;
1. POST /notifications - Create a new notification. The create method in the NotificationController implementation aligns with this endpoint, allowing authorized users to create notifications for specific courses.&lt;br /&gt;
&lt;br /&gt;
2. GET /notifications - Get a list of notifications (with optional filters, such as is_active or is_unread). The index method aligns with this endpoint, allowing filtered retrieval of notifications.&lt;br /&gt;
&lt;br /&gt;
3. GET /notifications/:id - View details of a specific notification. The show method aligns with this endpoint, retrieving specific notification details.&lt;br /&gt;
&lt;br /&gt;
4. PUT /notifications/:id - Update a specific notification. The update method allows modification of existing notifications, respecting role-based access.&lt;br /&gt;
&lt;br /&gt;
5. DELETE /notifications/:id - Delete a specific notification. The destroy method aligns with this endpoint, enabling notification deletion by authorized users.&lt;br /&gt;
&lt;br /&gt;
6. PATCH /notifications/:id/toggle - Toggle active state of a notification. The toggle_notification_visibility method handles this functionality, toggling the is_active flag.&lt;br /&gt;
&lt;br /&gt;
=Design Pattern=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
1. Model Tests:&lt;br /&gt;
&lt;br /&gt;
* Validate presence and format of subject and description.&lt;br /&gt;
* Test is_active and is_unread default values.&lt;br /&gt;
&lt;br /&gt;
2. Controller Tests:&lt;br /&gt;
&lt;br /&gt;
* Ensure proper creation, update, and deletion of notifications.&lt;br /&gt;
* Test that only authorized users can manage notifications.&lt;br /&gt;
&lt;br /&gt;
3. Integration Tests:&lt;br /&gt;
&lt;br /&gt;
* Test access control to verify that only eligible users can view or manage notifications based on role and course association.&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
* '''Aditi Killedar''' akilled@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' &lt;br /&gt;
* '''Pull Request:'''&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159207</id>
		<title>CSC/ECE 517 Fall 2024 - E2483. Reimplement Notification Controller and Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2483._Reimplement_Notification_Controller_and_Model&amp;diff=159207"/>
		<updated>2024-11-13T00:18:17Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
==Objective==&lt;br /&gt;
To create a Notification model in the backend to handle notifications for the Expertiza system. This model will manage notifications for different courses and be accessible to students and instructors based on their association with a course. Notifications can have attributes such as subject, description, expiration date, and status (active/inactive).&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
* Create a new Notification model with appropriate attributes and relationships:&lt;br /&gt;
* Define associations with User and Course models&lt;br /&gt;
* Implement scopes for filtering notifications based on roles&lt;br /&gt;
* Add validation rules for notification data&lt;br /&gt;
* Include timestamp fields for proper notification tracking&lt;br /&gt;
* Develop a NotificationsController with:&lt;br /&gt;
    * Standard CRUD operations (create, read, update, delete)&lt;br /&gt;
    * Role-based access control logic&lt;br /&gt;
    * Course enrollment verification&lt;br /&gt;
    * Proper error handling and response formatting&lt;br /&gt;
    * RESTful API endpoints&lt;br /&gt;
    * Implement authorization logic: Add policies to ensure students only see relevant notifications&lt;br /&gt;
* Write comprehensive test cases:&lt;br /&gt;
    * Unit tests for the Notification model&lt;br /&gt;
    * Controller tests covering all CRUD operations&lt;br /&gt;
    * Integration tests for role-based access&lt;br /&gt;
    * Test cases for error scenarios and edge cases&lt;br /&gt;
&lt;br /&gt;
==Design Goals==&lt;br /&gt;
&amp;lt;b&amp;gt;Implement the Notification backend:&amp;lt;/b&amp;gt; Implement the Notification in Ruby on Rails.&lt;br /&gt;
&lt;br /&gt;
1. Model Creation:&lt;br /&gt;
&lt;br /&gt;
Create a Notification model with the following key attributes:&lt;br /&gt;
* id: Primary key (auto-generated).&lt;br /&gt;
* subject: Brief title of the notification.&lt;br /&gt;
* description: Detailed message of the notification.&lt;br /&gt;
* expiration_date: The date when the notification should expire.&lt;br /&gt;
* is_active: Boolean flag to mark if the notification is active or inactive.&lt;br /&gt;
* is_unread: Boolean to mark if a notification is unread (default to true for new notifications).&lt;br /&gt;
&lt;br /&gt;
2. Associations:&lt;br /&gt;
&lt;br /&gt;
* Define associations between Notification, User, and Course models.&lt;br /&gt;
* User Association: Each notification should have a creator (e.g., a teaching assistant or instructor).&lt;br /&gt;
* Course Association: Each notification should be linked to a course, and the enrolled students should be able to view relevant notifications.&lt;br /&gt;
&lt;br /&gt;
3. Relationships:&lt;br /&gt;
&lt;br /&gt;
* One-to-Many: Course to Notification, as each course can have multiple notifications.&lt;br /&gt;
* One-to-Many: User (creator) to Notification, as a user can create multiple notifications.&lt;br /&gt;
* Many-to-Many (indirect): User to Notification via course enrollment, as multiple students can view a notification if they are enrolled in the course associated with the notification.&lt;br /&gt;
&lt;br /&gt;
==Schema==&lt;br /&gt;
[[File:Schema2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
===Associations===&lt;br /&gt;
&lt;br /&gt;
'''Notification'''&lt;br /&gt;
&lt;br /&gt;
* belongs_to :user - Links the notification to its creator (TA, instructor).&lt;br /&gt;
&lt;br /&gt;
* belongs_to :course - Links the notification to a course.&lt;br /&gt;
&lt;br /&gt;
'''User'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Users (instructors, TAs) can create multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :viewable_notifications, through: :courses - Students can view notifications for courses they are enrolled in.&lt;br /&gt;
&lt;br /&gt;
'''Course'''&lt;br /&gt;
&lt;br /&gt;
* has_many :notifications - Each course can have multiple notifications.&lt;br /&gt;
&lt;br /&gt;
* has_many :students, through: :enrollments - Defines which students are associated with the course.&lt;br /&gt;
&lt;br /&gt;
==UML Diagram==&lt;br /&gt;
[[File:UML notification2.PNG| center]]&lt;br /&gt;
&lt;br /&gt;
''' Relationship Explanation''' &lt;br /&gt;
&lt;br /&gt;
* User to Notification: A User (e.g., TA, instructor) can create multiple notifications.&lt;br /&gt;
* Course to Notification: Each Course can have multiple notifications associated with it.&lt;br /&gt;
* User (Student) to Notification (Viewer): Through Course enrollment, students can access notifications related to their courses.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
&amp;lt;b&amp;gt;NotificationController Implementation&amp;lt;/b&amp;gt;: Following are the controller methods:&lt;br /&gt;
&lt;br /&gt;
1. create:&lt;br /&gt;
&lt;br /&gt;
* Description: This method is responsible for creating a new notification. It validates the incoming data to ensure that all required fields are present and correctly formatted. Only authorized users (instructors or TAs) can create notifications. Upon successful creation, the method associates the notification with the specified course and user (creator).&lt;br /&gt;
* API Endpoint: POST /notifications&lt;br /&gt;
* Parameters:&lt;br /&gt;
** subject (required): The title of the notification that briefly describes its purpose (limited to 255 characters).&lt;br /&gt;
** description (optional): Detailed content of the notification.&lt;br /&gt;
** expiration_date (optional): The date until which the notification remains valid. Defaults to no expiration.&lt;br /&gt;
** is_active (optional): A boolean flag indicating if the notification is active (default is true).&lt;br /&gt;
** course_id (required): The course associated with the notification.&lt;br /&gt;
* Authorization: Ensures that only users with roles of TA or instructor can create a notification.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the newly created notification with a 201 status.&lt;br /&gt;
** Error: Returns validation errors (e.g., missing fields, invalid data) with a 422 status.&lt;br /&gt;
&lt;br /&gt;
2. index:&lt;br /&gt;
&lt;br /&gt;
* Description: The index method retrieves a list of notifications based on specific filters, such as active status, unread status, or course association. This endpoint ensures that students only see notifications related to the courses they are enrolled in. It supports querying with multiple optional parameters for flexibility.&lt;br /&gt;
* API Endpoint: GET /notifications&lt;br /&gt;
* Parameters: Query parameters (optional):&lt;br /&gt;
** is_active: Filter notifications by their active status.&lt;br /&gt;
** is_unread: Retrieve only unread notifications for the current user.&lt;br /&gt;
** course_id: Fetch notifications specific to a course.&lt;br /&gt;
* Authorization: Students can only access notifications for courses they are enrolled in. Instructors and TAs can view all notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns an array of filtered notifications with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
3. show:&lt;br /&gt;
&lt;br /&gt;
* Description: This method retrieves the details of a specific notification identified by its unique ID. It ensures that the current user is authorized to view the notification (e.g., enrolled in the course or the creator of the notification).&lt;br /&gt;
* API Endpoint: GET /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be retrieved.&lt;br /&gt;
* Authorization: Students can view notifications for courses they are enrolled in. Instructors and TAs can view notifications they have created.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the notification details with a 200 status.&lt;br /&gt;
** Error: Returns a 404 status if the notification is not found or the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
4. update:&lt;br /&gt;
&lt;br /&gt;
* Description: This method allows the creator of a notification (TA or instructor) to update its details. It validates the incoming data and ensures that the user is authorized to make changes.&lt;br /&gt;
* API Endpoint: PUT /notifications/:id&lt;br /&gt;
* Parameters: Fields that can be updated include subject, description, expiration_date, and is_active.&lt;br /&gt;
* Authorization: Only the creator of the notification can update it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if the user does not have the required permissions.&lt;br /&gt;
&lt;br /&gt;
5. destroy:&lt;br /&gt;
&lt;br /&gt;
* Description: This method deletes a specific notification. Only the user who created the notification can perform this action. The method ensures that no unauthorized users can delete notifications.&lt;br /&gt;
* API Endpoint: DELETE /notifications/:id&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be deleted.&lt;br /&gt;
* Authorization: Only the creator of the notification can delete it.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns a 204 status with no content upon successful deletion.&lt;br /&gt;
** Error: Returns a 403 status if the user is unauthorized.&lt;br /&gt;
&lt;br /&gt;
6. toggle_notification_visibility:&lt;br /&gt;
&lt;br /&gt;
* Description: This method toggles the is_active status of a notification. For example, a TA or instructor can deactivate a notification that is no longer relevant. The method ensures that only the creator of the notification can perform this action.&lt;br /&gt;
* API Endpoint: PATCH /notifications/:id/toggle&lt;br /&gt;
* Parameters:&lt;br /&gt;
** id: The unique identifier of the notification to be toggled.&lt;br /&gt;
* Authorization: Only the creator of the notification can toggle its visibility.&lt;br /&gt;
* Response:&lt;br /&gt;
** Success: Returns the updated notification status with a 200 status.&lt;br /&gt;
** Error: Returns a 403 status if unauthorized.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Model Implementation&amp;lt;/b&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
1. Notification model:&lt;br /&gt;
&lt;br /&gt;
* Description: The Notification model represents a single notification. It includes all attributes, validations, and associations necessary for managing notifications.&lt;br /&gt;
* Attributes:&lt;br /&gt;
** subject: The title of the notification (required, max length: 255).&lt;br /&gt;
** description: The detailed content of the notification.&lt;br /&gt;
** expiration_date: The date when the notification should expire (validated to be in the future).&lt;br /&gt;
** is_active: Indicates whether the notification is active (default: true).&lt;br /&gt;
** is_unread: Marks if a notification is unread (default: true).&lt;br /&gt;
** course_id: Links the notification to a course.&lt;br /&gt;
** user_id: Links the notification to its creator.&lt;br /&gt;
* Associations:&lt;br /&gt;
** belongs_to :course&lt;br /&gt;
** belongs_to :user&lt;br /&gt;
* Validations:&lt;br /&gt;
** Ensures the presence of subject, course_id, and user_id.&lt;br /&gt;
** Validates expiration_date to ensure it is not in the past.&lt;br /&gt;
* Scopes:&lt;br /&gt;
** active: Filters notifications that are active.&lt;br /&gt;
** unread: Filters unread notifications for a user.&lt;br /&gt;
&lt;br /&gt;
2. User Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications (creator role).&lt;br /&gt;
** has_many :viewable_notifications, through: :courses (student role).&lt;br /&gt;
&lt;br /&gt;
3. Course Model:&lt;br /&gt;
&lt;br /&gt;
* Associations:&lt;br /&gt;
** has_many :notifications.&lt;br /&gt;
** has_many :students, through: :enrollments.&lt;br /&gt;
&lt;br /&gt;
== Endpoints for Notification Management ==&lt;br /&gt;
&lt;br /&gt;
Endpoints for Creating, Reading, Updating, and Deleting (CRUD) Notifications&lt;br /&gt;
&lt;br /&gt;
1. POST /notifications - Create a new notification.&lt;br /&gt;
&lt;br /&gt;
2. GET /notifications - Get a list of notifications (with optional filters, such as is_active or is_unread).&lt;br /&gt;
&lt;br /&gt;
3. GET /notifications/ - View details of a specific notification.&lt;br /&gt;
&lt;br /&gt;
4. PUT /notifications/ - Update a specific notification.&lt;br /&gt;
&lt;br /&gt;
5. DELETE /notifications/ - Delete a specific notification.&lt;br /&gt;
&lt;br /&gt;
=Design Pattern=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
&lt;br /&gt;
1. Model Tests:&lt;br /&gt;
&lt;br /&gt;
* Validate presence and format of subject and description.&lt;br /&gt;
* Test is_active and is_unread default values.&lt;br /&gt;
&lt;br /&gt;
2. Controller Tests:&lt;br /&gt;
&lt;br /&gt;
* Ensure proper creation, update, and deletion of notifications.&lt;br /&gt;
* Test that only authorized users can manage notifications.&lt;br /&gt;
&lt;br /&gt;
3. Integration Tests:&lt;br /&gt;
&lt;br /&gt;
* Test access control to verify that only eligible users can view or manage notifications based on role and course association.&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
* '''Aditi Killedar''' akilled@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' &lt;br /&gt;
* '''Pull Request:'''&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158345</id>
		<title>CSC/ECE 517 Fall 2024 - E2465. UI for Institutions and Notification</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158345"/>
		<updated>2024-10-30T02:51:50Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=About Expertiza=&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza], an open-source project built on Ruby on Rails, serves as a versatile learning management platform, enabling instructors to design and customize assignments. It facilitates collaborative learning by allowing students to select topics, form teams, and participate in peer reviews. Recently, the platform has expanded to incorporate modern frontend technologies, with components being refactored to use React.js and Typescript. This upgrade enhances the user experience, making the interface more interactive and responsive while supporting submissions in multiple formats, including URLs and wiki pages, for seamless review and evaluation.&lt;br /&gt;
&lt;br /&gt;
=Issues with previous Functionality=&lt;br /&gt;
* The prior implementation effectively created user interfaces for managing roles and institutions but missed certain critical specifications.&lt;br /&gt;
* The project was not merged due to unnecessary dynamic role creation; only administrators required the ability to add roles, so this feature was removed to simplify the design.&lt;br /&gt;
* The institution management interface lacked proper authorization, allowing all users access to manage institutions, which conflicted with intended role-based permissions.&lt;br /&gt;
&lt;br /&gt;
=Design Goals=&lt;br /&gt;
* &amp;lt;b&amp;gt;Modernize the Frontend:&amp;lt;/b&amp;gt; Re-implement the existing Institutions UI from Ruby on Rails to TypeScript and ReactJS for improved modularity, performance, and maintainability.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Authorization-Optimized UIs:&amp;lt;/b&amp;gt; Ensure role-based access by allowing only designated roles (e.g., TAs, Instructors) to manage specific functionalities in Institutions and Notifications.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Enhanced Notifications Feature:&amp;lt;/b&amp;gt; Introduce a robust notification management system that enables course-specific notifications creation for higher roles and displays relevant notifications to enrolled students.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Toggle and Filter Options:&amp;lt;/b&amp;gt; Implement a toggle for notifications to control active/inactive status and filter notifications for students to display only active, course-relevant alerts.&lt;br /&gt;
&lt;br /&gt;
=Implementation=&lt;br /&gt;
&lt;br /&gt;
=== Enhanced the Manage Institutions page UI ===&lt;br /&gt;
&lt;br /&gt;
Improved the layout and styling of the Manage Institutions page to provide a more user-friendly interface. Adjusted table centering, optimized spacing, and updated visual elements for better alignment and readability.&lt;br /&gt;
[[File:Manage institutions.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added authorization for Institutions [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/0eb2a19b2aa2454f4e5e51b3a02afd28ec79e63c commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented role-based access control to ensure only users with Instructor or higher roles can manage institutions, aligning permissions with user roles and preventing unauthorized access.&lt;br /&gt;
[[File: Authentication for institution.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Manage Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/de6b0d635cc1a0446928dbe7c838be3ad913f73d commit]===&lt;br /&gt;
&lt;br /&gt;
Developed a dedicated page where authorized users, such as TAs and Instructors, can create, edit, and delete course-specific notifications to streamline communication and course updates.&lt;br /&gt;
[[File:Manage notifications.PNG|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking create button. the Close/ Create Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - create.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking edit button for an existing notification. the Close/ Update Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - update.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking delete button. the Delete button will redirect to the Manage Notifications page and dispatch an alert message on top of the page that the notification was deleted successfully.&lt;br /&gt;
[[File:Manage notifications - delete.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added My Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/c998ced0962c1d786d5e137c638f9cf051488e20 commit]===&lt;br /&gt;
&lt;br /&gt;
Created a page for students to view relevant, active notifications for courses they are enrolled in, ensuring they receive timely updates on assignments, exams, and other course events.&lt;br /&gt;
[[File:My notifications.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Toggle Notification Feature [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/d341cdfea89b85a24fb5c9be4340981b46bccba5 commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented a toggle option for authorized users to activate or deactivate notifications, allowing control over the visibility of notifications for students based on course requirements.&lt;br /&gt;
[[File:Toggle notifications.PNG|center|300px]]&lt;br /&gt;
&lt;br /&gt;
===Added Notification Badge [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/a66f55a3907c6bf969a2b1751624cf81ab353583 commit]===&lt;br /&gt;
&lt;br /&gt;
Introduced a notification badge on the &amp;quot;My Notifications&amp;quot; menu item, displaying the count of new or unread notifications to keep users informed of recent updates at a glance.&lt;br /&gt;
[[File:Notification badge.PNG|center|600px]]&lt;br /&gt;
&lt;br /&gt;
===Added Alert on Home Page===&lt;br /&gt;
&lt;br /&gt;
Implemented an alert on the home page to notify users of any unread notifications upon login, ensuring important updates are immediately visible.&lt;br /&gt;
[[File:Notification Alert.PNG|center|900px]]&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
Added mock data for verifying the pages are rendered as expected. There is currently no backend implemented, so the tests does not involve calling relevant API endpoints; this will be considered as future work.&lt;br /&gt;
[[File:mock data.png|center|800px]]&lt;br /&gt;
Following is the video demonstrating the UI workflows. Since this is a UI project, the functionality is tested manually.&lt;br /&gt;
* '''Test Video Link:'''&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' https://github.com/SoubarnicaSuresh/reimplementation-front-end&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/reimplementation-front-end/pull/67&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158328</id>
		<title>CSC/ECE 517 Fall 2024 - E2465. UI for Institutions and Notification</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158328"/>
		<updated>2024-10-30T02:49:34Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=About Expertiza=&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza], an open-source project built on Ruby on Rails, serves as a versatile learning management platform, enabling instructors to design and customize assignments. It facilitates collaborative learning by allowing students to select topics, form teams, and participate in peer reviews. Recently, the platform has expanded to incorporate modern frontend technologies, with components being refactored to use React.js and Typescript. This upgrade enhances the user experience, making the interface more interactive and responsive while supporting submissions in multiple formats, including URLs and wiki pages, for seamless review and evaluation.&lt;br /&gt;
&lt;br /&gt;
=Issues with previous Functionality=&lt;br /&gt;
* The prior implementation effectively created user interfaces for managing roles and institutions but missed certain critical specifications.&lt;br /&gt;
* The project was not merged due to unnecessary dynamic role creation; only administrators required the ability to add roles, so this feature was removed to simplify the design.&lt;br /&gt;
* The institution management interface lacked proper authorization, allowing all users access to manage institutions, which conflicted with intended role-based permissions.&lt;br /&gt;
&lt;br /&gt;
=Design Goals=&lt;br /&gt;
* &amp;lt;b&amp;gt;Modernize the Frontend:&amp;lt;/b&amp;gt; Re-implement the existing Institutions UI from Ruby on Rails to TypeScript and ReactJS for improved modularity, performance, and maintainability.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Authorization-Optimized UIs:&amp;lt;/b&amp;gt; Ensure role-based access by allowing only designated roles (e.g., TAs, Instructors) to manage specific functionalities in Institutions and Notifications.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Enhanced Notifications Feature:&amp;lt;/b&amp;gt; Introduce a robust notification management system that enables course-specific notifications creation for higher roles and displays relevant notifications to enrolled students.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Toggle and Filter Options:&amp;lt;/b&amp;gt; Implement a toggle for notifications to control active/inactive status and filter notifications for students to display only active, course-relevant alerts.&lt;br /&gt;
&lt;br /&gt;
=Implementation=&lt;br /&gt;
&lt;br /&gt;
=== Enhanced the Manage Institutions page UI ===&lt;br /&gt;
&lt;br /&gt;
Improved the layout and styling of the Manage Institutions page to provide a more user-friendly interface. Adjusted table centering, optimized spacing, and updated visual elements for better alignment and readability.&lt;br /&gt;
[[File:Manage institutions.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added authorization for Institutions [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/0eb2a19b2aa2454f4e5e51b3a02afd28ec79e63c commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented role-based access control to ensure only users with Instructor or higher roles can manage institutions, aligning permissions with user roles and preventing unauthorized access.&lt;br /&gt;
[[File: Authentication for institution.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Manage Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/de6b0d635cc1a0446928dbe7c838be3ad913f73d commit]===&lt;br /&gt;
&lt;br /&gt;
Developed a dedicated page where authorized users, such as TAs and Instructors, can create, edit, and delete course-specific notifications to streamline communication and course updates.&lt;br /&gt;
[[File:Manage notifications.PNG|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking create button. the Close/ Create Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - create.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking edit button for an existing notification. the Close/ Update Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - update.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking delete button. the Delete button will redirect to the Manage Notifications page and dispatch an alert message on top of the page that the notification was deleted successfully.&lt;br /&gt;
[[File:Manage notifications - delete.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added My Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/c998ced0962c1d786d5e137c638f9cf051488e20 commit]===&lt;br /&gt;
&lt;br /&gt;
Created a page for students to view relevant, active notifications for courses they are enrolled in, ensuring they receive timely updates on assignments, exams, and other course events.&lt;br /&gt;
[[File:My notifications.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Toggle Notification Feature [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/d341cdfea89b85a24fb5c9be4340981b46bccba5 commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented a toggle option for authorized users to activate or deactivate notifications, allowing control over the visibility of notifications for students based on course requirements.&lt;br /&gt;
[[File:Toggle notifications.PNG|center|300px]]&lt;br /&gt;
&lt;br /&gt;
===Added Notification Badge [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/a66f55a3907c6bf969a2b1751624cf81ab353583 commit]===&lt;br /&gt;
&lt;br /&gt;
Introduced a notification badge on the &amp;quot;My Notifications&amp;quot; menu item, displaying the count of new or unread notifications to keep users informed of recent updates at a glance.&lt;br /&gt;
[[File:Notification badge.PNG|center|600px]]&lt;br /&gt;
&lt;br /&gt;
===Added Alert on Home Page===&lt;br /&gt;
&lt;br /&gt;
Implemented an alert on the home page to notify users of any unread notifications upon login, ensuring important updates are immediately visible.&lt;br /&gt;
[[File:Notification Alert.PNG|center|900px]]&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
Added mock data for verifying the pages are rendered as expected. There is currently no backend implemented, so the tests does not involve calling relevant API endpoints; this will be considered as future work.&lt;br /&gt;
[[File:mock data.png|center|800px]]&lt;br /&gt;
Below is the video demonstrating the UI workflows:&lt;br /&gt;
* '''Test Video Link:'''&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' https://github.com/SoubarnicaSuresh/reimplementation-front-end&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/reimplementation-front-end/pull/67&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158321</id>
		<title>CSC/ECE 517 Fall 2024 - E2465. UI for Institutions and Notification</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158321"/>
		<updated>2024-10-30T02:48:42Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=About Expertiza=&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza], an open-source project built on Ruby on Rails, serves as a versatile learning management platform, enabling instructors to design and customize assignments. It facilitates collaborative learning by allowing students to select topics, form teams, and participate in peer reviews. Recently, the platform has expanded to incorporate modern frontend technologies, with components being refactored to use React.js and Typescript. This upgrade enhances the user experience, making the interface more interactive and responsive while supporting submissions in multiple formats, including URLs and wiki pages, for seamless review and evaluation.&lt;br /&gt;
&lt;br /&gt;
=Issues with previous Functionality=&lt;br /&gt;
* The prior implementation effectively created user interfaces for managing roles and institutions but missed certain critical specifications.&lt;br /&gt;
* The project was not merged due to unnecessary dynamic role creation; only administrators required the ability to add roles, so this feature was removed to simplify the design.&lt;br /&gt;
* The institution management interface lacked proper authorization, allowing all users access to manage institutions, which conflicted with intended role-based permissions.&lt;br /&gt;
&lt;br /&gt;
=Design Goals=&lt;br /&gt;
* &amp;lt;b&amp;gt;Modernize the Frontend:&amp;lt;/b&amp;gt; Re-implement the existing Institutions UI from Ruby on Rails to TypeScript and ReactJS for improved modularity, performance, and maintainability.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Authorization-Optimized UIs:&amp;lt;/b&amp;gt; Ensure role-based access by allowing only designated roles (e.g., TAs, Instructors) to manage specific functionalities in Institutions and Notifications.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Enhanced Notifications Feature:&amp;lt;/b&amp;gt; Introduce a robust notification management system that enables course-specific notifications creation for higher roles and displays relevant notifications to enrolled students.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Toggle and Filter Options:&amp;lt;/b&amp;gt; Implement a toggle for notifications to control active/inactive status and filter notifications for students to display only active, course-relevant alerts.&lt;br /&gt;
&lt;br /&gt;
=Implementation=&lt;br /&gt;
&lt;br /&gt;
=== Enhanced the Manage Institutions page UI ===&lt;br /&gt;
&lt;br /&gt;
Improved the layout and styling of the Manage Institutions page to provide a more user-friendly interface. Adjusted table centering, optimized spacing, and updated visual elements for better alignment and readability.&lt;br /&gt;
[[File:Manage institutions.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added authorization for Institutions [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/0eb2a19b2aa2454f4e5e51b3a02afd28ec79e63c commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented role-based access control to ensure only users with Instructor or higher roles can manage institutions, aligning permissions with user roles and preventing unauthorized access.&lt;br /&gt;
[[File: Authentication for institution.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Manage Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/de6b0d635cc1a0446928dbe7c838be3ad913f73d commit]===&lt;br /&gt;
&lt;br /&gt;
Developed a dedicated page where authorized users, such as TAs and Instructors, can create, edit, and delete course-specific notifications to streamline communication and course updates.&lt;br /&gt;
[[File:Manage notifications.PNG|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking create button. the Close/ Create Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - create.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking edit button for an existing notification. the Close/ Update Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - update.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking delete button. the Delete button will redirect to the Manage Notifications page and dispatch an alert message on top of the page that the notification was deleted successfully.&lt;br /&gt;
[[File:Manage notifications - delete.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added My Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/c998ced0962c1d786d5e137c638f9cf051488e20 commit]===&lt;br /&gt;
&lt;br /&gt;
Created a page for students to view relevant, active notifications for courses they are enrolled in, ensuring they receive timely updates on assignments, exams, and other course events.&lt;br /&gt;
[[File:My notifications.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Toggle Notification Feature [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/d341cdfea89b85a24fb5c9be4340981b46bccba5 commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented a toggle option for authorized users to activate or deactivate notifications, allowing control over the visibility of notifications for students based on course requirements.&lt;br /&gt;
[[File:Toggle notifications.PNG|center|300px]]&lt;br /&gt;
&lt;br /&gt;
===Added Notification Badge [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/a66f55a3907c6bf969a2b1751624cf81ab353583 commit]===&lt;br /&gt;
&lt;br /&gt;
Introduced a notification badge on the &amp;quot;My Notifications&amp;quot; menu item, displaying the count of new or unread notifications to keep users informed of recent updates at a glance.&lt;br /&gt;
[[File:Notification badge.PNG|center|600px]]&lt;br /&gt;
&lt;br /&gt;
===Added Alert on Home Page===&lt;br /&gt;
&lt;br /&gt;
Implemented an alert on the home page to notify users of any unread notifications upon login, ensuring important updates are immediately visible.&lt;br /&gt;
[[File:Notification Alert.PNG|center|900px]]&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
Added mock data for verifying the pages are rendered as expected. There is currently no backend implemented, so the tests does not involve calling relevant API endpoints; this will be considered as future work.&lt;br /&gt;
[[File:mock data.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' https://github.com/SoubarnicaSuresh/reimplementation-front-end&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/reimplementation-front-end/pull/67&lt;br /&gt;
* '''Test Video Link:'''&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158318</id>
		<title>CSC/ECE 517 Fall 2024 - E2465. UI for Institutions and Notification</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158318"/>
		<updated>2024-10-30T02:48:04Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: /* Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=About Expertiza=&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza], an open-source project built on Ruby on Rails, serves as a versatile learning management platform, enabling instructors to design and customize assignments. It facilitates collaborative learning by allowing students to select topics, form teams, and participate in peer reviews. Recently, the platform has expanded to incorporate modern frontend technologies, with components being refactored to use React.js and Typescript. This upgrade enhances the user experience, making the interface more interactive and responsive while supporting submissions in multiple formats, including URLs and wiki pages, for seamless review and evaluation.&lt;br /&gt;
&lt;br /&gt;
=Issues with previous Functionality=&lt;br /&gt;
* The prior implementation effectively created user interfaces for managing roles and institutions but missed certain critical specifications.&lt;br /&gt;
* The project was not merged due to unnecessary dynamic role creation; only administrators required the ability to add roles, so this feature was removed to simplify the design.&lt;br /&gt;
* The institution management interface lacked proper authorization, allowing all users access to manage institutions, which conflicted with intended role-based permissions.&lt;br /&gt;
&lt;br /&gt;
=Design Goals=&lt;br /&gt;
* &amp;lt;b&amp;gt;Modernize the Frontend:&amp;lt;/b&amp;gt; Re-implement the existing Institutions UI from Ruby on Rails to TypeScript and ReactJS for improved modularity, performance, and maintainability.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Authorization-Optimized UIs:&amp;lt;/b&amp;gt; Ensure role-based access by allowing only designated roles (e.g., TAs, Instructors) to manage specific functionalities in Institutions and Notifications.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Enhanced Notifications Feature:&amp;lt;/b&amp;gt; Introduce a robust notification management system that enables course-specific notifications creation for higher roles and displays relevant notifications to enrolled students.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Toggle and Filter Options:&amp;lt;/b&amp;gt; Implement a toggle for notifications to control active/inactive status and filter notifications for students to display only active, course-relevant alerts.&lt;br /&gt;
&lt;br /&gt;
=Implementation=&lt;br /&gt;
&lt;br /&gt;
=== Enhanced the Manage Institutions page UI ===&lt;br /&gt;
&lt;br /&gt;
Improved the layout and styling of the Manage Institutions page to provide a more user-friendly interface. Adjusted table centering, optimized spacing, and updated visual elements for better alignment and readability.&lt;br /&gt;
[[File:Manage institutions.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added authorization for Institutions [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/0eb2a19b2aa2454f4e5e51b3a02afd28ec79e63c commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented role-based access control to ensure only users with Instructor or higher roles can manage institutions, aligning permissions with user roles and preventing unauthorized access.&lt;br /&gt;
[[File: Authentication for institution.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Manage Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/de6b0d635cc1a0446928dbe7c838be3ad913f73d commit]===&lt;br /&gt;
&lt;br /&gt;
Developed a dedicated page where authorized users, such as TAs and Instructors, can create, edit, and delete course-specific notifications to streamline communication and course updates.&lt;br /&gt;
[[File:Manage notifications.PNG|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking create button. the Close/ Create Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - create.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking edit button for an existing notification. the Close/ Update Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - update.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking delete button. the Delete button will redirect to the Manage Notifications page and dispatch an alert message on top of the page that the notification was deleted successfully.&lt;br /&gt;
[[File:Manage notifications - delete.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added My Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/c998ced0962c1d786d5e137c638f9cf051488e20 commit]===&lt;br /&gt;
&lt;br /&gt;
Created a page for students to view relevant, active notifications for courses they are enrolled in, ensuring they receive timely updates on assignments, exams, and other course events.&lt;br /&gt;
[[File:My notifications.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Toggle Notification Feature [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/d341cdfea89b85a24fb5c9be4340981b46bccba5 commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented a toggle option for authorized users to activate or deactivate notifications, allowing control over the visibility of notifications for students based on course requirements.&lt;br /&gt;
[[File:Toggle notifications.PNG|center|300px]]&lt;br /&gt;
&lt;br /&gt;
===Added Notification Badge [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/a66f55a3907c6bf969a2b1751624cf81ab353583 commit]===&lt;br /&gt;
&lt;br /&gt;
Introduced a notification badge on the &amp;quot;My Notifications&amp;quot; menu item, displaying the count of new or unread notifications to keep users informed of recent updates at a glance.&lt;br /&gt;
[[File:Notification badge.PNG|center|600px]]&lt;br /&gt;
&lt;br /&gt;
===Added Alert on Home Page===&lt;br /&gt;
&lt;br /&gt;
Implemented an alert on the home page to notify users of any unread notifications upon login, ensuring important updates are immediately visible.&lt;br /&gt;
[[File:Notification Alert.PNG|center|900px]]&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
Added mock data for verifying the pages are rendered as expected. There is currently no backend implemented, so the tests does not involve calling relevant API endpoints; this will be considered as future work.&lt;br /&gt;
[[File:mock data.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' https://github.com/SoubarnicaSuresh/reimplementation-front-end&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/reimplementation-front-end/pull/67&lt;br /&gt;
* '''Test Video Link:'''&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Mock_data.png&amp;diff=158313</id>
		<title>File:Mock data.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Mock_data.png&amp;diff=158313"/>
		<updated>2024-10-30T02:47:33Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158310</id>
		<title>CSC/ECE 517 Fall 2024 - E2465. UI for Institutions and Notification</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158310"/>
		<updated>2024-10-30T02:47:12Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=About Expertiza=&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza], an open-source project built on Ruby on Rails, serves as a versatile learning management platform, enabling instructors to design and customize assignments. It facilitates collaborative learning by allowing students to select topics, form teams, and participate in peer reviews. Recently, the platform has expanded to incorporate modern frontend technologies, with components being refactored to use React.js and Typescript. This upgrade enhances the user experience, making the interface more interactive and responsive while supporting submissions in multiple formats, including URLs and wiki pages, for seamless review and evaluation.&lt;br /&gt;
&lt;br /&gt;
=Issues with previous Functionality=&lt;br /&gt;
* The prior implementation effectively created user interfaces for managing roles and institutions but missed certain critical specifications.&lt;br /&gt;
* The project was not merged due to unnecessary dynamic role creation; only administrators required the ability to add roles, so this feature was removed to simplify the design.&lt;br /&gt;
* The institution management interface lacked proper authorization, allowing all users access to manage institutions, which conflicted with intended role-based permissions.&lt;br /&gt;
&lt;br /&gt;
=Design Goals=&lt;br /&gt;
* &amp;lt;b&amp;gt;Modernize the Frontend:&amp;lt;/b&amp;gt; Re-implement the existing Institutions UI from Ruby on Rails to TypeScript and ReactJS for improved modularity, performance, and maintainability.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Authorization-Optimized UIs:&amp;lt;/b&amp;gt; Ensure role-based access by allowing only designated roles (e.g., TAs, Instructors) to manage specific functionalities in Institutions and Notifications.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Enhanced Notifications Feature:&amp;lt;/b&amp;gt; Introduce a robust notification management system that enables course-specific notifications creation for higher roles and displays relevant notifications to enrolled students.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Toggle and Filter Options:&amp;lt;/b&amp;gt; Implement a toggle for notifications to control active/inactive status and filter notifications for students to display only active, course-relevant alerts.&lt;br /&gt;
&lt;br /&gt;
=Implementation=&lt;br /&gt;
&lt;br /&gt;
=== Enhanced the Manage Institutions page UI ===&lt;br /&gt;
&lt;br /&gt;
Improved the layout and styling of the Manage Institutions page to provide a more user-friendly interface. Adjusted table centering, optimized spacing, and updated visual elements for better alignment and readability.&lt;br /&gt;
[[File:Manage institutions.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added authorization for Institutions [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/0eb2a19b2aa2454f4e5e51b3a02afd28ec79e63c commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented role-based access control to ensure only users with Instructor or higher roles can manage institutions, aligning permissions with user roles and preventing unauthorized access.&lt;br /&gt;
[[File: Authentication for institution.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Manage Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/de6b0d635cc1a0446928dbe7c838be3ad913f73d commit]===&lt;br /&gt;
&lt;br /&gt;
Developed a dedicated page where authorized users, such as TAs and Instructors, can create, edit, and delete course-specific notifications to streamline communication and course updates.&lt;br /&gt;
[[File:Manage notifications.PNG|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking create button. the Close/ Create Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - create.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking edit button for an existing notification. the Close/ Update Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - update.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking delete button. the Delete button will redirect to the Manage Notifications page and dispatch an alert message on top of the page that the notification was deleted successfully.&lt;br /&gt;
[[File:Manage notifications - delete.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added My Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/c998ced0962c1d786d5e137c638f9cf051488e20 commit]===&lt;br /&gt;
&lt;br /&gt;
Created a page for students to view relevant, active notifications for courses they are enrolled in, ensuring they receive timely updates on assignments, exams, and other course events.&lt;br /&gt;
[[File:My notifications.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Toggle Notification Feature [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/d341cdfea89b85a24fb5c9be4340981b46bccba5 commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented a toggle option for authorized users to activate or deactivate notifications, allowing control over the visibility of notifications for students based on course requirements.&lt;br /&gt;
[[File:Toggle notifications.PNG|center|300px]]&lt;br /&gt;
&lt;br /&gt;
===Added Notification Badge [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/a66f55a3907c6bf969a2b1751624cf81ab353583 commit]===&lt;br /&gt;
&lt;br /&gt;
Introduced a notification badge on the &amp;quot;My Notifications&amp;quot; menu item, displaying the count of new or unread notifications to keep users informed of recent updates at a glance.&lt;br /&gt;
[[File:Notification badge.PNG|center|600px]]&lt;br /&gt;
&lt;br /&gt;
===Added Alert on Home Page===&lt;br /&gt;
&lt;br /&gt;
Implemented an alert on the home page to notify users of any unread notifications upon login, ensuring important updates are immediately visible.&lt;br /&gt;
[[File:Notification Alert.PNG|center|900px]]&lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
Added mock data for verifying the pages are rendered as expected. There is currently no backend implemented, so the tests does not involve calling relevant API endpoints; this will be considered as future work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' https://github.com/SoubarnicaSuresh/reimplementation-front-end&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/reimplementation-front-end/pull/67&lt;br /&gt;
* '''Test Video Link:'''&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158278</id>
		<title>CSC/ECE 517 Fall 2024 - E2465. UI for Institutions and Notification</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158278"/>
		<updated>2024-10-30T02:39:03Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: /* Relevant Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=About Expertiza=&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza], an open-source project built on Ruby on Rails, serves as a versatile learning management platform, enabling instructors to design and customize assignments. It facilitates collaborative learning by allowing students to select topics, form teams, and participate in peer reviews. Recently, the platform has expanded to incorporate modern frontend technologies, with components being refactored to use React.js and Typescript. This upgrade enhances the user experience, making the interface more interactive and responsive while supporting submissions in multiple formats, including URLs and wiki pages, for seamless review and evaluation.&lt;br /&gt;
&lt;br /&gt;
=Issues with previous Functionality=&lt;br /&gt;
* The prior implementation effectively created user interfaces for managing roles and institutions but missed certain critical specifications.&lt;br /&gt;
* The project was not merged due to unnecessary dynamic role creation; only administrators required the ability to add roles, so this feature was removed to simplify the design.&lt;br /&gt;
* The institution management interface lacked proper authorization, allowing all users access to manage institutions, which conflicted with intended role-based permissions.&lt;br /&gt;
&lt;br /&gt;
=Design Goals=&lt;br /&gt;
* &amp;lt;b&amp;gt;Modernize the Frontend:&amp;lt;/b&amp;gt; Re-implement the existing Institutions UI from Ruby on Rails to TypeScript and ReactJS for improved modularity, performance, and maintainability.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Authorization-Optimized UIs:&amp;lt;/b&amp;gt; Ensure role-based access by allowing only designated roles (e.g., TAs, Instructors) to manage specific functionalities in Institutions and Notifications.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Enhanced Notifications Feature:&amp;lt;/b&amp;gt; Introduce a robust notification management system that enables course-specific notifications creation for higher roles and displays relevant notifications to enrolled students.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Toggle and Filter Options:&amp;lt;/b&amp;gt; Implement a toggle for notifications to control active/inactive status and filter notifications for students to display only active, course-relevant alerts.&lt;br /&gt;
&lt;br /&gt;
=Implementation=&lt;br /&gt;
&lt;br /&gt;
=== Enhanced the Manage Institutions page UI ===&lt;br /&gt;
&lt;br /&gt;
Improved the layout and styling of the Manage Institutions page to provide a more user-friendly interface. Adjusted table centering, optimized spacing, and updated visual elements for better alignment and readability.&lt;br /&gt;
[[File:Manage institutions.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added authorization for Institutions [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/0eb2a19b2aa2454f4e5e51b3a02afd28ec79e63c commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented role-based access control to ensure only users with Instructor or higher roles can manage institutions, aligning permissions with user roles and preventing unauthorized access.&lt;br /&gt;
[[File: Authentication for institution.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Manage Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/de6b0d635cc1a0446928dbe7c838be3ad913f73d commit]===&lt;br /&gt;
&lt;br /&gt;
Developed a dedicated page where authorized users, such as TAs and Instructors, can create, edit, and delete course-specific notifications to streamline communication and course updates.&lt;br /&gt;
[[File:Manage notifications.PNG|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking create button. the Close/ Create Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - create.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking edit button for an existing notification. the Close/ Update Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - update.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking delete button. the Delete button will redirect to the Manage Notifications page and dispatch an alert message on top of the page that the notification was deleted successfully.&lt;br /&gt;
[[File:Manage notifications - delete.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added My Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/c998ced0962c1d786d5e137c638f9cf051488e20 commit]===&lt;br /&gt;
&lt;br /&gt;
Created a page for students to view relevant, active notifications for courses they are enrolled in, ensuring they receive timely updates on assignments, exams, and other course events.&lt;br /&gt;
[[File:My notifications.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Toggle Notification Feature [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/d341cdfea89b85a24fb5c9be4340981b46bccba5 commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented a toggle option for authorized users to activate or deactivate notifications, allowing control over the visibility of notifications for students based on course requirements.&lt;br /&gt;
[[File:Toggle notifications.PNG|center|300px]]&lt;br /&gt;
&lt;br /&gt;
===Added Notification Badge [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/a66f55a3907c6bf969a2b1751624cf81ab353583 commit]===&lt;br /&gt;
&lt;br /&gt;
Introduced a notification badge on the &amp;quot;My Notifications&amp;quot; menu item, displaying the count of new or unread notifications to keep users informed of recent updates at a glance.&lt;br /&gt;
[[File:Notification badge.PNG|center|600px]]&lt;br /&gt;
&lt;br /&gt;
===Added Alert on Home Page===&lt;br /&gt;
&lt;br /&gt;
Implemented an alert on the home page to notify users of any unread notifications upon login, ensuring important updates are immediately visible.&lt;br /&gt;
[[File:Notification Alert.PNG|center|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' https://github.com/SoubarnicaSuresh/reimplementation-front-end&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/reimplementation-front-end/pull/67&lt;br /&gt;
* '''Test Video Link:'''&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158215</id>
		<title>CSC/ECE 517 Fall 2024 - E2465. UI for Institutions and Notification</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158215"/>
		<updated>2024-10-30T02:22:33Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: /* Added Manage Notifications Page commit */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=About Expertiza=&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza], an open-source project built on Ruby on Rails, serves as a versatile learning management platform, enabling instructors to design and customize assignments. It facilitates collaborative learning by allowing students to select topics, form teams, and participate in peer reviews. Recently, the platform has expanded to incorporate modern frontend technologies, with components being refactored to use React.js and Typescript. This upgrade enhances the user experience, making the interface more interactive and responsive while supporting submissions in multiple formats, including URLs and wiki pages, for seamless review and evaluation.&lt;br /&gt;
&lt;br /&gt;
=Issues with previous Functionality=&lt;br /&gt;
* The prior implementation effectively created user interfaces for managing roles and institutions but missed certain critical specifications.&lt;br /&gt;
* The project was not merged due to unnecessary dynamic role creation; only administrators required the ability to add roles, so this feature was removed to simplify the design.&lt;br /&gt;
* The institution management interface lacked proper authorization, allowing all users access to manage institutions, which conflicted with intended role-based permissions.&lt;br /&gt;
&lt;br /&gt;
=Design Goals=&lt;br /&gt;
* &amp;lt;b&amp;gt;Modernize the Frontend:&amp;lt;/b&amp;gt; Re-implement the existing Institutions UI from Ruby on Rails to TypeScript and ReactJS for improved modularity, performance, and maintainability.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Authorization-Optimized UIs:&amp;lt;/b&amp;gt; Ensure role-based access by allowing only designated roles (e.g., TAs, Instructors) to manage specific functionalities in Institutions and Notifications.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Enhanced Notifications Feature:&amp;lt;/b&amp;gt; Introduce a robust notification management system that enables course-specific notifications creation for higher roles and displays relevant notifications to enrolled students.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Toggle and Filter Options:&amp;lt;/b&amp;gt; Implement a toggle for notifications to control active/inactive status and filter notifications for students to display only active, course-relevant alerts.&lt;br /&gt;
&lt;br /&gt;
=Implementation=&lt;br /&gt;
&lt;br /&gt;
=== Enhanced the Manage Institutions page UI ===&lt;br /&gt;
&lt;br /&gt;
Improved the layout and styling of the Manage Institutions page to provide a more user-friendly interface. Adjusted table centering, optimized spacing, and updated visual elements for better alignment and readability.&lt;br /&gt;
[[File:Manage institutions.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added authorization for Institutions [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/0eb2a19b2aa2454f4e5e51b3a02afd28ec79e63c commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented role-based access control to ensure only users with Instructor or higher roles can manage institutions, aligning permissions with user roles and preventing unauthorized access.&lt;br /&gt;
[[File: Authentication for institution.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Manage Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/de6b0d635cc1a0446928dbe7c838be3ad913f73d commit]===&lt;br /&gt;
&lt;br /&gt;
Developed a dedicated page where authorized users, such as TAs and Instructors, can create, edit, and delete course-specific notifications to streamline communication and course updates.&lt;br /&gt;
[[File:Manage notifications.PNG|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking create button. the Close/ Create Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - create.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking edit button for an existing notification. the Close/ Update Notification button will redirect to the Manage Notifications page.&lt;br /&gt;
[[File:Manage notifications - update.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking delete button. the Delete button will redirect to the Manage Notifications page and dispatch an alert message on top of the page that the notification was deleted successfully.&lt;br /&gt;
[[File:Manage notifications - delete.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added My Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/c998ced0962c1d786d5e137c638f9cf051488e20 commit]===&lt;br /&gt;
&lt;br /&gt;
Created a page for students to view relevant, active notifications for courses they are enrolled in, ensuring they receive timely updates on assignments, exams, and other course events.&lt;br /&gt;
[[File:My notifications.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Toggle Notification Feature [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/d341cdfea89b85a24fb5c9be4340981b46bccba5 commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented a toggle option for authorized users to activate or deactivate notifications, allowing control over the visibility of notifications for students based on course requirements.&lt;br /&gt;
[[File:Toggle notifications.PNG|center|300px]]&lt;br /&gt;
&lt;br /&gt;
===Added Notification Badge [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/a66f55a3907c6bf969a2b1751624cf81ab353583 commit]===&lt;br /&gt;
&lt;br /&gt;
Introduced a notification badge on the &amp;quot;My Notifications&amp;quot; menu item, displaying the count of new or unread notifications to keep users informed of recent updates at a glance.&lt;br /&gt;
[[File:Notification badge.PNG|center|600px]]&lt;br /&gt;
&lt;br /&gt;
===Added Alert on Home Page===&lt;br /&gt;
&lt;br /&gt;
Implemented an alert on the home page to notify users of any unread notifications upon login, ensuring important updates are immediately visible.&lt;br /&gt;
[[File:Notification Alert.PNG|center|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' https://github.com/SoubarnicaSuresh/reimplementation-front-end&lt;br /&gt;
* '''Pull Request:''' &lt;br /&gt;
* '''Test Video Link:'''&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158200</id>
		<title>CSC/ECE 517 Fall 2024 - E2465. UI for Institutions and Notification</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2024_-_E2465._UI_for_Institutions_and_Notification&amp;diff=158200"/>
		<updated>2024-10-30T02:18:23Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: /* Added Manage Notifications Page commit */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=About Expertiza=&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza], an open-source project built on Ruby on Rails, serves as a versatile learning management platform, enabling instructors to design and customize assignments. It facilitates collaborative learning by allowing students to select topics, form teams, and participate in peer reviews. Recently, the platform has expanded to incorporate modern frontend technologies, with components being refactored to use React.js and Typescript. This upgrade enhances the user experience, making the interface more interactive and responsive while supporting submissions in multiple formats, including URLs and wiki pages, for seamless review and evaluation.&lt;br /&gt;
&lt;br /&gt;
=Issues with previous Functionality=&lt;br /&gt;
* The prior implementation effectively created user interfaces for managing roles and institutions but missed certain critical specifications.&lt;br /&gt;
* The project was not merged due to unnecessary dynamic role creation; only administrators required the ability to add roles, so this feature was removed to simplify the design.&lt;br /&gt;
* The institution management interface lacked proper authorization, allowing all users access to manage institutions, which conflicted with intended role-based permissions.&lt;br /&gt;
&lt;br /&gt;
=Design Goals=&lt;br /&gt;
* &amp;lt;b&amp;gt;Modernize the Frontend:&amp;lt;/b&amp;gt; Re-implement the existing Institutions UI from Ruby on Rails to TypeScript and ReactJS for improved modularity, performance, and maintainability.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Authorization-Optimized UIs:&amp;lt;/b&amp;gt; Ensure role-based access by allowing only designated roles (e.g., TAs, Instructors) to manage specific functionalities in Institutions and Notifications.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Enhanced Notifications Feature:&amp;lt;/b&amp;gt; Introduce a robust notification management system that enables course-specific notifications creation for higher roles and displays relevant notifications to enrolled students.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Toggle and Filter Options:&amp;lt;/b&amp;gt; Implement a toggle for notifications to control active/inactive status and filter notifications for students to display only active, course-relevant alerts.&lt;br /&gt;
&lt;br /&gt;
=Implementation=&lt;br /&gt;
&lt;br /&gt;
=== Enhanced the Manage Institutions page UI ===&lt;br /&gt;
&lt;br /&gt;
Improved the layout and styling of the Manage Institutions page to provide a more user-friendly interface. Adjusted table centering, optimized spacing, and updated visual elements for better alignment and readability.&lt;br /&gt;
[[File:Manage institutions.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added authorization for Institutions [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/0eb2a19b2aa2454f4e5e51b3a02afd28ec79e63c commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented role-based access control to ensure only users with Instructor or higher roles can manage institutions, aligning permissions with user roles and preventing unauthorized access.&lt;br /&gt;
[[File: Authentication for institution.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Manage Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/de6b0d635cc1a0446928dbe7c838be3ad913f73d commit]===&lt;br /&gt;
&lt;br /&gt;
Developed a dedicated page where authorized users, such as TAs and Instructors, can create, edit, and delete course-specific notifications to streamline communication and course updates.&lt;br /&gt;
[[File:Manage notifications.PNG|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking create button&lt;br /&gt;
[[File:Manage notifications - create.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking edit button for an existing notification&lt;br /&gt;
[[File:Manage notifications - update.png|center|800px]]&lt;br /&gt;
Following pop-up window appears on clicking delete button&lt;br /&gt;
[[File:Manage notifications - delete.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added My Notifications Page [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/c998ced0962c1d786d5e137c638f9cf051488e20 commit]===&lt;br /&gt;
&lt;br /&gt;
Created a page for students to view relevant, active notifications for courses they are enrolled in, ensuring they receive timely updates on assignments, exams, and other course events.&lt;br /&gt;
[[File:My notifications.PNG|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===Added Toggle Notification Feature [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/d341cdfea89b85a24fb5c9be4340981b46bccba5 commit]===&lt;br /&gt;
&lt;br /&gt;
Implemented a toggle option for authorized users to activate or deactivate notifications, allowing control over the visibility of notifications for students based on course requirements.&lt;br /&gt;
[[File:Toggle notifications.PNG|center|300px]]&lt;br /&gt;
&lt;br /&gt;
===Added Notification Badge [https://github.com/SoubarnicaSuresh/reimplementation-front-end/commit/a66f55a3907c6bf969a2b1751624cf81ab353583 commit]===&lt;br /&gt;
&lt;br /&gt;
Introduced a notification badge on the &amp;quot;My Notifications&amp;quot; menu item, displaying the count of new or unread notifications to keep users informed of recent updates at a glance.&lt;br /&gt;
[[File:Notification badge.PNG|center|600px]]&lt;br /&gt;
&lt;br /&gt;
===Added Alert on Home Page===&lt;br /&gt;
&lt;br /&gt;
Implemented an alert on the home page to notify users of any unread notifications upon login, ensuring important updates are immediately visible.&lt;br /&gt;
[[File:Notification Alert.PNG|center|900px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Team=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Mentor&amp;lt;/b&amp;gt; Jay Patel : jhpatel9@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
* '''Vaibhavi Shetty:''' vshetty2@ncsu.edu&lt;br /&gt;
* '''Soubarnica Suresh''' ssomang@ncsu.edu&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Relevant Links=&lt;br /&gt;
* '''Github Repository:''' https://github.com/SoubarnicaSuresh/reimplementation-front-end&lt;br /&gt;
* '''Pull Request:''' &lt;br /&gt;
* '''Test Video Link:'''&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Manage_notifications_-_delete.png&amp;diff=158186</id>
		<title>File:Manage notifications - delete.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Manage_notifications_-_delete.png&amp;diff=158186"/>
		<updated>2024-10-30T02:15:06Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Manage_notifications_-_create.png&amp;diff=158185</id>
		<title>File:Manage notifications - create.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Manage_notifications_-_create.png&amp;diff=158185"/>
		<updated>2024-10-30T02:14:47Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Manage_notifications_-_update.png&amp;diff=158184</id>
		<title>File:Manage notifications - update.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Manage_notifications_-_update.png&amp;diff=158184"/>
		<updated>2024-10-30T02:14:29Z</updated>

		<summary type="html">&lt;p&gt;Ssomang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Ssomang</name></author>
	</entry>
</feed>