fix: Resolve build errors (linting and types)
This commit is contained in:
@@ -14,10 +14,10 @@ export default async function DashboardPage() {
|
||||
.select('*', { count: 'exact', head: true })
|
||||
.neq('status', 'cancelled')
|
||||
|
||||
// 2. Active Customers (Count)
|
||||
const { count: totalCustomers } = await supabase
|
||||
.from('customers')
|
||||
.select('*', { count: 'exact', head: true })
|
||||
// 2. Active Customers (Count) - Unused for now
|
||||
// const { count: totalCustomers } = await supabase
|
||||
// .from('customers')
|
||||
// .select('*', { count: 'exact', head: true })
|
||||
|
||||
// 3. Total Revenue (Paid)
|
||||
const { data: payments } = await supabase
|
||||
|
||||
@@ -28,7 +28,7 @@ interface FinancialsEditorProps {
|
||||
reservationId: string
|
||||
currentPackageId: string | null
|
||||
currentPrice: number
|
||||
packages: any[]
|
||||
packages: { id: string; name: string; price: number }[]
|
||||
}
|
||||
|
||||
export function FinancialsEditor({ reservationId, currentPackageId, currentPrice, packages }: FinancialsEditorProps) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import { toast } from "sonner"
|
||||
|
||||
interface PaymentListProps {
|
||||
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) {
|
||||
|
||||
@@ -59,7 +59,7 @@ export function ReservationForm({ halls, customers, packages }: ReservationFormP
|
||||
const [openCustomer, setOpenCustomer] = useState(false)
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema) as any,
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
hall_id: "",
|
||||
customer_id: "",
|
||||
|
||||
@@ -41,6 +41,7 @@ export default async function ReservationsPage() {
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const getSingle = (item: any) => {
|
||||
if (Array.isArray(item)) return item[0]
|
||||
return item
|
||||
|
||||
@@ -18,6 +18,18 @@ import { createAdminClient } from "@/lib/supabase/admin"
|
||||
|
||||
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({
|
||||
searchParams,
|
||||
}: {
|
||||
@@ -56,7 +68,7 @@ export default async function AuditLogsPage({
|
||||
// Manually fetch profiles for the logs
|
||||
let logsWithProfiles = []
|
||||
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> = {}
|
||||
|
||||
@@ -67,6 +79,7 @@ export default async function AuditLogsPage({
|
||||
.in('id', userIds)
|
||||
|
||||
if (profiles) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
profilesMap = profiles.reduce((acc: any, profile: any) => {
|
||||
acc[profile.id] = profile
|
||||
return acc
|
||||
@@ -74,7 +87,7 @@ export default async function AuditLogsPage({
|
||||
}
|
||||
}
|
||||
|
||||
logsWithProfiles = logs.map((log: any) => ({
|
||||
logsWithProfiles = logs.map((log: AuditLog) => ({
|
||||
...log,
|
||||
profiles: profilesMap[log.user_id] || null
|
||||
}))
|
||||
@@ -129,7 +142,7 @@ export default async function AuditLogsPage({
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
logsWithProfiles.map((log: any) => (
|
||||
logsWithProfiles.map((log: AuditLog) => (
|
||||
<TableRow key={log.id}>
|
||||
<TableCell className="font-medium">
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import Link from "next/link"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { Utensils, Users, Activity } from "lucide-react"
|
||||
|
||||
export default function SettingsPage() {
|
||||
|
||||
@@ -23,7 +23,7 @@ export default async function EditUserPage({ params }: { params: Promise<{ id: s
|
||||
// Fetch email from auth.users using admin client
|
||||
let email = undefined
|
||||
if (supabaseAdmin) {
|
||||
const { data: { user }, error } = await supabaseAdmin.auth.admin.getUserById(id)
|
||||
const { data: { user } } = await supabaseAdmin.auth.admin.getUserById(id)
|
||||
if (user) {
|
||||
email = user.email
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { createClient } from "@/lib/supabase/server" // For regular client if ne
|
||||
import { revalidatePath } from "next/cache"
|
||||
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()
|
||||
|
||||
if (!supabaseAdmin) {
|
||||
|
||||
Reference in New Issue
Block a user