Implement strict type enforcement plan

This commit is contained in:
gpt-engineer-app[bot]
2025-10-16 14:10:35 +00:00
parent 3bcd9e03fa
commit bc4a444138
25 changed files with 161 additions and 132 deletions

View File

@@ -6,9 +6,10 @@ import { Badge } from '@/components/ui/badge';
import { Loader2 } from 'lucide-react';
import { format } from 'date-fns';
import { handleError } from '@/lib/errorHandler';
import { AuditLogEntry } from '@/types/database';
export function ProfileAuditLog() {
const [logs, setLogs] = useState<any[]>([]);
const [logs, setLogs] = useState<AuditLogEntry[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
@@ -27,7 +28,7 @@ export function ProfileAuditLog() {
.limit(50);
if (error) throw error;
setLogs(data || []);
setLogs((data || []) as AuditLogEntry[]);
} catch (error) {
handleError(error, { action: 'Load audit logs' });
} finally {
@@ -64,13 +65,13 @@ export function ProfileAuditLog() {
{logs.map((log) => (
<TableRow key={log.id}>
<TableCell>
{log.profiles?.display_name || log.profiles?.username || 'Unknown'}
{(log as { profiles?: { display_name?: string; username?: string } }).profiles?.display_name || (log as { profiles?: { username?: string } }).profiles?.username || 'Unknown'}
</TableCell>
<TableCell>
<Badge variant="secondary">{log.action}</Badge>
</TableCell>
<TableCell>
<pre className="text-xs">{JSON.stringify(log.changes, null, 2)}</pre>
<pre className="text-xs">{JSON.stringify(log.changes || {}, null, 2)}</pre>
</TableCell>
<TableCell className="text-sm text-muted-foreground">
{format(new Date(log.created_at), 'PPpp')}