21 lines
434 B
TypeScript
21 lines
434 B
TypeScript
import { StatsOverview } from '../types';
|
|
import { findStatsOverview } from './repository';
|
|
|
|
/**
|
|
* Get link statistics overview
|
|
*/
|
|
export async function getStatsOverview(): Promise<StatsOverview> {
|
|
const stats = await findStatsOverview();
|
|
|
|
// Return default values if no data
|
|
if (!stats) {
|
|
return {
|
|
totalLinks: 0,
|
|
activeLinks: 0,
|
|
totalVisits: 0,
|
|
conversionRate: 0
|
|
};
|
|
}
|
|
|
|
return stats;
|
|
}
|