27 lines
691 B
TypeScript
27 lines
691 B
TypeScript
|
|
import { requireAuth } from '@/server/utils/auth';
|
||
|
|
import { getCacheStatus } from '@/server/utils/currency';
|
||
|
|
|
||
|
|
export default defineEventHandler(async (event) => {
|
||
|
|
await requireAuth(event);
|
||
|
|
|
||
|
|
console.log('[currency/status] Cache status requested');
|
||
|
|
|
||
|
|
try {
|
||
|
|
const status = await getCacheStatus();
|
||
|
|
|
||
|
|
console.log('[currency/status] Cache status:', status);
|
||
|
|
|
||
|
|
return {
|
||
|
|
...status,
|
||
|
|
timestamp: new Date().toISOString()
|
||
|
|
};
|
||
|
|
} catch (error: any) {
|
||
|
|
console.error('[currency/status] Error getting cache status:', error);
|
||
|
|
|
||
|
|
throw createError({
|
||
|
|
statusCode: 500,
|
||
|
|
statusMessage: error.message || 'Failed to get cache status'
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|