Invite links for course members #118

Closed
opened 2026-02-04 09:01:04 +00:00 by kudyakovaa · 2 comments
kudyakovaa commented 2026-02-04 09:01:04 +00:00 (Migrated from git.csit.sgu.ru)

NOTE: This text was generated using an LLM based on a conversation with @Ezhkin-Kot. Field names, variables, endpoints, and other programming elements may differ.

Problem Description

Need to implement an invite link system that allows instructors to invite students and teachers to courses through unique links with the ability to track who specifically shared the link.

Proposed Solution

Database Architecture

  1. Table for storing invite data with fields – invites:

    • id (UUID) — unique identifier for the invite link
    • course_id — ID of the course the link leads to
    • created_by — ID of the instructor who created the link
    • Additional metadata (creation date, active status, etc.)
  2. Foreign key in course_members table:

    • Add nullable field invited_by referencing invites(id)
    • This field is populated when a student enrolls via an invite link

Workflow

Creating an invite link:

  • Instructor creates an invite link through a dedicated endpoint
  • A record with the link's UUID and metadata is saved to the database
  • The instructor receives a link in the format /invite/{uuid}

Following the link:

  1. Frontend extracts the UUID from the URL
  2. Sends a request with the UUID and user data (from session: user_id)
  3. Backend retrieves course_id from the invites table by UUID
  4. Creates a record in course_members with the invited_by field populated
  5. Student is enrolled in the course

Tracking:

  • Through invited_by, you can determine which specific invite link the student used
  • Through created_by in the invites table — who created that link
  • This allows tracking "leaks" of links to public access

Additional Features

  • Ability to make the link nullable so invite links can be disabled early
  • Centralized view of all created invite links
  • Git blame as a bonus tool for tracking changes

Benefits of This Approach

  • Simple and clear database structure
  • No need to know all usernames
  • Convenient tracking of registration sources
  • Ability to manage link activity

Alternatives

JWT tokens — rejected, as it would require either a blacklist in the database or inability to revoke links

****NOTE:** This text was generated using an LLM based on a conversation with `@Ezhkin-Kot.` Field names, variables, endpoints, and other programming elements may differ.** ## Implementing Invite Link Mechanism for Courses ### Problem Description Need to implement an invite link system that allows instructors to invite students and teachers to courses through unique links with the ability to track who specifically shared the link. ### Proposed Solution #### Database Architecture 1. **Table for storing invite data** with fields – `invites`: - `id` (UUID) — unique identifier for the invite link - `course_id` — ID of the course the link leads to - `created_by` — ID of the instructor who created the link - Additional metadata (creation date, active status, etc.) 2. **Foreign key in `course_members` table**: - Add nullable field `invited_by` referencing `invites(id)` - This field is populated when a student enrolls via an invite link #### Workflow **Creating an invite link:** - Instructor creates an invite link through a dedicated endpoint - A record with the link's UUID and metadata is saved to the database - The instructor receives a link in the format `/invite/{uuid}` **Following the link:** 1. Frontend extracts the UUID from the URL 2. Sends a request with the UUID and user data (from session: `user_id`) 3. Backend retrieves `course_id` from the invites table by UUID 4. Creates a record in `course_members` with the `invited_by` field populated 5. Student is enrolled in the course **Tracking:** - Through `invited_by`, you can determine which specific invite link the student used - Through `created_by` in the invites table — who created that link - This allows tracking "leaks" of links to public access #### Additional Features - Ability to make the link nullable so invite links can be disabled early - Centralized view of all created invite links - Git blame as a bonus tool for tracking changes ### Benefits of This Approach - Simple and clear database structure - No need to know all usernames - Convenient tracking of registration sources - Ability to manage link activity ### Alternatives ~~JWT tokens~~ — rejected, as it would require either a blacklist in the database or inability to revoke links
EzhkinKot_placeholder_1gwq8aj commented 2026-02-04 18:48:53 +00:00 (Migrated from git.csit.sgu.ru)

assigned to @Ezhkin-Kot

assigned to `@Ezhkin-Kot`
EzhkinKot_placeholder_1gwq8aj commented 2026-02-05 17:14:09 +00:00 (Migrated from git.csit.sgu.ru)

mentioned in merge request !251

mentioned in merge request !251
EzhkinKot_placeholder_1gwq8aj (Migrated from git.csit.sgu.ru) closed this issue 2026-03-06 16:41:56 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dsc/mm-backend#118
No description provided.