refactoring

This commit is contained in:
Emily
2025-03-06 10:55:46 +01:00
parent 63fa3995c5
commit 942d074f99
28 changed files with 253 additions and 83 deletions

View File

@@ -1,6 +1,6 @@
import { model, Schema, Types } from 'mongoose';
export type TeamMemberRole = 'ADMIN' | 'GUEST';
export type TeamMemberRole = 'OWNER' | 'GUEST' | 'MANAGER';
export type TPermission = {

View File

@@ -53,17 +53,16 @@ class DateService {
}
canUseSliceFromDays(days: number, slice: Slice): [false, string] | [true, number] {
// 3 Days
// HOUR - 3 DAYS - 72 SAMPLES
if (slice === 'hour' && (days > 3)) return [false, 'Date gap too big for this slice'];
// 3 Weeks
if (slice === 'day' && (days > 31)) return [false, 'Date gap too big for this slice'];
// 3 Years
if (slice === 'month' && (days > 365 * 3)) return [false, 'Date gap too big for this slice'];
// DAY - 2 MONTHS - 62 SAMPLES
if (slice === 'day' && (days > 31 * 2)) return [false, 'Date gap too big for this slice'];
// MONTH - 4 YEARS - 60 SAMPLES
if (slice === 'month' && (days > 365 * 4)) return [false, 'Date gap too big for this slice'];
// 2 days
// DAY - 2 DAYS - 2 SAMPLES
if (slice === 'day' && (days < 2)) return [false, 'Date gap too small for this slice'];
// 2 month
// MONTH - 2 MONTHS - 2 SAMPLES
if (slice === 'month' && (days < 31 * 2)) return [false, 'Date gap too small for this slice'];
return [true, days]