apps/api: add seconds util

This commit is contained in:
vchikalkin 2024-02-18 15:23:36 +03:00
parent e0d2836f4a
commit ab0d455afb
3 changed files with 19 additions and 2 deletions

View File

@ -1 +1,3 @@
export const DEFAULT_CACHE_TTL = 15 * 60;
import { seconds } from 'src/utils/time';
export const DEFAULT_CACHE_TTL = seconds().fromMinutes(15);

View File

@ -1,4 +1,6 @@
import { seconds } from 'src/utils/time';
export const queryTTL: Record<string, number | false> = {
GetLeads: false,
GetSystemUser: 6 * 60 * 60,
GetSystemUser: seconds().fromHours(12),
};

View File

@ -0,0 +1,13 @@
export function seconds() {
return {
fromDays(days: number) {
return days * 24 * 60 * 60;
},
fromHours(hours: number) {
return hours * 60 * 60;
},
fromMinutes(minutes: number) {
return minutes * 60;
},
};
}