Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ananyo141/propulsionai-interview-assignment


https://github.com/ananyo141/propulsionai-interview-assignment

Last synced: 6 days ago
JSON representation

Awesome Lists containing this project

README

        

#### Objective:
Extend the existing functionality of the CRUD operations and regex-based search by integrating MongoDB to log search queries and user interactions, while PostgreSQL handles the main CRUD operations on item data.

#### Requirements:

1. **Backend (NodeJS + Express):**
- Use PostgreSQL to handle CRUD operations on the items.
- Integrate MongoDB to log each search query along with metadata like the timestamp and user ID (if authentication is implemented).
- Enhance the search functionality in the Express server to interact with both databases appropriately.

2. **Database Setup:**
- **PostgreSQL:** Continue using PostgreSQL for managing the `items` table with CRUD operations.
- **MongoDB:** Set up a MongoDB collection to store search logs. Each log entry should include the search term, the date/time of the search, and optionally the user ID.

3. **Frontend (ReactJS):**
- Maintain the existing UI components for displaying and managing items.
- Update the search functionality to log each search action to the MongoDB database through the Express API.

#### Steps to Follow:

1. **Backend Setup:**
- Modify the `GET /api/items` route to log search details to MongoDB whenever a search is performed. This involves inserting a document into a MongoDB collection each time the search API is hit.
- Ensure proper configuration and connection handling for both PostgreSQL and MongoDB in the Express app.

2. **Database Configuration:**
- Ensure PostgreSQL is configured for item data management with optimized queries for regex searches.
- Set up MongoDB with appropriate indexing on the search logs collection to optimize query performance for logs retrieval or analysis.

3. **Frontend Setup:**
- Adjust the `ItemList` component to handle search logging. Make sure that every search, whether successful or not, triggers a log entry to MongoDB via the backend.

#### Additional Challenges:
- Implement real-time feedback on the frequency of searches for certain items, potentially using MongoDB's aggregation capabilities to summarize recent search activity.
- Provide a dashboard component in React to visualize search trends or log data fetched from MongoDB.

#### Deliverables:
- Source code for the backend with dual database handling.
- Updated React components for item management and search logging.

This task will effectively test a developer's skills in managing multiple databases, handling complex backend logic, and integrating frontend interactions with backend services. It also provides a practical scenario where SQL and NoSQL databases are used together, reflecting a real-world application structure.