fix: Resolve build errors (linting and types)

This commit is contained in:
2025-12-07 19:20:31 +03:00
parent b189a19651
commit 7fb9347528
14 changed files with 32 additions and 17 deletions

View File

@@ -14,10 +14,10 @@ export default async function DashboardPage() {
.select('*', { count: 'exact', head: true }) .select('*', { count: 'exact', head: true })
.neq('status', 'cancelled') .neq('status', 'cancelled')
// 2. Active Customers (Count) // 2. Active Customers (Count) - Unused for now
const { count: totalCustomers } = await supabase // const { count: totalCustomers } = await supabase
.from('customers') // .from('customers')
.select('*', { count: 'exact', head: true }) // .select('*', { count: 'exact', head: true })
// 3. Total Revenue (Paid) // 3. Total Revenue (Paid)
const { data: payments } = await supabase const { data: payments } = await supabase

View File

@@ -28,7 +28,7 @@ interface FinancialsEditorProps {
reservationId: string reservationId: string
currentPackageId: string | null currentPackageId: string | null
currentPrice: number currentPrice: number
packages: any[] packages: { id: string; name: string; price: number }[]
} }
export function FinancialsEditor({ reservationId, currentPackageId, currentPrice, packages }: FinancialsEditorProps) { export function FinancialsEditor({ reservationId, currentPackageId, currentPrice, packages }: FinancialsEditorProps) {

View File

@@ -29,7 +29,7 @@ import { toast } from "sonner"
interface PaymentListProps { interface PaymentListProps {
reservationId: string reservationId: string
payments: any[] payments: { id: string; created_at: string; amount: number; payment_type: string; payment_method: string; status: string }[]
} }
export function PaymentList({ reservationId, payments }: PaymentListProps) { export function PaymentList({ reservationId, payments }: PaymentListProps) {

View File

@@ -59,7 +59,7 @@ export function ReservationForm({ halls, customers, packages }: ReservationFormP
const [openCustomer, setOpenCustomer] = useState(false) const [openCustomer, setOpenCustomer] = useState(false)
const form = useForm<z.infer<typeof formSchema>>({ const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema) as any, resolver: zodResolver(formSchema),
defaultValues: { defaultValues: {
hall_id: "", hall_id: "",
customer_id: "", customer_id: "",

View File

@@ -41,6 +41,7 @@ export default async function ReservationsPage() {
} }
} }
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const getSingle = (item: any) => { const getSingle = (item: any) => {
if (Array.isArray(item)) return item[0] if (Array.isArray(item)) return item[0]
return item return item

View File

@@ -18,6 +18,18 @@ import { createAdminClient } from "@/lib/supabase/admin"
import { UserFilter } from "./user-filter" import { UserFilter } from "./user-filter"
interface AuditLog {
id: string
user_id: string
action: string
entity_type: string
entity_id: string
// eslint-disable-next-line @typescript-eslint/no-explicit-any
details: any
created_at: string
profiles?: { full_name: string; role: string } | null
}
export default async function AuditLogsPage({ export default async function AuditLogsPage({
searchParams, searchParams,
}: { }: {
@@ -56,7 +68,7 @@ export default async function AuditLogsPage({
// Manually fetch profiles for the logs // Manually fetch profiles for the logs
let logsWithProfiles = [] let logsWithProfiles = []
if (logs) { if (logs) {
const userIds = Array.from(new Set(logs.map((log: any) => log.user_id).filter(Boolean))) const userIds = Array.from(new Set(logs.map((log: AuditLog) => log.user_id).filter(Boolean)))
let profilesMap: Record<string, any> = {} let profilesMap: Record<string, any> = {}
@@ -67,6 +79,7 @@ export default async function AuditLogsPage({
.in('id', userIds) .in('id', userIds)
if (profiles) { if (profiles) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
profilesMap = profiles.reduce((acc: any, profile: any) => { profilesMap = profiles.reduce((acc: any, profile: any) => {
acc[profile.id] = profile acc[profile.id] = profile
return acc return acc
@@ -74,7 +87,7 @@ export default async function AuditLogsPage({
} }
} }
logsWithProfiles = logs.map((log: any) => ({ logsWithProfiles = logs.map((log: AuditLog) => ({
...log, ...log,
profiles: profilesMap[log.user_id] || null profiles: profilesMap[log.user_id] || null
})) }))
@@ -129,7 +142,7 @@ export default async function AuditLogsPage({
</TableCell> </TableCell>
</TableRow> </TableRow>
) : ( ) : (
logsWithProfiles.map((log: any) => ( logsWithProfiles.map((log: AuditLog) => (
<TableRow key={log.id}> <TableRow key={log.id}>
<TableCell className="font-medium"> <TableCell className="font-medium">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">

View File

@@ -1,6 +1,5 @@
import Link from "next/link" import Link from "next/link"
import { Button } from "@/components/ui/button" import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Utensils, Users, Activity } from "lucide-react" import { Utensils, Users, Activity } from "lucide-react"
export default function SettingsPage() { export default function SettingsPage() {

View File

@@ -23,7 +23,7 @@ export default async function EditUserPage({ params }: { params: Promise<{ id: s
// Fetch email from auth.users using admin client // Fetch email from auth.users using admin client
let email = undefined let email = undefined
if (supabaseAdmin) { if (supabaseAdmin) {
const { data: { user }, error } = await supabaseAdmin.auth.admin.getUserById(id) const { data: { user } } = await supabaseAdmin.auth.admin.getUserById(id)
if (user) { if (user) {
email = user.email email = user.email
} }

View File

@@ -5,7 +5,7 @@ import { createClient } from "@/lib/supabase/server" // For regular client if ne
import { revalidatePath } from "next/cache" import { revalidatePath } from "next/cache"
import { logAction } from "@/lib/logger" import { logAction } from "@/lib/logger"
export async function createUser(data: any) { export async function createUser(data: { email: string; password?: string; full_name: string; role: string }) {
const supabaseAdmin = await createAdminClient() const supabaseAdmin = await createAdminClient()
if (!supabaseAdmin) { if (!supabaseAdmin) {

View File

@@ -31,6 +31,7 @@ const localizer = dateFnsLocalizer({
}) })
interface CalendarViewProps { interface CalendarViewProps {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
events?: any[] events?: any[]
halls?: { id: string, name: string }[] halls?: { id: string, name: string }[]
} }
@@ -46,6 +47,7 @@ export function CalendarView({ events = [], halls = [] }: CalendarViewProps) {
return events.filter(event => event.resource.hall_id === selectedHallId) return events.filter(event => event.resource.hall_id === selectedHallId)
}, [events, selectedHallId]) }, [events, selectedHallId])
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleDoubleClickEvent = (event: any) => { const handleDoubleClickEvent = (event: any) => {
router.push(`/dashboard/reservations/${event.id}`) router.push(`/dashboard/reservations/${event.id}`)
} }

View File

@@ -11,6 +11,7 @@ export function MobileSidebar({ user }: { user?: { name: string | null; email: s
const [isMounted, setIsMounted] = useState(false) const [isMounted, setIsMounted] = useState(false)
useEffect(() => { useEffect(() => {
// eslint-disable-next-line react-hooks/exhaustive-deps
setIsMounted(true) setIsMounted(true)
}, []) }, [])

View File

@@ -9,7 +9,6 @@ import {
DropdownMenuItem, DropdownMenuItem,
DropdownMenuLabel, DropdownMenuLabel,
DropdownMenuSeparator, DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuTrigger, DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu" } from "@/components/ui/dropdown-menu"
import { signOut } from "@/app/(auth)/actions" import { signOut } from "@/app/(auth)/actions"

View File

@@ -5,7 +5,7 @@ export async function logAction(
action: string, action: string,
entityType: string, entityType: string,
entityId: string, entityId: string,
details?: any details?: Record<string, unknown>
) { ) {
const supabase = await createClient() const supabase = await createClient()
const { data: { user } } = await supabase.auth.getUser() const { data: { user } } = await supabase.auth.getUser()

View File

@@ -15,7 +15,7 @@ export async function updateSession(request: NextRequest) {
return request.cookies.getAll() return request.cookies.getAll()
}, },
setAll(cookiesToSet) { setAll(cookiesToSet) {
cookiesToSet.forEach(({ name, value, options }) => cookiesToSet.forEach(({ name, value }) =>
request.cookies.set(name, value) request.cookies.set(name, value)
) )
supabaseResponse = NextResponse.next({ supabaseResponse = NextResponse.next({