Skip to content

Repository files navigation

Learning Management System Service

This implementation uses MySQL for the database, following the relational model outlined below:

LMS-RM

The schema definition can be found in /db/schema.sql.

Database Model Overview

The Course table holds the main course details, while the Module table supports infinite nesting, enabling both simple and complex course structures. Each module is linked to a course and can have a parent module, allowing for a hierarchical structure. The Lesson table stores the lessons within modules, and the Completion table tracks user progress by recording which lessons a user has completed. Foreign key relationships ensure that when a course, module, or lesson is deleted, the associated data is automatically cleaned up to maintain data integrity.

Implementation Details

  • Services: Implemented services for managing courses, modules, lessons, and completions based on the methods defined in the original template's controllers.
  • TypeORM: Used TypeORM to define repositories for the models and applied the necessary decorators based on the logical model.
  • Redis Caching: Integrated Redis to cache GET responses for modules, with a cache expiration of 60 minutes.
  • Tests: Added integration tests for the courses API as requested.

Additionally, I’ve included a .env-template with all the required environment variables for the project and Docker. The values can be based on the defaults for MySQL, Express, and Redis (host redis, port 6379).

I also updated the Docker Compose file to include Redis setup and environment variable configuration.

Running the Project

To run the project, you need Docker and Docker Compose installed. Then, follow these steps:

Before trying to build the services from the docker-compose file, it is neccesary to add the variables FROM .env file

  1. Start Docker:
# MacOS
make

# Windows
docker-compose --env-file .env up -d --build
  1. Install Dependencies:
# MacOS
make install

# Windows
docker-compose exec node npm install
  1. Run the Node Server:
# MacOS
make run

# Windows
docker-compose exec node npm run dev
  1. If desired, can populate the database with example cases, and want to test API
# Windows
docker-compose exec node npx ts-node src/scripts/seedDatabase.ts
  1. Run the Test Suite:
# MacOS
make test

# Windows
docker-compose exec node npm run test

Tests results

LMS-RM

About

Learning Managment System Service

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages