Gradebook Backend API Documentation - v0.0.1
    Preparing search index...

    Controller responsible for handling all course-related HTTP requests. Provides endpoints for course management, student enrollment, and grade operations.

    Index

    Constructors

    Methods

    • Adds a grade for a student in a course. Only accessible to users with Teacher role. Protected by JWT authentication.

      Parameters

      • req: any

        The HTTP request containing the authenticated user (teacher)

      • addStudentGradeDto: AddStudentGradeDto

        Contains course ID, student email, and grade value

      Returns Promise<{ date: Date; grade: number; id: number }>

      The newly created grade object

    • Creates a new course. Only accessible to users with Teacher role.

      Parameters

      • createCourseDto: CreateCourseDto

        Contains course title, description, and teacher email

      Returns Promise<Course>

      The newly created course entity

    • Deletes (soft delete) an existing grade for a student. Only accessible to users with Teacher role who own the course. Protected by JWT authentication.

      Parameters

      • req: any

        The HTTP request containing the authenticated user (teacher)

      • dto: DeleteStudentGradeDto

        Contains the grade ID to delete

      Returns Promise<boolean>

      A boolean indicating success

    • Deletes an existing course. Only accessible to users with Teacher role who own the course.

      Parameters

      • destroyCourseDto: DestroyCourseDto

        Contains course title and teacher email

      Returns Promise<{ message: string }>

      A success message upon successful deletion

    • Edits an existing grade for a student. Only accessible to users with Teacher role who own the course. Protected by JWT authentication.

      Parameters

      • req: any

        The HTTP request containing the authenticated user (teacher)

      • dto: EditStudentGradeDto

        Contains grade ID and the new grade value

      Returns Promise<boolean>

      A boolean indicating success

    • Enrolls a student in a course. Only accessible to users with Teacher role.

      Parameters

      • enrollStudentDto: EnrollStudentDto

        Contains course title, student email, and teacher email

      Returns Promise<{ message: string }>

      A success message upon successful enrollment

    • Retrieves all courses in which a specific student is enrolled. Protected by JWT authentication.

      Parameters

      • findCoursesByStudentDto: FindCoursesByStudentDto

        Contains the student's email

      Returns Promise<
          {
              description: string;
              grades: { date: Date; grade: number; id: number }[];
              id: number;
              students: StudentCourse[];
              teacher: {
                  email: string;
                  firstName: string;
                  image: string;
                  lastName: string;
                  role: UserRole;
              };
              title: string;
          }[],
      >

      An array of courses in which the student is enrolled

    • Retrieves all courses taught by a specific teacher. Protected by JWT authentication.

      Parameters

      • findCoursesByTeacherDto: FindCoursesByTeacherDto

        Contains the teacher's email

      Returns Promise<
          {
              description: string;
              id: number;
              students: {
                  email: string;
                  firstName: string;
                  image: string;
                  lastName: string;
                  role: UserRole;
              }[];
              teacher: {
                  email: string;
                  firstName: string;
                  image: string;
                  lastName: string;
                  role: UserRole;
              };
              title: string;
          }[],
      >

      An array of courses taught by the specified teacher

    • Retrieves detailed information about a specific course. Access control is handled in the service based on the user's role. Protected by JWT authentication.

      Parameters

      • req: any

        The HTTP request containing the authenticated user

      • id: number

        The ID of the course to retrieve

      Returns Promise<
          {
              description: string;
              grades: undefined
              | StudentCourseGrade[];
              id: number;
              students:
                  | undefined
                  | {
                      email: string;
                      firstName: string;
                      grades: { date: Date; grade: number; id: number }[];
                      image: string;
                      lastName: string;
                      role: UserRole;
                  }[];
              teacher: {
                  email: string;
                  firstName: string;
                  image: string;
                  lastName: string;
                  role: UserRole;
              };
              title: string;
          },
      >

      Detailed information about the course, including teacher info and conditionally students/grades

    • Retrieves the list of students enrolled in a specific course. Protected by JWT authentication.

      Parameters

      • getStudentsForCourseDto: GetStudentsForCourseDto

        Contains the course title

      Returns Promise<
          {
              email: string;
              firstName: string;
              image: string;
              lastName: string;
              role: UserRole;
          }[],
      >

      An array of students enrolled in the specified course

    • Submits multiple grades for students in a course at once. Only accessible to users with Teacher role who own the course. Protected by JWT authentication.

      Parameters

      • req: any

        The HTTP request containing the authenticated user (teacher)

      • submitGradesDto: SubmitGradesDto

        Contains course ID and an array of student emails with grades

      Returns Promise<{ message: string }>

      A success message upon successful submission