Interface for LectureModel.

interface LectureModel {
    countAllLecturees(): Promise<number>;
    deleteByLectureId(id: string): Promise<void>;
    fetchAllLectures(): Promise<
        RowDataPacket[]
        | [RowDataPacket[], FieldPacket[]],
    >;
    fetchLecturesByTeacherId(teacherId: number): Promise<RowDataPacket[]>;
    findByLectureIdAndGetAllUserInLinkedCourse(
        lectureid: number,
    ): Promise<RowDataPacket[]>;
    findByLectureIdAndGetAllUserInLinkedCourse(
        lectureid: number,
    ): Promise<RowDataPacket[]>;
    findByTopicId(topicid: number): Promise<Lecture[]>;
    findOpenLecturesBycourseid(
        courseid: number,
    ): Promise<null | RowDataPacket[]>;
    findOpenLecturesByTeacherid(
        teacherid: number,
    ): Promise<null | RowDataPacket[]>;
    getCourseidByLectureid(lectureid: number): Promise<number>;
    getCourseIDByLectureID(lectureid: string): Promise<null | number>;
    getLectureByLectureId(lectureid: number): Promise<null | RowDataPacket[]>;
    getLecturesByCourseId(courseid: number): Promise<null | RowDataPacket[]>;
    getLectureWithCourseAndTopic(
        lectureid: string,
    ): Promise<null | RowDataPacket>;
    getPastLecturesByCourseId(courseid: number): Promise<RowDataPacket[]>;
    getStudentsByLectureId(lectureid: number): Promise<RowDataPacket[]>;
    insertIntoLecture(
        start_date: Date,
        end_date: Date,
        timeofday: string,
        topicid: number,
        courseid: number,
        state: string,
        teacherid: undefined | number,
    ): Promise<unknown>;
    updateLectureState(lectureid: string, state: string): Promise<unknown>;
}

Methods

  • Counts all lectures.

    Returns Promise<number>

    A promise that resolves to the number of lectures.

  • Deletes a lecture by its ID.

    Parameters

    • id: string

      The ID of the lecture.

    Returns Promise<void>

    A promise that resolves when the deletion is complete.

  • Fetches all lectures.

    Returns Promise<RowDataPacket[] | [RowDataPacket[], FieldPacket[]]>

    A promise that resolves to an array of lectures.

  • Fetches all lectures by teacher ID.

    Parameters

    • teacherId: number

    Returns Promise<RowDataPacket[]>

    A promise that resolves to an array of lectures.

  • Finds a lecture by its ID and gets all users in the linked course.

    Parameters

    • lectureid: number

      The ID of the lecture.

    Returns Promise<RowDataPacket[]>

    A promise that resolves to an array of RowDataPacket.

  • Parameters

    • lectureid: number

    Returns Promise<RowDataPacket[]>

  • Finds lectures by topic ID.

    Parameters

    • topicid: number

      The ID of the topic.

    Returns Promise<Lecture[]>

    A promise that resolves to an array of lectures.

  • Finds open lectures by course ID.

    Parameters

    • courseid: number

      The ID of the course.

    Returns Promise<null | RowDataPacket[]>

    A promise that resolves to an array of open lectures for the course, if found.

  • Finds open lectures by teacher ID.

    Parameters

    • teacherid: number

      The ID of the teacher.

    Returns Promise<null | RowDataPacket[]>

    A promise that resolves to an array of open lectures for the teacher, if found.

  • Gets the course ID by lecture ID.

    Parameters

    • lectureid: number

      The ID of the lecture.

    Returns Promise<number>

    A promise that resolves to the ID of the course linked to the lecture.

  • Gets the course ID by lecture ID.

    Parameters

    • lectureid: string

      The ID of the lecture.

    Returns Promise<null | number>

    A promise that resolves to the ID of the course linked to the lecture.

  • Gets a lecture by its ID.

    Parameters

    • lectureid: number

      The ID of the lecture.

    Returns Promise<null | RowDataPacket[]>

    A promise that resolves to the lecture, if found.

  • Gets lectures by course ID.

    Parameters

    • courseid: number

      The ID of the course.

    Returns Promise<null | RowDataPacket[]>

    A promise that resolves to an array of lectures for the course, if found.

  • Gets a lecture with its course and topic.

    Parameters

    • lectureid: string

      The ID of the lecture.

    Returns Promise<null | RowDataPacket>

    A promise that resolves to the lecture with its course and topic, if found.

  • Gets past lectures by course ID.

    Parameters

    • courseid: number

      The ID of the course.

    Returns Promise<RowDataPacket[]>

    A promise that resolves to an array of past lectures for the course, if found.

  • Gets students by lecture ID.

    Parameters

    • lectureid: number

      The ID of the lecture.

    Returns Promise<RowDataPacket[]>

    A promise that resolves to an array of RowDataPacket.

  • Inserts a lecture.

    Parameters

    • start_date: Date

      The start date of the lecture.

    • end_date: Date

      The end date of the lecture.

    • timeofday: string

      The time of day of the lecture.

    • topicid: number

      The ID of the topic.

    • courseid: number

      The ID of the course.

    • state: string

      The state of the lecture.

    • teacherid: undefined | number

      The ID of the teacher.

    Returns Promise<unknown>

    A promise that resolves when the insertion is complete.

  • Updates the state of a lecture.

    Parameters

    • lectureid: string

      The ID of the lecture.

    • state: string

      The new state of the lecture.

    Returns Promise<unknown>

    A promise that resolves when the update is complete.