Class Check-in API

1. Manually Create a Check-in Session

POST /api/v1/checkin-sessions

Body:

{
  "occurrence_id": 345,
  "remark": "Created before class"
}

Notes:

  • The course teacher or superadmin/secretary/assistant may call this endpoint.

  • Each call creates one CheckinSession for a single CourseOccurrence.

  • Creating a session repeatedly for the same occurrence does not generate duplicate data. The endpoint returns the existing session and marks created=false.

Example response:

{
  "code": 0,
  "message": "checkin session created",
  "data": {
    "created": true,
    "session": {
      "id": 101,
      "course_id": 12,
      "occurrence_id": 345,
      "session_date": "2026-03-09",
      "sections": [1, 2],
      "status": "draft"
    }
  }
}

2. Check-in Session List

GET /api/v1/checkin-sessions

Query (optional):

  • course_id

  • classroom_id

  • status

  • date (single day)

  • start_date / end_date

Permissions:

  • superadmin/secretary/assistant: view all sessions.

  • Teachers: view only sessions for courses they teach.

3. Get Today’s Check-in Sessions

GET /api/v1/checkin-sessions/daily

Notes: returns today’s courses and check-in status. Permissions are the same as the list endpoint.

4. Open a Check-in Session

POST /api/v1/checkin-sessions/{id}/open

Permission: course teacher or superadmin/secretary/assistant.

Notes: changes the session status from draft to open, allowing students to check in.

5. Get Roster

Get the class student roster for a session and each student’s check-in status.

GET /api/v1/checkin-sessions/{id}/roster

Permission: course teacher or superadmin/secretary/assistant.

Response:

{
  "code": 0,
  "message": "success",
  "data": {
    "session": {
      "id": 101,
      "course": {
        "id": 12,
        "name": "Calculus",
        "course_code": "MATH101",
        "teacher": 88,
        "teacher_name": "Jane Miller",
        "class_name": "CS 2024"
      },
      "course_id": 12,
      "occurrence": {
        "id": 345,
        "classroom": {
          "id": 121,
          "room_number": "C317",
          "building": "5A"
        },
        "classroom_id": 121,
        "occurrence_date": "2026-03-09",
        "weekday": "MONDAY",
        "sections": [1, 2],
        "start_time": "08:00",
        "end_time": "09:40",
        "status": "scheduled",
        "source_type": "generated",
        "remark": ""
      },
      "occurrence_id": 345,
      "course_session": {
        "id": 345,
        "classroom": {
          "id": 121,
          "room_number": "C317",
          "building": "5A"
        },
        "classroom_id": 121,
        "occurrence_date": "2026-03-09",
        "weekday": "MONDAY",
        "sections": [1, 2],
        "start_time": "08:00",
        "end_time": "09:40",
        "status": "scheduled",
        "source_type": "generated",
        "remark": ""
      },
      "course_session_id": 345,
      "classroom": {
        "id": 121,
        "building": "5A",
        "room_number": "C317",
        "capacity": 60,
        "equipment": {
          "projector": true
        },
        "status": "available",
        "last_maintenance": null,
        "remark": ""
      },
      "classroom_id": 121,
      "session_date": "2026-03-09",
      "sections": [1, 2],
      "status": "open",
      "session_code": "ABC123",
      "opened_at": "2026-03-09T08:00:00+08:00",
      "closed_at": null,
      "created_by": 88,
      "remark": "Created before class",
      "created_at": "2026-03-09T07:55:00+08:00",
      "updated_at": "2026-03-09T08:00:00+08:00"
    },
    "roster": [
      {
        "student_id": 2001,
        "full_name": "John Smith",
        "user_code": "2024123456",
        "user_code_last4": "3456",
        "student_class": "CS 2024",
        "status": "present",
        "checkin_time": "2026-03-09T08:05:00+08:00",
        "remark": "",
        "record_id": 101
      }
    ]
  }
}

6. Update Student Check-in Status in Real Time

POST /api/v1/checkin-sessions/{id}/toggle-status

Permission: course teacher or superadmin/secretary/assistant.

Body:

{
  "student_id": 2001,
  "status": "present",
  "remark": ""
}

Notes: status supports present/late/absent/leave.

7. Check-in Record List

GET /api/v1/checkin-records

Query (optional):

  • session_id

  • student_id

  • status

Permissions:

  • superadmin/secretary/assistant: view all records.

  • Teachers: view only check-in records for courses they teach.

  • Students: view only their own check-in records.

8. Student View of Daily Courses and Check-in Status

GET /api/v1/checkin-records/my-schedule

Query:

  • date (required, format YYYY-MM-DD)

Permission: student role.

Response:

{
  "code": 0,
  "message": "success",
  "data": {
    "date": "2026-03-09",
    "courses": [
      {
        "session_id": 101,
        "course_name": "Calculus",
        "course_code": "MATH101",
        "classroom": "5A C317",
        "sections": [1, 2],
        "status": "present",
        "checkin_time": "2026-03-09T08:05:00+08:00",
        "session_status": "open"
      }
    ]
  }
}

9. Manual Check-in by Teacher

POST /api/v1/checkin-records/manual

Body:

{
  "session_id": 101,
  "student_id": 2001,
  "status": "present",
  "remark": ""
}

Notes:

  • Only the course teacher or superadmin/secretary/assistant may call this endpoint.

  • status supports present/late/absent/leave.