mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-06-09 23:06:01 +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 type SectionType = "Adicionado" | "Alterado" | "Corrigido" | "Removido";
|
||||||
|
|
||||||
export const SECTION_TYPES: readonly SectionType[] = [
|
const SECTION_TYPES: readonly SectionType[] = [
|
||||||
"Adicionado",
|
"Adicionado",
|
||||||
"Alterado",
|
"Alterado",
|
||||||
"Corrigido",
|
"Corrigido",
|
||||||
|
|||||||
@@ -31,19 +31,6 @@ import { addMonthsToPeriod, MONTH_NAMES } from "@/shared/utils/period";
|
|||||||
// Authorization Validation Functions
|
// 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>) => [
|
const normalizeIds = (ids: Array<string | null | undefined>) => [
|
||||||
...new Set(ids.filter((id): id is string => Boolean(id))),
|
...new Set(ids.filter((id): id is string => Boolean(id))),
|
||||||
];
|
];
|
||||||
@@ -592,7 +579,7 @@ type SplitShareInput = {
|
|||||||
amount: number;
|
amount: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const resolveSplitShares = (data: {
|
const resolveSplitShares = (data: {
|
||||||
payerId?: string | null;
|
payerId?: string | null;
|
||||||
secondaryPayerId?: string | null;
|
secondaryPayerId?: string | null;
|
||||||
splitShares?: SplitShareInput[];
|
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({
|
export function SplitConfigDialog({
|
||||||
open,
|
open,
|
||||||
onOpenChange,
|
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;
|
return Array.isArray(value) ? (value[0] ?? null) : value;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getMultiParam = (
|
const getMultiParam = (params: ResolvedSearchParams, key: string): string[] => {
|
||||||
params: ResolvedSearchParams,
|
|
||||||
key: string,
|
|
||||||
): string[] => {
|
|
||||||
const value = params?.[key];
|
const value = params?.[key];
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const getLogoDisplayName = (logo?: string | null): string => {
|
|||||||
* @example
|
* @example
|
||||||
* deriveNameFromLogo("my-company-logo.png") // "My Company Logo"
|
* deriveNameFromLogo("my-company-logo.png") // "My Company Logo"
|
||||||
*/
|
*/
|
||||||
export const deriveNameFromLogo = (logo?: string | null) => {
|
const deriveNameFromLogo = (logo?: string | null) => {
|
||||||
if (!logo) {
|
if (!logo) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user