diff --git a/app/(customer)/dashboard/(admin)/agents/page.tsx b/app/(customer)/dashboard/(admin)/agents/page.tsx index 75ce643b..6864d1cc 100644 --- a/app/(customer)/dashboard/(admin)/agents/page.tsx +++ b/app/(customer)/dashboard/(admin)/agents/page.tsx @@ -25,8 +25,6 @@ export default async function RoutePage(props: PageParams<{}>) { orderBy: (fields) => desc(fields.createdAt), }); - console.log(agents); - if (!agents) { notFound(); diff --git a/app/api/agent/[agentId]/restore/route.ts b/app/api/agent/[agentId]/restore/route.ts index 708f79d6..d4bd7ecb 100644 --- a/app/api/agent/[agentId]/restore/route.ts +++ b/app/api/agent/[agentId]/restore/route.ts @@ -24,7 +24,6 @@ export async function POST( const agentId = (await params).agentId const body: BodyResultRestore = await request.json(); - console.log(body) if (!isUuidv4(body.generatedId)) { return NextResponse.json( diff --git a/app/api/agent/[agentId]/status/route.ts b/app/api/agent/[agentId]/status/route.ts index 7e962198..d3b31d13 100644 --- a/app/api/agent/[agentId]/status/route.ts +++ b/app/api/agent/[agentId]/status/route.ts @@ -41,7 +41,6 @@ export async function POST( if (!isUuidv4(agentId)) { message = "agentId is not a valid uuid" - console.log(message) return NextResponse.json( {error: "agentId is not a valid uuid"}, {status: 500} @@ -54,7 +53,6 @@ export async function POST( if (!agent) { message = "Agent not found" - console.log(message) return NextResponse.json({error: message}, {status: 404}) } const databasesResponse = await handleDatabases(body, agent, lastContact) @@ -77,7 +75,6 @@ export async function POST( }, databases: databasesResponse } - console.log(response) return Response.json(response) } catch (error) { diff --git a/app/api/events/route.ts b/app/api/events/route.ts index 0c55bcc9..a24108ea 100644 --- a/app/api/events/route.ts +++ b/app/api/events/route.ts @@ -19,7 +19,6 @@ export async function GET(request: Request) { new ReadableStream({ start(controller) { console.log('Stream started'); - const handleModification = (data: any) => { console.log('Modification event triggered:', data); controller.enqueue(`event: modification\n`); @@ -45,15 +44,4 @@ export async function GET(request: Request) { }, } ); -} - -// export async function POST(request: Request) { -// console.log('POST request received'); -// const data = await request.json(); -// console.log('Data received:', data); -// -// // Emit the event to all connected clients -// eventEmitter.emit('modification', data); -// -// return new Response('Event sent', {status: 200}); -// } \ No newline at end of file +} \ No newline at end of file diff --git a/src/components/wrappers/auth/login/login-form/login-form.tsx b/src/components/wrappers/auth/login/login-form/login-form.tsx index 9b19b6b3..cb94fb21 100644 --- a/src/components/wrappers/auth/login/login-form/login-form.tsx +++ b/src/components/wrappers/auth/login/login-form/login-form.tsx @@ -63,7 +63,6 @@ export const LoginForm = (props: loginFormProps) => { toast.success("Login success"); }, onError: (error) => { - console.log(error); toast.error(error.error.message); }, } diff --git a/src/components/wrappers/auth/login/reset-password-form/reset-password-form.action.ts b/src/components/wrappers/auth/login/reset-password-form/reset-password-form.action.ts index f059fde6..146d1eac 100644 --- a/src/components/wrappers/auth/login/reset-password-form/reset-password-form.action.ts +++ b/src/components/wrappers/auth/login/reset-password-form/reset-password-form.action.ts @@ -28,7 +28,6 @@ export const resetPasswordAction = action } const user = await (await auth.$context).internalAdapter.findUserById(verification.value); - console.log(user) if (!user) { return { success: false, @@ -39,28 +38,6 @@ export const resetPasswordAction = action }; } - const hashedPassword = await (await auth.$context).password.hash(parsedInput.schema.password); - console.log(hashedPassword) - console.log("ok") - // await (await auth.$context).internalAdapter.updatePassword(user.id, hashedPassword); - console.log("ici") - // await (await auth.$context).internalAdapter.deleteSessions(user.id); - // console.log("ici2") - // await (await auth.$context).internalAdapter.deleteVerificationValue(verification.id); - // console.log("ici3"); - // - // (await auth.$context).internalAdapter.updateUser(user.id, { - // lastChangedPasswordAt: new Date(), - // }); - - // await auth.api.resetPassword({ - // headers: await headers(), - // body: { - // newPassword: parsedInput.schema.password, - // token: parsedInput.token, - // }, - // }); - await ( await auth.$context ).internalAdapter.updateUser(user.id, { diff --git a/src/components/wrappers/auth/login/reset-password-form/reset-password-form.tsx b/src/components/wrappers/auth/login/reset-password-form/reset-password-form.tsx index 5402e578..f85361a8 100644 --- a/src/components/wrappers/auth/login/reset-password-form/reset-password-form.tsx +++ b/src/components/wrappers/auth/login/reset-password-form/reset-password-form.tsx @@ -44,7 +44,6 @@ export const ResetPasswordForm = (props: ResetPasswordFormProps) => { setTimeout(() => router.push("/"), 1400); }, onError: (error: BetterAuthError) => { - console.log(error) toast.error("An error occurred while resetting password"); }, }); diff --git a/src/components/wrappers/auth/register/register-form/register-form.tsx b/src/components/wrappers/auth/register/register-form/register-form.tsx index 87d7532c..197c2998 100644 --- a/src/components/wrappers/auth/register/register-form/register-form.tsx +++ b/src/components/wrappers/auth/register/register-form/register-form.tsx @@ -36,7 +36,6 @@ export const RegisterForm = (props: registerFormProps) => { router.push(`/login`); }, onError: (error) => { - console.log(error); toast.error(error.error.message); }, }); diff --git a/src/components/wrappers/auth/reset-password/reset-password-form.tsx b/src/components/wrappers/auth/reset-password/reset-password-form.tsx index 061bf598..e28a974e 100644 --- a/src/components/wrappers/auth/reset-password/reset-password-form.tsx +++ b/src/components/wrappers/auth/reset-password/reset-password-form.tsx @@ -6,7 +6,7 @@ import {Form, FormControl, FormField, FormItem, FormLabel, useZodForm} from "@/c import {PasswordStrengthInput} from "@/components/ui/password-input-indicator"; import {ResetPasswordSchema, ResetPasswordType} from "@/components/wrappers/auth/reset-password/reset-password-schema"; import {PasswordInput} from "@/components/ui/password-input"; -import {Card, CardContent, CardHeader} from "@/components/ui/card"; +import {CardContent, CardHeader} from "@/components/ui/card"; import {ButtonWithLoading} from "@/components/wrappers/common/button/button-with-loading"; import {authClient} from "@/lib/auth/auth-client"; import {toast} from "sonner"; @@ -31,7 +31,6 @@ export const ResetPasswordForm = ({token}: ResetPasswordFormProps) => { token, }, { onSuccess: (response) => { - console.log(response); toast.success("Password changed successfully."); setTimeout(() => router.push("/"), 1000); }, diff --git a/src/components/wrappers/common/connection-circle.tsx b/src/components/wrappers/common/connection-circle.tsx index a1a66c7f..f30b3a3e 100644 --- a/src/components/wrappers/common/connection-circle.tsx +++ b/src/components/wrappers/common/connection-circle.tsx @@ -12,8 +12,6 @@ export const ConnectionCircle = ({date}: ConnectionCircleProps) => { const timestamp = date.getTime(); const interval_seconds = (now - timestamp) / 1000; - console.log({now, timestamp, interval_seconds}); - if (interval_seconds < 55) { style = "bg-green-400 border-green-600"; } else if (interval_seconds <= 60) { @@ -25,7 +23,5 @@ export const ConnectionCircle = ({date}: ConnectionCircleProps) => { console.warn("Invalid date passed to ConnectionCircle:", date); } - console.log(style); - return
; }; diff --git a/src/components/wrappers/dashboard/admin/notifications/channels/organization/notification-channels-organization-form.tsx b/src/components/wrappers/dashboard/admin/notifications/channels/organization/notification-channels-organization-form.tsx index 5c2977d9..e413171a 100644 --- a/src/components/wrappers/dashboard/admin/notifications/channels/organization/notification-channels-organization-form.tsx +++ b/src/components/wrappers/dashboard/admin/notifications/channels/organization/notification-channels-organization-form.tsx @@ -29,10 +29,6 @@ export const NotifierChannelOrganisationForm = ({ const router = useRouter(); - - console.log("defaultValues", defaultValues); - console.log("organizations", organizations); - const defaultOrganizationIds = defaultValues?.organizations?.map(organization => organization.organizationId) ?? [] diff --git a/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-add-member-form.tsx b/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-add-member-form.tsx index b9f2117c..f785e4a9 100644 --- a/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-add-member-form.tsx +++ b/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-add-member-form.tsx @@ -34,13 +34,11 @@ export const OrganizationAddMemberForm = ({onSuccessAction, users, organization} const mutationAddMemberOrganisation = useMutation({ mutationFn: async (data: AddMemberSchemaType) => { - console.log(data); const result = await addMemberOrganizationAction({ userId: data.userId, organizationId: organization.id, role: "member", }); - console.log(result); toast.success("Member successfully added!"); router.refresh(); onSuccessAction?.(); @@ -71,7 +69,6 @@ export const OrganizationAddMemberForm = ({onSuccessAction, users, organization} placeholder="Enter a user email" entries={filteredUsers} onSelect={(entySelected: any) => { - console.log("Form selection:", entySelected); field.onChange(entySelected.value); }} /> diff --git a/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-delete-member-modal.tsx b/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-delete-member-modal.tsx index 820deacd..389a8625 100644 --- a/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-delete-member-modal.tsx +++ b/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-delete-member-modal.tsx @@ -35,13 +35,11 @@ export const OrganizationDeleteMemberModal = ({ member, open, onOpenChangeAction }, { onSuccess: async (response) => { - console.log(response); toast.success("Member successfully deleted!"); onOpenChangeAction(false); router.refresh(); }, onError: async (error) => { - console.log(error); toast.error("An error occurred while deleting member!"); onOpenChangeAction(false); }, diff --git a/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-member-change-role.tsx b/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-member-change-role.tsx index e40aa514..f0577a8b 100644 --- a/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-member-change-role.tsx +++ b/src/components/wrappers/dashboard/admin/organizations/organization/details/organization-member-change-role.tsx @@ -49,7 +49,6 @@ export const OrganizationMemberChangeRoleModal = (props: OrganizationMemberChang router.refresh(); }, onError: (error) => { - console.log(error); toast.error("An error occurred while updating member"); onOpenChangeAction(false); }, diff --git a/src/components/wrappers/dashboard/admin/settings/storage/storage-s3/storage-s3-form.tsx b/src/components/wrappers/dashboard/admin/settings/storage/storage-s3/storage-s3-form.tsx index 5799fa6e..aec64e0b 100644 --- a/src/components/wrappers/dashboard/admin/settings/storage/storage-s3/storage-s3-form.tsx +++ b/src/components/wrappers/dashboard/admin/settings/storage/storage-s3/storage-s3-form.tsx @@ -28,11 +28,9 @@ export const StorageS3Form = (props: S3FormProps) => { const mutation = useMutation({ mutationFn: async (values: S3FormType) => { - console.log(values); const updateS3Settings = await updateS3SettingsAction({ name: "system", data: values }); const data = updateS3Settings?.data?.data; if (updateS3Settings?.serverError || !data) { - console.log(updateS3Settings?.serverError); toast.error(updateS3Settings?.serverError); return; } diff --git a/src/components/wrappers/dashboard/admin/users/admin-user-edit-form.tsx b/src/components/wrappers/dashboard/admin/users/admin-user-edit-form.tsx index a5e6ab60..3a310150 100644 --- a/src/components/wrappers/dashboard/admin/users/admin-user-edit-form.tsx +++ b/src/components/wrappers/dashboard/admin/users/admin-user-edit-form.tsx @@ -39,7 +39,6 @@ export const AdminUserEditForm = ({ onSuccess, defaultValues }: AdminUserEditFor ...data, id: defaultValues?.id || "", }); - console.log(result) const inner = result?.data; if (inner?.success) { toast.success("User Successfully updated"); diff --git a/src/components/wrappers/dashboard/agent/agent-content.tsx b/src/components/wrappers/dashboard/agent/agent-content.tsx index b6485398..3c6f6cc5 100644 --- a/src/components/wrappers/dashboard/agent/agent-content.tsx +++ b/src/components/wrappers/dashboard/agent/agent-content.tsx @@ -5,7 +5,7 @@ import {Server} from "lucide-react"; import {formatDateLastContact} from "@/utils/date-formatting"; import {AgentCardKey} from "@/components/wrappers/dashboard/agent/agent-card-key/agent-card-key"; import {CardsWithPagination} from "@/components/wrappers/common/cards-with-pagination"; -import {DatabaseCard} from "@/components/wrappers/dashboard/projects/project-card/project-database-card"; +import {AgentDatabaseCard} from "@/components/wrappers/dashboard/agent/agent-database-card"; import {AgentWithDatabases} from "@/db/schema/08_agent"; import {eventUpdate} from "@/types/events"; import {useAutoRefresh} from "@/hooks/use-auto-refresh"; @@ -72,7 +72,7 @@ export const AgentContentPage = ({edgeKey, agent}: AgentContentPageProps) => { + cardItem={AgentDatabaseCard}/> ) diff --git a/src/components/wrappers/dashboard/agent/agent-database-card.tsx b/src/components/wrappers/dashboard/agent/agent-database-card.tsx new file mode 100644 index 00000000..bfcdc638 --- /dev/null +++ b/src/components/wrappers/dashboard/agent/agent-database-card.tsx @@ -0,0 +1,26 @@ +"use client"; + +import {Database} from "@/db/schema/07_database"; +import {DatabaseCard} from "@/components/wrappers/dashboard/projects/project-card/project-database-card"; + +export type agentDatabaseCardProps = { + data: Database; +}; + +export const AgentDatabaseCard = (props: agentDatabaseCardProps) => { + const {data: database} = props; + + return ; + + //todo: à remettre quand on aura fait l'impersonation des admins + /* if (!database.projectId) { + return ; + } + + return ( + + + + );*/ +}; diff --git a/src/components/wrappers/dashboard/agent/agent-form/agent-form.tsx b/src/components/wrappers/dashboard/agent/agent-form/agent-form.tsx index d0427fde..9ce9f098 100644 --- a/src/components/wrappers/dashboard/agent/agent-form/agent-form.tsx +++ b/src/components/wrappers/dashboard/agent/agent-form/agent-form.tsx @@ -47,7 +47,6 @@ export const AgentForm = (props: agentFormProps) => { const data = createAgent?.data?.data; if (createAgent?.serverError || !data) { - console.log(createAgent?.serverError); toast.error(createAgent?.serverError); return; } diff --git a/src/components/wrappers/dashboard/common/notifier/notifier-form/notifier-test-channel-button.tsx b/src/components/wrappers/dashboard/common/notifier/notifier-form/notifier-test-channel-button.tsx index 0f132771..0070eb0f 100644 --- a/src/components/wrappers/dashboard/common/notifier/notifier-form/notifier-test-channel-button.tsx +++ b/src/components/wrappers/dashboard/common/notifier/notifier-form/notifier-test-channel-button.tsx @@ -20,15 +20,6 @@ export const NotifierTestChannelButton = ({notificationChannel, organizationId}: const mutation = useMutation({ mutationFn: async () => { - // const payload: EventPayload = { - // title: 'Database Down', - // message: 'Primary DB instance is unreachable', - // level: 'critical', - // data: {host: 'db-prod-01', error: 'connection timeout'}, - // }; - - console.log("organizationId ici", organizationId); - const payload: EventPayload = { title: 'Test Channel', message: `We are testing channel ${notificationChannel.name}`, diff --git a/src/components/wrappers/dashboard/database/alert-policy/alert-policy-form.tsx b/src/components/wrappers/dashboard/database/alert-policy/alert-policy-form.tsx index d6dab5af..4b5dc77a 100644 --- a/src/components/wrappers/dashboard/database/alert-policy/alert-policy-form.tsx +++ b/src/components/wrappers/dashboard/database/alert-policy/alert-policy-form.tsx @@ -296,9 +296,7 @@ export const AlertPolicyForm = ({database, notificationChannels, organizationId,
- +
-
-
- +
+
+
- + {formatDateLastContact(database.lastContact)}
-
- Open Explorer +
+ Open
Details - +
diff --git a/src/components/wrappers/dashboard/projects/project-form/project-form.action.ts b/src/components/wrappers/dashboard/projects/project-form/project-form.action.ts index 96bcd9b8..af44a47e 100644 --- a/src/components/wrappers/dashboard/projects/project-form/project-form.action.ts +++ b/src/components/wrappers/dashboard/projects/project-form/project-form.action.ts @@ -62,7 +62,6 @@ export const createProjectAction = userAction }, }; } catch (error) { - console.log(error); return { success: false, actionError: { diff --git a/src/features/dashboard/backup/columns.tsx b/src/features/dashboard/backup/columns.tsx index 769bc7b5..d8310ca3 100644 --- a/src/features/dashboard/backup/columns.tsx +++ b/src/features/dashboard/backup/columns.tsx @@ -66,10 +66,8 @@ export function backupColumns( header: "Reference", cell: ({row}) => { const fileName = row.original.file - console.log(row.original) const reference = row.original.id const isImported = isImportedFilename(`${fileName}`) - console.log(isImported) return isImported ? `${reference} (imported)` : `${reference}` }, }, @@ -77,7 +75,6 @@ export function backupColumns( accessorKey: "fileSize", header: "Size", cell: ({row}) => { - console.log(row.original.fileSize) return formatBytes(row.getValue("fileSize")) }, }, @@ -163,7 +160,6 @@ export function backupColumns( } else if (settings.storage == "s3") { data = await getFileUrlPreSignedS3Action(`backups/${database.project?.slug}/${fileName}`); } - console.log(data) if (data?.data?.success) { url = data.data.value ?? ""; } else { diff --git a/src/features/notifications/dispatch.ts b/src/features/notifications/dispatch.ts index aac39cf1..ece13509 100644 --- a/src/features/notifications/dispatch.ts +++ b/src/features/notifications/dispatch.ts @@ -84,7 +84,7 @@ export async function dispatchNotification( success: false, channelId: channelId || "", provider: null, - error: "Channel not active¬", + error: "Channel not active", }; } diff --git a/src/features/notifications/helpers.ts b/src/features/notifications/helpers.ts index c3ab41ca..1f57c573 100644 --- a/src/features/notifications/helpers.ts +++ b/src/features/notifications/helpers.ts @@ -1,67 +1,64 @@ -import {DatabaseWith} from "@/db/schema/07_database"; -import {EventKind, EventPayload} from "@/features/notifications/types"; -import {dispatchNotification} from "@/features/notifications/dispatch"; - +import { DatabaseWith } from "@/db/schema/07_database"; +import { EventKind, EventPayload } from "@/features/notifications/types"; +import { dispatchNotification } from "@/features/notifications/dispatch"; export async function sendNotificationsBackupRestore(database: DatabaseWith, event: EventKind) { - - if (database.alertPolicies && database.alertPolicies.length > 0) { - for (const alertPolicy of database.alertPolicies) { - if (alertPolicy.enabled) { - - const eventKinds = alertPolicy.eventKinds - - if (eventKinds.includes(event)) { - - const date = new Date() - - let level: "info" | "critical" = "info"; - let message = ""; - let error: string | null = null; - - switch (event) { - case "error_backup": - case "error_restore": - level = "critical"; - message = `An error occurred during ${event.includes("backup") ? "backup" : "restore"} on ${date.toISOString()}.`; - error = "Check database connection or agent"; - break; - case "success_backup": - case "success_restore": - level = "info"; - message = `${event.includes("backup") ? "Backup" : "Restore"} completed successfully at ${date.toISOString()}.`; - break; - case "weekly_report": - level = "info"; - message = `Weekly report generated at ${date.toISOString()}.`; - break; - } - - const titleMap: Record = { - error_backup: `Backup Notification`, - error_restore: `Restore Notification`, - success_backup: `Backup Notification`, - success_restore: `Restore Notification`, - weekly_report: `Weekly Report Notification`, - }; - - - const payload: EventPayload = { - title: titleMap[event], - message, - level: level, - event: event, - data: { - host: database.name, - id: database.id, - agentDatabaseId: database.agentDatabaseId, - error, - }, - }; - return await dispatchNotification(payload, alertPolicy.id, undefined, undefined); - } - } - } + if (!database.alertPolicies || database.alertPolicies.length === 0) { + return []; } + const activePolicies = database.alertPolicies.filter(policy => + policy.enabled && policy.eventKinds.includes(event) + ); + + const promises = activePolicies.map(alertPolicy => { + const date = new Date(); + let level: "info" | "critical" = "info"; + let message = ""; + let error: string | null = null; + + switch (event) { + case "error_backup": + case "error_restore": + level = "critical"; + message = `An error occurred during ${event.includes("backup") ? "backup" : "restore"} on ${date.toISOString()}.`; + error = "Check database connection or agent"; + break; + case "success_backup": + case "success_restore": + level = "info"; + message = `${event.includes("backup") ? "Backup" : "Restore"} completed successfully at ${date.toISOString()}.`; + break; + case "weekly_report": + level = "info"; + message = `Weekly report generated at ${date.toISOString()}.`; + break; + } + + const titleMap: Record = { + error_backup: `Backup Notification`, + error_restore: `Restore Notification`, + success_backup: `Backup Notification`, + success_restore: `Restore Notification`, + weekly_report: `Weekly Report Notification`, + }; + + const payload: EventPayload = { + title: titleMap[event], + message, + level: level, + event: event, + data: { + host: database.name, + id: database.id, + agentDatabaseId: database.agentDatabaseId, + error, + }, + }; + + return dispatchNotification(payload, alertPolicy.id, undefined, undefined); + }); + + + return Promise.all(promises); } \ No newline at end of file diff --git a/src/features/upload/public/upload.action.ts b/src/features/upload/public/upload.action.ts index 087c34bb..73009084 100644 --- a/src/features/upload/public/upload.action.ts +++ b/src/features/upload/public/upload.action.ts @@ -59,7 +59,6 @@ async function uploadLocal(fileName: string, buffer: any) { await mkdir(path.join(process.cwd(), localDir), {recursive: true}); return await writeFile(path.join(process.cwd(), localDir + fileName), buffer); } catch (error) { - console.log("Error occured ", error); throw new Error("An error occured while importing image"); } } diff --git a/src/hooks/use-auto-refresh.tsx b/src/hooks/use-auto-refresh.tsx index ab53c04a..5574ee31 100644 --- a/src/hooks/use-auto-refresh.tsx +++ b/src/hooks/use-auto-refresh.tsx @@ -45,15 +45,12 @@ export function useAutoRefresh(options: UseAutoRefreshOptions) { try { payload = JSON.parse(event.data); - } catch { - // keep raw payload - } + } catch {} const shouldRefresh = options.sse?.shouldRefresh?.(payload) ?? true; if (shouldRefresh) { - console.log("Received event source", eventSource); router.refresh(); } }); diff --git a/src/lib/auth/auth.ts b/src/lib/auth/auth.ts index 7ede4d3c..7075a2a9 100644 --- a/src/lib/auth/auth.ts +++ b/src/lib/auth/auth.ts @@ -46,11 +46,7 @@ export const auth = betterAuth({ {} ), }); - - }, - onPasswordReset: async ({user}, request) => { - console.log(`Password for user ${user.email} has been reset.`); - }, + } }, emailVerification: { async sendVerificationEmail({user, token, url}) { @@ -176,13 +172,12 @@ export const auth = betterAuth({ const role = userCount === 0 ? "owner" : "admin"; - const defaultOrgSlug = "default"; // change this if your default org has a different slug + const defaultOrgSlug = "default"; const defaultOrg = await db.query.organization.findFirst({ where: eq(drizzleDb.schemas.organization.slug, defaultOrgSlug), }); if (defaultOrg) { - console.log(user) await db.insert(drizzleDb.schemas.member).values({ userId: user.id, organizationId: defaultOrg.id, @@ -295,7 +290,6 @@ export const auth = betterAuth({ }; } - console.log("sessionId", session.id); const [aa] = await db .update(drizzleUser.session) @@ -303,7 +297,6 @@ export const auth = betterAuth({ .where(eq(drizzleUser.session.id, session.id)) .returning(); - console.log("aaaaa", aa); return { ...session, @@ -516,9 +509,7 @@ export const checkSlugOrganization = async (slug: string) => { }); return status; - } catch (e) { - console.log("err", e); - } + } catch {} }; export const getActiveMember = async () => { @@ -542,7 +533,5 @@ export const setActiveOrganization = async (slug: string) => { organizationSlug: slug, }, }); - } catch (e) { - console.log("error", e); - } + } catch {} }; diff --git a/src/lib/tasks/database/index.ts b/src/lib/tasks/database/index.ts index 03af061a..636596b9 100644 --- a/src/lib/tasks/database/index.ts +++ b/src/lib/tasks/database/index.ts @@ -18,7 +18,6 @@ export const retentionCleanTask = async () => { }, }, }); - console.log(databases); for (const db of databases) { if (!db.retentionPolicy) continue; // no policy = skip @@ -34,7 +33,6 @@ export async function enforceRetention( databaseId: string, policy: typeof retentionPolicy.$inferSelect ) { - console.log(`EnforceRetention: ${policy}`); switch (policy.type) { case "count": diff --git a/src/utils/edge_key.ts b/src/utils/edge_key.ts index 6c398666..71810957 100644 --- a/src/utils/edge_key.ts +++ b/src/utils/edge_key.ts @@ -8,7 +8,6 @@ export async function generateEdgeKey(serverUrl: string, agentId: string): Promi agentId, publicKey }; - console.log(edgeKeyData); const edgeKeyJson = JSON.stringify(edgeKeyData); const edgeKeyBuffer = Buffer.from(edgeKeyJson, 'utf-8'); return edgeKeyBuffer.toString('base64').replace(/=+$/, '').replace(/\+/g, '-').replace(/\//g, '_'); diff --git a/src/utils/s3-file-management.ts b/src/utils/s3-file-management.ts index 3c920602..d2f5701f 100644 --- a/src/utils/s3-file-management.ts +++ b/src/utils/s3-file-management.ts @@ -171,22 +171,18 @@ export async function createPresignedUrlToUpload({ return await s3Client.presignedPutObject(bucketName, fileName, expiry); } -// Function to create a bucket and make it public export async function createPublicBucket({bucketName}: { bucketName: string }) { const s3Client = await getS3Client(); try { - // Check if the bucket already exists const exists = await s3Client.bucketExists(bucketName); if (!exists) { - // Create the bucket - await s3Client.makeBucket(bucketName); // Change region if needed + await s3Client.makeBucket(bucketName); console.log(`Bucket ${bucketName} created successfully.`); } else { console.log(`Bucket ${bucketName} already exists.`); } - // Define a bucket policy for public access const policy = { Version: "2012-10-17", Statement: [ @@ -199,7 +195,6 @@ export async function createPublicBucket({bucketName}: { bucketName: string }) { ], }; - // Set the policy to the bucket await s3Client.setBucketPolicy(bucketName, JSON.stringify(policy)); console.log(`Bucket ${bucketName} is now public.`); } catch (error) { @@ -242,7 +237,6 @@ export async function createPresignedUrlToDownload({ bucketName, fileName, errorMessage: err?.message, - // stack: err?.stack, }); throw {error: err.message ?? "Unknown error"}; }