OSS-first docs
These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.
Enroll in a course.
Goal
Start learning a new course.
Context
Called when a learner wants to start a course.
Source Definition
import { defineCommand, defineQuery } from '@lssm-tech/lib.contracts-spec';
import {
CompleteLessonInput,
EnrollInCourseInput,
EnrollmentModel,
GetDueCardsInput,
GetDueCardsOutput,
GetLearnerDashboardInput,
LearnerDashboardModel,
SubmitCardReviewInput,
SuccessOutput,
} from './models';
import { LEARNING_JOURNEY_OWNERS } from './shared';
export const EnrollInCourseContract = defineCommand({
meta: {
key: 'learning.enroll',
version: '1.0.0',
stability: 'stable',
owners: [...LEARNING_JOURNEY_OWNERS],
tags: ['learning', 'enrollment'],
description: 'Enroll in a course.',
goal: 'Start learning a new course.',
context: 'Called when a learner wants to start a course.',
},
io: {
input: EnrollInCourseInput,
output: EnrollmentModel,
errors: {
COURSE_NOT_FOUND: {
description: 'Course does not exist',
http: 404,
gqlCode: 'COURSE_NOT_FOUND',
when: 'Course ID is invalid',
},
ALREADY_ENROLLED: {
description: 'Already enrolled in course',
http: 409,
gqlCode: 'ALREADY_ENROLLED',
when: 'Learner is already enrolled',
},
},
},
policy: {
auth: 'user',
},
});