Fix edge function logging and types

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 19:57:27 +00:00
parent 99ceacfe0c
commit 6fbaf0c606
9 changed files with 175 additions and 62 deletions

View File

@@ -15,7 +15,7 @@ interface EntityEditPreviewProps {
/**
* Deep equality check for detecting changes in nested objects/arrays
*/
const deepEqual = (a: any, b: any): boolean => {
const deepEqual = <T extends Record<string, unknown>>(a: T, b: T): boolean => {
// Handle null/undefined cases
if (a === b) return true;
if (a == null || b == null) return false;
@@ -27,7 +27,7 @@ const deepEqual = (a: any, b: any): boolean => {
// Handle arrays
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length) return false;
return a.every((item, index) => deepEqual(item, b[index]));
return a.every((item, index) => deepEqual(item as Record<string, unknown>, b[index] as Record<string, unknown>));
}
// One is array, other is not
@@ -39,7 +39,16 @@ const deepEqual = (a: any, b: any): boolean => {
if (keysA.length !== keysB.length) return false;
return keysA.every(key => deepEqual(a[key], b[key]));
return keysA.every(key => {
const valueA = a[key];
const valueB = b[key];
if (typeof valueA === 'object' && valueA !== null && typeof valueB === 'object' && valueB !== null) {
return deepEqual(valueA as Record<string, unknown>, valueB as Record<string, unknown>);
}
return valueA === valueB;
});
};
interface ImageAssignments {

View File

@@ -93,11 +93,17 @@ export function ProfileManager() {
setActionLoading(targetUserId);
try {
// Prepare update data
const updateData: any = { banned: ban };
interface ProfileUpdateData {
banned: boolean;
ban_reason?: string | null;
ban_expires_at?: string | null;
}
const updateData: ProfileUpdateData = { banned: ban };
if (ban && banReason) {
updateData.ban_reason = banReason;
updateData.ban_expires_at = banExpiresAt;
updateData.ban_expires_at = banExpiresAt ? banExpiresAt.toISOString() : null;
} else if (!ban) {
// Clear ban data when unbanning
updateData.ban_reason = null;