File size: 3,242 Bytes
c09f67c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | import { WIDGET_TYPES } from "@midday/cache/widget-preferences-cache";
import { z } from "zod";
export const getRunwaySchema = z.object({
currency: z.string().optional(),
});
export const getRevenueSchema = z.object({
from: z.string(),
to: z.string(),
currency: z.string().optional(),
});
export const getRevenueSummarySchema = z.object({
from: z.string(),
to: z.string(),
currency: z.string().optional(),
revenueType: z.enum(["gross", "net"]).optional().default("net"),
});
export const getGrowthRateSchema = z.object({
from: z.string(),
to: z.string(),
currency: z.string().optional(),
type: z.enum(["revenue", "profit"]).optional().default("revenue"),
revenueType: z.enum(["gross", "net"]).optional().default("net"),
period: z
.enum(["quarterly", "monthly", "yearly"])
.optional()
.default("quarterly"),
});
export const getProfitMarginSchema = z.object({
from: z.string(),
to: z.string(),
currency: z.string().optional(),
revenueType: z.enum(["gross", "net"]).optional().default("net"),
});
export const getCashFlowSchema = z.object({
from: z.string(),
to: z.string(),
currency: z.string().optional(),
period: z.enum(["monthly", "quarterly"]).optional().default("monthly"),
});
export const getOutstandingInvoicesSchema = z.object({
currency: z.string().optional(),
status: z
.array(z.enum(["unpaid", "overdue"]))
.optional()
.default(["unpaid", "overdue"]),
});
export const getInboxStatsSchema = z.object({
from: z.string(),
to: z.string(),
currency: z.string().optional(),
});
export const getTrackedTimeSchema = z.object({
from: z.string(),
to: z.string(),
assignedId: z.string().uuid().optional(),
});
export const getVaultActivitySchema = z.object({
limit: z.number().optional().default(5),
});
export const getAccountBalancesSchema = z.object({
currency: z.string().optional(),
});
export const getNetPositionSchema = z.object({
currency: z.string().optional(),
});
export const getMonthlySpendingSchema = z.object({
from: z.string(),
to: z.string(),
currency: z.string().optional(),
});
export const getRecurringExpensesSchema = z.object({
from: z.string(),
to: z.string(),
currency: z.string().optional(),
});
export const getTaxSummarySchema = z.object({
from: z.string(),
to: z.string(),
currency: z.string().optional(),
});
export const getCategoryExpensesSchema = z.object({
from: z.string(),
to: z.string(),
currency: z.string().optional(),
limit: z.number().optional().default(5),
});
export const getOverdueInvoicesAlertSchema = z
.object({
currency: z.string().optional(),
})
.optional();
export const getBillableHoursSchema = z.object({
date: z.string(),
view: z.enum(["week", "month"]),
weekStartsOnMonday: z.boolean().optional().default(false),
});
export const getCustomerLifetimeValueSchema = z.object({
currency: z.string().optional(),
});
export const widgetTypeSchema = z.enum(WIDGET_TYPES);
export const widgetPreferencesSchema = z.object({
primaryWidgets: z.array(widgetTypeSchema).max(8),
availableWidgets: z.array(widgetTypeSchema),
});
export const updateWidgetPreferencesSchema = z.object({
primaryWidgets: z.array(widgetTypeSchema).max(8),
});
|