add new changes
This commit is contained in:
@@ -747,6 +747,46 @@ export class AdminService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all questions with pagination, search, and filtering
|
||||
* Endpoint: GET /api/admin/questions
|
||||
*/
|
||||
getAllQuestions(params: {
|
||||
page?: number;
|
||||
limit?: number;
|
||||
search?: string;
|
||||
category?: string;
|
||||
difficulty?: string;
|
||||
sortBy?: string;
|
||||
order?: string;
|
||||
}): Observable<{
|
||||
success: boolean;
|
||||
count: number;
|
||||
total: number;
|
||||
page: number;
|
||||
totalPages: number;
|
||||
limit: number;
|
||||
filters: any;
|
||||
data: Question[];
|
||||
message: string;
|
||||
}> {
|
||||
let queryParams: any = {};
|
||||
|
||||
if (params.page) queryParams.page = params.page;
|
||||
if (params.limit) queryParams.limit = params.limit;
|
||||
if (params.search) queryParams.search = params.search;
|
||||
if (params.category && params.category !== 'all') queryParams.category = params.category;
|
||||
if (params.difficulty && params.difficulty !== 'all') queryParams.difficulty = params.difficulty;
|
||||
if (params.sortBy) queryParams.sortBy = params.sortBy;
|
||||
if (params.order) queryParams.order = params.order.toUpperCase();
|
||||
|
||||
return this.http.get<any>(`${this.apiUrl}/questions`, { params: queryParams }).pipe(
|
||||
catchError((error: HttpErrorResponse) => this.handleQuestionError(error, 'Failed to load questions'))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Delete question (soft delete)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user