mcp-quiz-server
Version:
🧠AI-Powered Quiz Management via Model Context Protocol (MCP) - Create, manage, and take quizzes directly from VS Code, Claude, and other AI agents.
96 lines (95 loc) • 2.79 kB
JavaScript
"use strict";
/**
* @fileoverview Quiz Created Domain Event
* @version 1.0.0
* @since 2025-07-29
* @lastUpdated 2025-07-29
* @module QuizCreatedEvent Domain Event
* @description Domain event fired when a new quiz is created in the system
* @contributors Claude Code Agent
* @dependencies DomainEvent base class
* @requirements REQ-ARCH-001 (Clean Architecture Domain Layer)
* @testCoverage Unit tests for event creation and serialization
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuizCreatedEvent = void 0;
const DomainEvent_1 = require("./DomainEvent");
/**
* Quiz Created Event
*
* @description Domain event that signals a new quiz has been created.
* This event can trigger analytics, notifications, or other
* business processes that need to respond to quiz creation.
*
* @example
* ```typescript
* const event = new QuizCreatedEvent(
* 'quiz-123',
* 'TypeScript Fundamentals',
* 'programming',
* 10
* );
* ```
*
* @since 2025-07-29
* @author Claude Code Agent
* @requirements REQ-ARCH-001 (Clean Architecture Domain Layer)
*/
class QuizCreatedEvent extends DomainEvent_1.DomainEvent {
constructor(quizId, title, category, questionCount, authorId) {
super('QuizCreated', 1);
this.quizId = quizId;
this.title = title;
this.category = category;
this.questionCount = questionCount;
this.authorId = authorId;
}
/**
* Get the aggregate ID (Quiz ID) that this event relates to
*/
getAggregateId() {
return this.quizId;
}
/**
* Get event payload for serialization
*/
getEventData() {
return {
quizId: this.quizId,
title: this.title,
category: this.category,
questionCount: this.questionCount,
authorId: this.authorId,
};
}
/**
* Check if this is a large quiz (business rule)
*/
get isLargeQuiz() {
return this.questionCount > 50;
}
/**
* Check if this is a programming-related quiz
*/
get isProgrammingQuiz() {
const programmingCategories = ['programming', 'coding', 'software', 'development'];
return programmingCategories.includes(this.category.toLowerCase());
}
/**
* Get priority level for notifications
*/
get notificationPriority() {
if (this.isLargeQuiz)
return 'high';
if (this.isProgrammingQuiz)
return 'medium';
return 'low';
}
/**
* String representation for logging
*/
toString() {
return `QuizCreated: "${this.title}" (${this.questionCount} questions) in category "${this.category}"`;
}
}
exports.QuizCreatedEvent = QuizCreatedEvent;