first commit
This commit is contained in:
79
src/app/core/models/question.model.ts
Normal file
79
src/app/core/models/question.model.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import { QuestionType, Difficulty } from './category.model';
|
||||
|
||||
/**
|
||||
* Question Interface
|
||||
* Represents a quiz question
|
||||
*/
|
||||
export interface Question {
|
||||
id: string;
|
||||
questionText: string;
|
||||
questionType: QuestionType;
|
||||
difficulty: Difficulty;
|
||||
categoryId: string;
|
||||
categoryName?: string;
|
||||
category?: {
|
||||
id: string;
|
||||
name: string;
|
||||
slug?: string;
|
||||
icon?: string;
|
||||
color?: string;
|
||||
guestAccessible?: boolean;
|
||||
};
|
||||
options?: string[] | { id: string; text: string }[]; // For multiple choice
|
||||
correctAnswer: string | string[];
|
||||
explanation: string;
|
||||
points: number;
|
||||
timeLimit?: number; // in seconds
|
||||
tags?: string[];
|
||||
keywords?: string[];
|
||||
isActive: boolean;
|
||||
isPublic: boolean;
|
||||
timesAttempted?: number;
|
||||
timesCorrect?: number;
|
||||
accuracy?: number;
|
||||
createdBy?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Question Create/Update Request
|
||||
*/
|
||||
export interface QuestionFormData {
|
||||
questionText: string;
|
||||
questionType: QuestionType;
|
||||
difficulty: Difficulty;
|
||||
categoryId: string;
|
||||
options?: string[];
|
||||
correctAnswer: string | string[];
|
||||
explanation: string;
|
||||
points?: number;
|
||||
timeLimit?: number;
|
||||
tags?: string[];
|
||||
keywords?: string[];
|
||||
isPublic: boolean;
|
||||
isGuestAccessible: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Question Search Filters
|
||||
*/
|
||||
export interface QuestionSearchFilters {
|
||||
q?: string; // search query
|
||||
category?: string;
|
||||
difficulty?: Difficulty;
|
||||
questionType?: QuestionType;
|
||||
isPublic?: boolean;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Question Search Response
|
||||
*/
|
||||
export interface QuestionSearchResponse {
|
||||
results: Question[];
|
||||
totalCount: number;
|
||||
page: number;
|
||||
limit: number;
|
||||
}
|
||||
Reference in New Issue
Block a user