Skip to content

SDC-Builder/Shane-Syllabus-Service

Repository files navigation

Syllabus

Coverage Status Build Status

Related Projects

Table of Contents

  1. Usage
  2. Requirements
  3. Development
  4. API

Usage

npm install

Ensure database is running and URL and proxy are correct in ./.env

npm run seed

Requirements

Syllabuses relies on Images and Reviews services for data.

Ensure URL's and ports are correct in ./client/components/initial/state.js

npm run build (as necessary)

Development

Each course has a syllabus. Each syllabus has one or more weeks. Each week has one or more lessons. Each lesson has one or more videos, readings, and exercises.

Component Flow:

-> Syllabus

  • -> Header -> Rating

  • -> Weeks => Week

    • -> WeekTitle
    • => Lesson
      • -> LessonHeader
      • -> LessonTitle
      • -> LessonOverview;
      • -> Videos => Video
      • -> Readings => Reading
      • -> Exercises => Exercise

Installing Dependencies

From within the root directory:

npm install -g webpack
npm install

API

All Routes

Read

GET /api/syllabus/:courseNumber

Returns JSON object. Example response:

{
  "id": 0,
  "weeks": [{
    "weekNumber": 1,
    "lessons": [{
      "hoursToCompleteLesson": 300,
      "lessonTitle": "Lesson Title",
      "lessonDescription": "Description",
      "videos": [{
        "videoIndex": 0,
        "videoTitle": "Video Title",
        "videoLengthMinutes": 60,
        "videoLengthSeconds": 3600
      }],
      "videosLength": 3,
      "readings": [{
        "readingIndex": 0,
        "readingTitle": "Reading Title",
        "readingLengthMinutes": 60
      }],
      "readingsLength": 3,
      "exercises": [{
        "exerciseIndex": 0,
        "exerciseTitle": "Exercise Title",
        "exerciseLengthMinutes": 60
      }],
      "exercisesLength": 3
    }],
    "hoursToCompleteCourse": 300
  }]
}

Create

POST /api/syllabus/

Request body required JSON schema:

{
  id: Number,
  weeks: [{
    weekNumber: Number,
    lessons: [{
      hoursToCompleteLesson: Number,
      lessonTitle: String,
      lessonDescription: String,
      videos: [{
        videoIndex: Number,
        videoTitle: String,
        videoLengthMinutes: Number,
        videoLengthSeconds: Number
      }],
      videosLength: Number,
      readings: [{
        readingIndex: Number,
        readingTitle: String,
        readingLengthMinutes: Number
      }],
      readingsLength: Number,
      exercises: [{
        exerciseIndex: Number,
        exerciseTitle: String,
        exerciseLengthMinutes: Number
      }],
      exercisesLength: Number
    }],
    hoursToCompleteCourse: Number
  }]
}

Update

PUT /api/syllabus/

Request body's id should match the id to be updated. All other fields are optional. When updating a sub-document, ensure all child fields are present. Request body field options:

{
  id: Number,
  weeks: [{
    weekNumber: Number,
    lessons: [{
      hoursToCompleteLesson: Number,
      lessonTitle: String,
      lessonDescription: String,
      videos: [{
        videoIndex: Number,
        videoTitle: String,
        videoLengthMinutes: Number,
        videoLengthSeconds: Number
      }],
      videosLength: Number,
      readings: [{
        readingIndex: Number,
        readingTitle: String,
        readingLengthMinutes: Number
      }],
      readingsLength: Number,
      exercises: [{
        exerciseIndex: Number,
        exerciseTitle: String,
        exerciseLengthMinutes: Number
      }],
      exercisesLength: Number
    }],
    hoursToCompleteCourse: Number
  }]
}

Delete

DELETE /api/syllabus/

Request body's id should match the id to be deleted. Request body:

{
  id: Number,
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages