mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
fix: logs
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
import {PageParams} from "@/types/next";
|
import {PageParams} from "@/types/next";
|
||||||
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||||
import {db} from "@/db";
|
import {db} from "@/db";
|
||||||
import { logger } from "@/lib/logger";
|
import {logger} from "@/lib/logger";
|
||||||
|
|
||||||
const log = logger.child({ module: "dashboard/admin/settings" });
|
|
||||||
import {notFound} from "next/navigation";
|
import {notFound} from "next/navigation";
|
||||||
import {SettingsTabs} from "@/components/wrappers/dashboard/admin/settings/settings-tabs";
|
import {SettingsTabs} from "@/components/wrappers/dashboard/admin/settings/settings-tabs";
|
||||||
import {desc, isNull} from "drizzle-orm";
|
import {desc, isNull} from "drizzle-orm";
|
||||||
@@ -11,13 +9,15 @@ import * as drizzleDb from "@/db";
|
|||||||
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
import {StorageChannelWith} from "@/db/schema/12_storage-channel";
|
||||||
import {NotificationChannelWith} from "@/db/schema/09_notification-channel";
|
import {NotificationChannelWith} from "@/db/schema/09_notification-channel";
|
||||||
|
|
||||||
|
const log = logger.child({module: "dashboard/admin/settings"});
|
||||||
|
|
||||||
export default async function RoutePage(props: PageParams<{}>) {
|
export default async function RoutePage(props: PageParams<{}>) {
|
||||||
|
|
||||||
const settings = await db.query.setting.findFirst({
|
const settings = await db.query.setting.findFirst({
|
||||||
where: (fields, {eq}) => eq(fields.name, "system"),
|
where: (fields, {eq}) => eq(fields.name, "system"),
|
||||||
});
|
});
|
||||||
|
|
||||||
log.debug({ settings }, "Settings loaded");
|
log.debug({settings}, "Settings loaded");
|
||||||
|
|
||||||
const storageChannels = await db.query.storageChannel.findMany({
|
const storageChannels = await db.query.storageChannel.findMany({
|
||||||
with: {
|
with: {
|
||||||
@@ -36,7 +36,7 @@ export default async function RoutePage(props: PageParams<{}>) {
|
|||||||
}) as NotificationChannelWith[]
|
}) as NotificationChannelWith[]
|
||||||
|
|
||||||
|
|
||||||
if (!settings || !storageChannels || !notificationChannels ) {
|
if (!settings || !storageChannels || !notificationChannels) {
|
||||||
notFound()
|
notFound()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,8 @@ export default async function RoutePage(props: PageParams<{}>) {
|
|||||||
</div>
|
</div>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
<PageContent className="flex flex-col gap-5">
|
<PageContent className="flex flex-col gap-5">
|
||||||
<SettingsTabs storageChannels={storageChannels} notificationChannels={notificationChannels} settings={settings} />
|
<SettingsTabs storageChannels={storageChannels} notificationChannels={notificationChannels}
|
||||||
|
settings={settings}/>
|
||||||
</PageContent>
|
</PageContent>
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
|
|||||||
+3
-3
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
import {userAction} from "@/lib/safe-actions/actions";
|
import {userAction} from "@/lib/safe-actions/actions";
|
||||||
import { logger } from "@/lib/logger";
|
import { logger } from "@/lib/logger";
|
||||||
|
|
||||||
const log = logger.child({ module: "dashboard/delete-project.action" });
|
|
||||||
import {z} from "zod";
|
import {z} from "zod";
|
||||||
import {v4 as uuidv4} from "uuid";
|
import {v4 as uuidv4} from "uuid";
|
||||||
import {ServerActionResult} from "@/types/action-type";
|
import {ServerActionResult} from "@/types/action-type";
|
||||||
import {and, eq, inArray} from "drizzle-orm";
|
import {eq, inArray} from "drizzle-orm";
|
||||||
import {db} from "@/db";
|
import {db} from "@/db";
|
||||||
import * as drizzleDb from "@/db";
|
import * as drizzleDb from "@/db";
|
||||||
|
|
||||||
|
const log = logger.child({ module: "dashboard/delete-project.action" });
|
||||||
|
|
||||||
export const deleteProjectAction = userAction.schema(z.string()).action(async ({parsedInput}): Promise<ServerActionResult<typeof drizzleDb.schemas.project.$inferSelect>> => {
|
export const deleteProjectAction = userAction.schema(z.string()).action(async ({parsedInput}): Promise<ServerActionResult<typeof drizzleDb.schemas.project.$inferSelect>> => {
|
||||||
try {
|
try {
|
||||||
const uuid = uuidv4();
|
const uuid = uuidv4();
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
"use server";
|
"use server";
|
||||||
import {userAction} from "@/lib/safe-actions/actions";
|
import {userAction} from "@/lib/safe-actions/actions";
|
||||||
import { logger } from "@/lib/logger";
|
import {logger} from "@/lib/logger";
|
||||||
|
|
||||||
const log = logger.child({ module: "features/upload/upload.action" });
|
|
||||||
import {z} from "zod";
|
import {z} from "zod";
|
||||||
import {v4 as uuidv4} from "uuid";
|
import {v4 as uuidv4} from "uuid";
|
||||||
import {db} from "@/db";
|
import {db} from "@/db";
|
||||||
@@ -13,6 +11,7 @@ import {dispatchStorage} from "@/features/storages/dispatch";
|
|||||||
import {StorageInput} from "@/features/storages/types";
|
import {StorageInput} from "@/features/storages/types";
|
||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
|
|
||||||
|
const log = logger.child({module: "features/upload/upload.action"});
|
||||||
|
|
||||||
export const uploadUserImageAction = userAction.schema(
|
export const uploadUserImageAction = userAction.schema(
|
||||||
z.instanceof(FormData)
|
z.instanceof(FormData)
|
||||||
@@ -30,7 +29,7 @@ export const uploadUserImageAction = userAction.schema(
|
|||||||
const isWebp = fileFormat === "webp";
|
const isWebp = fileFormat === "webp";
|
||||||
|
|
||||||
const compressedBuffer = await sharp(buffer)
|
const compressedBuffer = await sharp(buffer)
|
||||||
.resize({ width: 1024 })
|
.resize({width: 1024})
|
||||||
.toFormat(isPng ? "png" : isWebp ? "webp" : "jpeg", {
|
.toFormat(isPng ? "png" : isWebp ? "webp" : "jpeg", {
|
||||||
quality: 80,
|
quality: 80,
|
||||||
compressionLevel: isPng ? 9 : undefined
|
compressionLevel: isPng ? 9 : undefined
|
||||||
@@ -38,7 +37,6 @@ export const uploadUserImageAction = userAction.schema(
|
|||||||
.toBuffer();
|
.toBuffer();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const settings = await db.query.setting.findFirst({
|
const settings = await db.query.setting.findFirst({
|
||||||
where: eq(drizzleDb.schemas.setting.name, "system"),
|
where: eq(drizzleDb.schemas.setting.name, "system"),
|
||||||
with: {
|
with: {
|
||||||
@@ -72,7 +70,7 @@ export const uploadUserImageAction = userAction.schema(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await dispatchStorage(input, undefined, settings.storageChannel.id);
|
const result = await dispatchStorage(input, undefined, settings.storageChannel.id);
|
||||||
log.debug({ result }, "Upload dispatch result");
|
log.debug({result}, "Upload dispatch result");
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
|
|||||||
+1
-1
@@ -132,7 +132,7 @@ async function createDefaultOrganization() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function consoleAscii() {
|
function consoleAscii() {
|
||||||
log.info(
|
console.log(
|
||||||
" \n" +
|
" \n" +
|
||||||
" ____ __ __ \n" +
|
" ____ __ __ \n" +
|
||||||
" / __ \\____ _____/ /_____ _/ /_ ____ _________ \n" +
|
" / __ \\____ _____/ /_____ _/ /_ ____ _________ \n" +
|
||||||
|
|||||||
Reference in New Issue
Block a user