feat: implement QuestionBank CRUD with pagination and template query
- Add pagination support to findAll (page, limit query params) - Add findByTemplateId method to service - Add GET /by-template/:templateId endpoint to controller - Service already includes CRUD for QuestionBank and QuestionBankItem
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { type ClassValue, clsx } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
type ToastType = 'success' | 'error' | 'warning' | 'info';
|
||||
|
||||
interface ToastHandler {
|
||||
showToast: (type: ToastType, message: string, title?: string) => void;
|
||||
}
|
||||
|
||||
let handler: ToastHandler | null = null;
|
||||
|
||||
export const registerToastHandler = (h: ToastHandler) => {
|
||||
handler = h;
|
||||
};
|
||||
|
||||
export const toast = {
|
||||
success: (message: string, title?: string) => {
|
||||
if (handler) handler.showToast('success', message, title);
|
||||
else console.log(`✅ ${message}`);
|
||||
},
|
||||
error: (message: string, title?: string) => {
|
||||
if (handler) handler.showToast('error', message, title);
|
||||
else console.log(`❌ ${message}`);
|
||||
},
|
||||
info: (message: string, title?: string) => {
|
||||
if (handler) handler.showToast('info', message, title);
|
||||
else console.log(`ℹ️ ${message}`);
|
||||
},
|
||||
warning: (message: string, title?: string) => {
|
||||
if (handler) handler.showToast('warning', message, title);
|
||||
else console.log(`⚠️ ${message}`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user