mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-06-09 14:56:00 +00:00
refactor: remove exports internos sem uso
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export type SectionType = "Adicionado" | "Alterado" | "Corrigido" | "Removido";
|
||||
|
||||
export const SECTION_TYPES: readonly SectionType[] = [
|
||||
const SECTION_TYPES: readonly SectionType[] = [
|
||||
"Adicionado",
|
||||
"Alterado",
|
||||
"Corrigido",
|
||||
|
||||
@@ -31,19 +31,6 @@ import { addMonthsToPeriod, MONTH_NAMES } from "@/shared/utils/period";
|
||||
// Authorization Validation Functions
|
||||
// ============================================================================
|
||||
|
||||
export async function validatePayerOwnership(
|
||||
userId: string,
|
||||
payerId: string | null | undefined,
|
||||
): Promise<boolean> {
|
||||
if (!payerId) return true;
|
||||
|
||||
const pagador = await db.query.payers.findFirst({
|
||||
where: and(eq(payers.id, payerId), eq(payers.userId, userId)),
|
||||
});
|
||||
|
||||
return !!pagador;
|
||||
}
|
||||
|
||||
const normalizeIds = (ids: Array<string | null | undefined>) => [
|
||||
...new Set(ids.filter((id): id is string => Boolean(id))),
|
||||
];
|
||||
@@ -592,7 +579,7 @@ type SplitShareInput = {
|
||||
amount: number;
|
||||
};
|
||||
|
||||
export const resolveSplitShares = (data: {
|
||||
const resolveSplitShares = (data: {
|
||||
payerId?: string | null;
|
||||
secondaryPayerId?: string | null;
|
||||
splitShares?: SplitShareInput[];
|
||||
|
||||
@@ -137,24 +137,6 @@ export function getSplitSummaryData(
|
||||
};
|
||||
}
|
||||
|
||||
export function getSplitSummaryLabel(
|
||||
formState: FormState,
|
||||
payerOptions: SplitSummaryPayerOption[],
|
||||
totalAmount: number,
|
||||
) {
|
||||
const summary = getSplitSummaryData(formState, payerOptions, totalAmount);
|
||||
|
||||
if (summary.type === "text") return summary.label;
|
||||
|
||||
const namesLabel = summary.participants
|
||||
.map((participant) => participant.firstName)
|
||||
.join(" ");
|
||||
const remainingLabel =
|
||||
summary.remainingCount > 0 ? ` +${summary.remainingCount}` : "";
|
||||
|
||||
return `${summary.count} pessoas: ${namesLabel}${remainingLabel} · ${summary.totalLabel}`;
|
||||
}
|
||||
|
||||
export function SplitConfigDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
|
||||
@@ -61,13 +61,3 @@ export function groupAndSortCategories(
|
||||
),
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters secondary payer options to exclude the primary payer
|
||||
*/
|
||||
export function filterSecondaryPayerOptions(
|
||||
allOptions: SelectOption[],
|
||||
primaryPayerId?: string,
|
||||
): SelectOption[] {
|
||||
return allOptions.filter((option) => option.value !== primaryPayerId);
|
||||
}
|
||||
|
||||
@@ -150,10 +150,7 @@ export const getSingleParam = (
|
||||
return Array.isArray(value) ? (value[0] ?? null) : value;
|
||||
};
|
||||
|
||||
export const getMultiParam = (
|
||||
params: ResolvedSearchParams,
|
||||
key: string,
|
||||
): string[] => {
|
||||
const getMultiParam = (params: ResolvedSearchParams, key: string): string[] => {
|
||||
const value = params?.[key];
|
||||
if (!value) {
|
||||
return [];
|
||||
|
||||
@@ -36,7 +36,7 @@ export const getLogoDisplayName = (logo?: string | null): string => {
|
||||
* @example
|
||||
* deriveNameFromLogo("my-company-logo.png") // "My Company Logo"
|
||||
*/
|
||||
export const deriveNameFromLogo = (logo?: string | null) => {
|
||||
const deriveNameFromLogo = (logo?: string | null) => {
|
||||
if (!logo) {
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user