Skip to content

Latest commit

 

History

History
217 lines (178 loc) · 6.17 KB

README.md

File metadata and controls

217 lines (178 loc) · 6.17 KB

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Description

My List Service

This project implements the "My List" feature for an Stage OTT platform, allowing users to manage their personalized list of favorite movies and TV shows.

Table of Contents

Features

  • Add to My List: Add a movie or TV show to the user's list.
  • Remove from My List: Remove a movie or TV show from the user's list.
  • List My Items: Retrieve all items in the user's list with pagination support.

Technologies Used

Installation

  1. Clone the repository:
   $ git clone <repository_url>

   $ cd my-list-service

Install dependencies

$ npm install

Create a .env file in the root directory and add your MongoDB connection string:

$ MONGODB_URI=<your_mongodb_connection_string>

Database Setup

  • Ensure MongoDB is running and accessible.
  • Seed the database with initial data:
$ npm run seed

Running the Application

  • Start the application:
$ npm run start:dev

API Endpoints

  • Add to My List:
  • URL: /my-list/add
  • Method: POST
  • Request Body:
{
  "userId": "user1",
  "itemId": "movie1"
}
  • Response:
{
  "_id": "unique_id",
  "userId": "user1",
  "itemId": "movie1"
}
  • Remove to My List:
  • URL: /my-list/remove
  • Method: DELETE
  • Request Body:
{
  "userId": "user1",
  "itemId": "movie1"
}
  • Response:
{
  "message": "Item removed from list"
}
  • List My Items
  • URL: /my-list/list
  • Method: GET
  • Query Parameters:
  • userId: User ID
  • page: Page number (default: 1)
  • limit: Number of items per page (default: 10)
  • Response:
[
  {
    "_id": "unique_id",
    "userId": "user1",
    "itemId": "movie1"
  }
]

Testing

  • Run the Tests
$ npm run test

Directory Structure

my-list-service/
├── src/
│   ├── app.module.ts
│   ├── main.ts
│   ├── my-list/
│   │   ├── my-list.controller.ts
│   │   ├── my-list.module.ts
│   │   ├── my-list.service.ts
│   ├── schemas/
│   │   ├── mylist.schema.ts
│   │   ├── movie.schema.ts
│   │   ├── tvshow.schema.ts
│   │   ├── user.schema.ts
│   ├── scripts/
│   │   └── seed.ts
├── test/
│   ├── app.e2e-spec.ts
│   ├── jest-e2e.json
├── .env
├── package.json
├── tsconfig.json
└── README.md