From a690045336d29859dc34c1f5f3746ce010577582 Mon Sep 17 00:00:00 2001 From: biersoeckli Date: Wed, 27 Nov 2024 08:05:11 +0000 Subject: [PATCH] reorganized files --- .gitignore | 1 - prisma/schema.prisma | 2 +- src/app/api/auth/[...nextauth]/route.ts | 2 +- src/app/auth/actions.ts | 6 +++--- src/app/auth/login-form.tsx | 2 +- src/app/auth/register-from.tsx | 4 ++-- src/app/auth/two-fa-auth.tsx | 2 +- src/app/layout.tsx | 2 +- src/app/project/actions.ts | 2 +- src/app/project/app/[tabName]/action.ts | 2 +- .../app/[tabName]/app-action-buttons.tsx | 4 ++-- src/app/project/app/[tabName]/app-status.tsx | 2 +- src/app/project/app/[tabName]/app-tabs.tsx | 4 ++-- .../project/app/[tabName]/domains/actions.ts | 8 +++---- .../[tabName]/domains/domain-edit-overlay.tsx | 6 +++--- .../project/app/[tabName]/domains/domains.tsx | 8 +++---- .../[tabName]/domains/internal-hostnames.tsx | 14 ++++++------- .../app/[tabName]/environment/actions.ts | 2 +- .../app/[tabName]/environment/env-edit.tsx | 12 +++++------ .../project/app/[tabName]/general/actions.ts | 10 ++++----- .../app/[tabName]/general/app-rate-limits.tsx | 10 ++++----- .../app/[tabName]/general/app-source.tsx | 8 +++---- .../app/[tabName]/monitoring/monitoring.tsx | 2 +- .../project/app/[tabName]/overview/actions.ts | 8 +++---- .../[tabName]/overview/build-logs-overlay.tsx | 6 +++--- .../[tabName]/overview/build-status-badge.tsx | 2 +- .../overview/deployment-status-badge.tsx | 2 +- .../app/[tabName]/overview/deployments.tsx | 10 ++++----- .../project/app/[tabName]/overview/logs.tsx | 6 +++--- .../project/app/[tabName]/storage/actions.ts | 6 +++--- .../storage/storage-edit-overlay.tsx | 8 +++---- .../app/[tabName]/storage/storages.tsx | 4 ++-- src/app/project/apps-table.tsx | 6 +++--- src/app/project/create-app-dialog.tsx | 2 +- src/app/projects/actions.ts | 2 +- src/app/projects/create-project-dialog.tsx | 2 +- src/app/projects/projects-table.tsx | 4 ++-- src/app/settings/cluster/actions.ts | 2 +- src/app/settings/cluster/nodeInfo.tsx | 6 +++--- src/app/settings/profile/actions.ts | 8 +++---- .../profile/profile-password-change.tsx | 6 +++--- .../settings/profile/totp-create-dialog.tsx | 8 +++---- src/app/settings/profile/totp-settings.tsx | 2 +- src/app/settings/server/actions.ts | 6 +++--- .../settings/server/qs-ingress-settings.tsx | 6 +++--- .../server/qs-letsencrypt-settings.tsx | 6 +++--- .../server/qs-maintenance-settings.tsx | 4 ++-- src/components/custom/confirm-dialog.tsx | 2 +- src/components/custom/multiselect-field.tsx | 2 +- src/components/ui/alert-dialog.tsx | 2 +- src/components/ui/breadcrumb.tsx | 2 +- src/components/ui/button.tsx | 2 +- src/components/ui/calendar.tsx | 2 +- src/components/ui/card.tsx | 2 +- src/components/ui/checkbox.tsx | 2 +- src/components/ui/column-header.tsx | 2 +- src/components/ui/command.tsx | 2 +- src/components/ui/dialog.tsx | 2 +- src/components/ui/drawer.tsx | 2 +- src/components/ui/dropdown-menu.tsx | 2 +- src/components/ui/form.tsx | 2 +- src/components/ui/full-loading-spinnter.tsx | 2 +- src/components/ui/hover-card.tsx | 2 +- src/components/ui/input.tsx | 2 +- src/components/ui/label.tsx | 2 +- src/components/ui/loading-spinner.tsx | 2 +- src/components/ui/popover.tsx | 2 +- src/components/ui/scroll-area.tsx | 2 +- src/components/ui/select.tsx | 2 +- src/components/ui/skeleton.tsx | 2 +- src/components/ui/table.tsx | 2 +- src/components/ui/tabs.tsx | 2 +- src/components/ui/textarea.tsx | 2 +- src/components/ui/tooltip.tsx | 2 +- src/{lib => frontend/sockets}/sockets.ts | 0 .../states}/zustand.states.ts | 0 src/{lib => frontend/utils}/form.utilts.ts | 2 +- src/{lib => frontend/utils}/format.utils.ts | 0 src/{lib => frontend/utils}/toast.utils.ts | 2 +- src/{lib => frontend/utils}/utils.ts | 0 src/server.ts | 4 ++-- src/server/adapter/db.client.ts | 2 +- src/server/services/app.service.ts | 8 +++---- src/server/services/build.service.ts | 18 ++++++++-------- src/server/services/deployment.service.ts | 16 +++++++------- src/server/services/git.service.ts | 4 ++-- src/server/services/ingress.service.ts | 12 +++++------ src/server/services/namespace.service.ts | 16 +++++++------- src/server/services/node.service.ts | 2 +- src/server/services/param.service.ts | 2 +- src/server/services/pod.service.ts | 4 ++-- src/server/services/project.service.ts | 4 ++-- src/server/services/pvc.service.ts | 18 ++++++++-------- src/server/services/qs.service.ts | 14 ++++++------- src/server/services/svc.service.ts | 20 +++++++++--------- src/server/services/user.service.ts | 2 +- src/server/utils/action-wrapper.utils.ts | 10 ++++----- src/{lib => server/utils}/auth-options.ts | 21 +------------------ ...ing.utils.ts => kube-object-name.utils.ts} | 12 +++++------ src/{ => shared}/model/app-extended.model.ts | 0 .../model/app-rate-limits.model.ts | 2 +- .../model/app-source-info.model.ts | 0 src/{ => shared}/model/auth-form.ts | 0 src/{ => shared}/model/build-job.ts | 0 src/{ => shared}/model/default-port.model.ts | 2 +- .../model/deployment-info.model.ts | 0 src/{ => shared}/model/domain-edit.model.ts | 2 +- src/{ => shared}/model/env-edit.model.ts | 0 .../model/form-validation-exception.model.ts | 2 +- .../model/generated-zod/account.ts | 0 src/{ => shared}/model/generated-zod/app.ts | 0 .../model/generated-zod/appdomain.ts | 0 .../model/generated-zod/appvolume.ts | 0 .../model/generated-zod/authenticator.ts | 0 src/{ => shared}/model/generated-zod/index.ts | 0 .../model/generated-zod/parameter.ts | 0 .../model/generated-zod/project.ts | 0 .../model/generated-zod/session.ts | 0 src/{ => shared}/model/generated-zod/user.ts | 0 .../model/generated-zod/verificationtoken.ts | 0 src/{ => shared}/model/node-info.model.ts | 2 +- src/{ => shared}/model/pods-info.model.ts | 0 .../model/qs-letsencrypt-settings.model.ts | 2 +- src/{ => shared}/model/qs-settings.model.ts | 2 +- .../model/server-action-error-return.model.ts | 2 +- .../model/service.exception.model.ts | 0 src/{ => shared}/model/sim-session.model.ts | 0 src/{ => shared}/model/totp.model.ts | 0 .../model/update-password.model.ts | 0 src/{ => shared}/model/volume-edit.model.ts | 2 +- src/{server => shared}/utils/constants.ts | 0 .../utils/fancy-console.utils.ts | 0 src/{server => shared}/utils/list.utils.ts | 0 src/{lib => shared/utils}/zod.utils.ts | 0 134 files changed, 241 insertions(+), 261 deletions(-) rename src/{lib => frontend/sockets}/sockets.ts (100%) rename src/{lib => frontend/states}/zustand.states.ts (100%) rename src/{lib => frontend/utils}/form.utilts.ts (90%) rename src/{lib => frontend/utils}/format.utils.ts (100%) rename src/{lib => frontend/utils}/toast.utils.ts (94%) rename src/{lib => frontend/utils}/utils.ts (100%) rename src/{lib => server/utils}/auth-options.ts (79%) rename src/server/utils/{string.utils.ts => kube-object-name.utils.ts} (82%) rename src/{ => shared}/model/app-extended.model.ts (100%) rename src/{ => shared}/model/app-rate-limits.model.ts (80%) rename src/{ => shared}/model/app-source-info.model.ts (100%) rename src/{ => shared}/model/auth-form.ts (100%) rename src/{ => shared}/model/build-job.ts (100%) rename src/{ => shared}/model/default-port.model.ts (68%) rename src/{ => shared}/model/deployment-info.model.ts (100%) rename src/{ => shared}/model/domain-edit.model.ts (78%) rename src/{ => shared}/model/env-edit.model.ts (100%) rename src/{ => shared}/model/form-validation-exception.model.ts (86%) rename src/{ => shared}/model/generated-zod/account.ts (100%) rename src/{ => shared}/model/generated-zod/app.ts (100%) rename src/{ => shared}/model/generated-zod/appdomain.ts (100%) rename src/{ => shared}/model/generated-zod/appvolume.ts (100%) rename src/{ => shared}/model/generated-zod/authenticator.ts (100%) rename src/{ => shared}/model/generated-zod/index.ts (100%) rename src/{ => shared}/model/generated-zod/parameter.ts (100%) rename src/{ => shared}/model/generated-zod/project.ts (100%) rename src/{ => shared}/model/generated-zod/session.ts (100%) rename src/{ => shared}/model/generated-zod/user.ts (100%) rename src/{ => shared}/model/generated-zod/verificationtoken.ts (100%) rename src/{ => shared}/model/node-info.model.ts (89%) rename src/{ => shared}/model/pods-info.model.ts (100%) rename src/{ => shared}/model/qs-letsencrypt-settings.model.ts (78%) rename src/{ => shared}/model/qs-settings.model.ts (80%) rename src/{ => shared}/model/server-action-error-return.model.ts (90%) rename src/{ => shared}/model/service.exception.model.ts (100%) rename src/{ => shared}/model/sim-session.model.ts (100%) rename src/{ => shared}/model/totp.model.ts (100%) rename src/{ => shared}/model/update-password.model.ts (100%) rename src/{ => shared}/model/volume-edit.model.ts (83%) rename src/{server => shared}/utils/constants.ts (100%) rename src/{server => shared}/utils/fancy-console.utils.ts (100%) rename src/{server => shared}/utils/list.utils.ts (100%) rename src/{lib => shared/utils}/zod.utils.ts (100%) diff --git a/.gitignore b/.gitignore index dbb07ed..8e96491 100644 --- a/.gitignore +++ b/.gitignore @@ -42,5 +42,4 @@ kube-config.config_clusteradmin kube-config.config_old kube-config.config_restricted internal -shared dist \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 5745d14..23b3952 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -10,7 +10,7 @@ generator client { generator zod { provider = "zod-prisma" - output = "../src/model/generated-zod" // (default) the directory where generated zod schemas will be saved + output = "../src/shared/model/generated-zod" // (default) the directory where generated zod schemas will be saved relationModel = true // (default) Create and export both plain and related models. // relationModel = "default" // Do not export model without relations. diff --git a/src/app/api/auth/[...nextauth]/route.ts b/src/app/api/auth/[...nextauth]/route.ts index 44afcda..d980466 100644 --- a/src/app/api/auth/[...nextauth]/route.ts +++ b/src/app/api/auth/[...nextauth]/route.ts @@ -1,5 +1,5 @@ import NextAuth, { } from "next-auth" -import { authOptions } from "@/lib/auth-options"; +import { authOptions } from "@/server/utils/auth-options"; const handler = NextAuth(authOptions) diff --git a/src/app/auth/actions.ts b/src/app/auth/actions.ts index ad63d31..d2b0728 100644 --- a/src/app/auth/actions.ts +++ b/src/app/auth/actions.ts @@ -1,8 +1,8 @@ 'use server' -import { AuthFormInputSchema, authFormInputSchemaZod, RegisterFormInputSchema, registgerFormInputSchemaZod } from "@/model/auth-form"; -import { SuccessActionResult } from "@/model/server-action-error-return.model"; -import { ServiceException } from "@/model/service.exception.model"; +import { AuthFormInputSchema, authFormInputSchemaZod, RegisterFormInputSchema, registgerFormInputSchemaZod } from "@/shared/model/auth-form"; +import { SuccessActionResult } from "@/shared/model/server-action-error-return.model"; +import { ServiceException } from "@/shared/model/service.exception.model"; import paramService, { ParamService } from "@/server/services/param.service"; import quickStackService from "@/server/services/qs.service"; import userService from "@/server/services/user.service"; diff --git a/src/app/auth/login-form.tsx b/src/app/auth/login-form.tsx index 5e3d328..2e66e18 100644 --- a/src/app/auth/login-form.tsx +++ b/src/app/auth/login-form.tsx @@ -12,7 +12,7 @@ import { Input } from "@/components/ui/input" import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import { useState } from "react"; -import { AuthFormInputSchema, authFormInputSchemaZod } from "@/model/auth-form" +import { AuthFormInputSchema, authFormInputSchemaZod } from "@/shared/model/auth-form" import { authUser } from "./actions" import { signIn } from "next-auth/react"; import LoadingSpinner from "@/components/ui/loading-spinner" diff --git a/src/app/auth/register-from.tsx b/src/app/auth/register-from.tsx index 24ddaa1..1d4439f 100644 --- a/src/app/auth/register-from.tsx +++ b/src/app/auth/register-from.tsx @@ -14,9 +14,9 @@ import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import { useFormState } from 'react-dom' import { useEffect } from "react"; -import { FormUtils } from "@/lib/form.utilts"; +import { FormUtils } from "@/frontend/utils/form.utilts"; import { SubmitButton } from "@/components/custom/submit-button"; -import { AuthFormInputSchema, authFormInputSchemaZod, RegisterFormInputSchema, registgerFormInputSchemaZod } from "@/model/auth-form" +import { AuthFormInputSchema, authFormInputSchemaZod, RegisterFormInputSchema, registgerFormInputSchemaZod } from "@/shared/model/auth-form" import { registerUser } from "./actions" import { signIn } from "next-auth/react"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" diff --git a/src/app/auth/two-fa-auth.tsx b/src/app/auth/two-fa-auth.tsx index ae45c56..5ed3a01 100644 --- a/src/app/auth/two-fa-auth.tsx +++ b/src/app/auth/two-fa-auth.tsx @@ -12,7 +12,7 @@ import { Input } from "@/components/ui/input" import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import { useState } from "react"; -import { AuthFormInputSchema, authFormInputSchemaZod, TwoFaInputSchema, twoFaInputSchemaZod } from "@/model/auth-form" +import { AuthFormInputSchema, authFormInputSchemaZod, TwoFaInputSchema, twoFaInputSchemaZod } from "@/shared/model/auth-form" import { signIn } from "next-auth/react"; import LoadingSpinner from "@/components/ui/loading-spinner" import { Button } from "@/components/ui/button" diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 545cfdf..9c92c0e 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,6 +1,6 @@ import type { Metadata } from "next"; import { Inter } from "next/font/google"; -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" import { Toaster } from "@/components/ui/sonner" import "./globals.css"; import { NavBar } from "./nav-bar"; diff --git a/src/app/project/actions.ts b/src/app/project/actions.ts index 427d874..f6e17ca 100644 --- a/src/app/project/actions.ts +++ b/src/app/project/actions.ts @@ -1,6 +1,6 @@ 'use server' -import { SuccessActionResult } from "@/model/server-action-error-return.model"; +import { SuccessActionResult } from "@/shared/model/server-action-error-return.model"; import appService from "@/server/services/app.service"; import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils"; import { z } from "zod"; diff --git a/src/app/project/app/[tabName]/action.ts b/src/app/project/app/[tabName]/action.ts index 205b9da..f35ca76 100644 --- a/src/app/project/app/[tabName]/action.ts +++ b/src/app/project/app/[tabName]/action.ts @@ -1,6 +1,6 @@ 'use server' -import { SuccessActionResult } from "@/model/server-action-error-return.model"; +import { SuccessActionResult } from "@/shared/model/server-action-error-return.model"; import appService from "@/server/services/app.service"; import deploymentService from "@/server/services/deployment.service"; import { getAuthUserSession, simpleAction } from "@/server/utils/action-wrapper.utils"; diff --git a/src/app/project/app/[tabName]/app-action-buttons.tsx b/src/app/project/app/[tabName]/app-action-buttons.tsx index ed72949..706fa5f 100644 --- a/src/app/project/app/[tabName]/app-action-buttons.tsx +++ b/src/app/project/app/[tabName]/app-action-buttons.tsx @@ -3,8 +3,8 @@ import { Button } from "@/components/ui/button"; import { Card, CardContent } from "@/components/ui/card"; import { deploy, startApp, stopApp } from "./action"; -import { AppExtendedModel } from "@/model/app-extended.model"; -import { Toast } from "@/lib/toast.utils"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; +import { Toast } from "@/frontend/utils/toast.utils"; import AppStatus from "./app-status"; import { Hammer, Pause, Play, Rocket } from "lucide-react"; diff --git a/src/app/project/app/[tabName]/app-status.tsx b/src/app/project/app/[tabName]/app-status.tsx index c64c522..3a30e7b 100644 --- a/src/app/project/app/[tabName]/app-status.tsx +++ b/src/app/project/app/[tabName]/app-status.tsx @@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from "react"; import { Textarea } from "@/components/ui/textarea"; import React from "react"; -import { DeplyomentStatus } from "@/model/deployment-info.model"; +import { DeplyomentStatus } from "@/shared/model/deployment-info.model"; import { set } from "date-fns"; export default function AppStatus({ diff --git a/src/app/project/app/[tabName]/app-tabs.tsx b/src/app/project/app/[tabName]/app-tabs.tsx index 4676a36..3700d72 100644 --- a/src/app/project/app/[tabName]/app-tabs.tsx +++ b/src/app/project/app/[tabName]/app-tabs.tsx @@ -9,8 +9,8 @@ import { App } from "@prisma/client"; import DomainsList from "./domains/domains"; import StorageList from "./storage/storages"; import MonitoringList from "./monitoring/monitoring"; -import { AppExtendedModel } from "@/model/app-extended.model"; -import { BuildJobModel } from "@/model/build-job"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; +import { BuildJobModel } from "@/shared/model/build-job"; import BuildsTab from "./overview/deployments"; import Logs from "./overview/logs"; import InternalHostnames from "./domains/internal-hostnames"; diff --git a/src/app/project/app/[tabName]/domains/actions.ts b/src/app/project/app/[tabName]/domains/actions.ts index cfabd68..bab622a 100644 --- a/src/app/project/app/[tabName]/domains/actions.ts +++ b/src/app/project/app/[tabName]/domains/actions.ts @@ -1,9 +1,9 @@ 'use server' -import { AppRateLimitsModel } from "@/model/app-rate-limits.model"; -import { AppDefaultPortsModel, appdefaultPortZodModel } from "@/model/default-port.model"; -import { appDomainEditZodModel } from "@/model/domain-edit.model"; -import { SuccessActionResult } from "@/model/server-action-error-return.model"; +import { AppRateLimitsModel } from "@/shared/model/app-rate-limits.model"; +import { AppDefaultPortsModel, appdefaultPortZodModel } from "@/shared/model/default-port.model"; +import { appDomainEditZodModel } from "@/shared/model/domain-edit.model"; +import { SuccessActionResult } from "@/shared/model/server-action-error-return.model"; import appService from "@/server/services/app.service"; import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils"; import { z } from "zod"; diff --git a/src/app/project/app/[tabName]/domains/domain-edit-overlay.tsx b/src/app/project/app/[tabName]/domains/domain-edit-overlay.tsx index 451935b..a509350 100644 --- a/src/app/project/app/[tabName]/domains/domain-edit-overlay.tsx +++ b/src/app/project/app/[tabName]/domains/domain-edit-overlay.tsx @@ -14,11 +14,11 @@ import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import { useFormState } from 'react-dom' import { useEffect, useState } from "react"; -import { FormUtils } from "@/lib/form.utilts"; +import { FormUtils } from "@/frontend/utils/form.utilts"; import { SubmitButton } from "@/components/custom/submit-button"; import { AppDomain } from "@prisma/client" -import { AppDomainEditModel, appDomainEditZodModel } from "@/model/domain-edit.model" -import { ServerActionResult } from "@/model/server-action-error-return.model" +import { AppDomainEditModel, appDomainEditZodModel } from "@/shared/model/domain-edit.model" +import { ServerActionResult } from "@/shared/model/server-action-error-return.model" import { saveDomain } from "./actions" import { toast } from "sonner" import CheckboxFormField from "@/components/custom/checkbox-form-field" diff --git a/src/app/project/app/[tabName]/domains/domains.tsx b/src/app/project/app/[tabName]/domains/domains.tsx index 12425eb..985a263 100644 --- a/src/app/project/app/[tabName]/domains/domains.tsx +++ b/src/app/project/app/[tabName]/domains/domains.tsx @@ -2,15 +2,15 @@ import { SubmitButton } from "@/components/custom/submit-button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { Button } from "@/components/ui/button"; import { CheckIcon, CrossIcon, DeleteIcon, EditIcon, TrashIcon, XIcon } from "lucide-react"; import DialogEditDialog from "./domain-edit-overlay"; -import { Toast } from "@/lib/toast.utils"; +import { Toast } from "@/frontend/utils/toast.utils"; import { deleteDomain } from "./actions"; -import { ListUtils } from "@/server/utils/list.utils"; -import { StringUtils } from "@/server/utils/string.utils"; +import { ListUtils } from "@/shared/utils/list.utils"; +import { KubeObjectNameUtils } from "@/server/utils/kube-object-name.utils"; import { Code } from "@/components/custom/code"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { OpenInNewWindowIcon, QuestionMarkCircledIcon } from "@radix-ui/react-icons"; diff --git a/src/app/project/app/[tabName]/domains/internal-hostnames.tsx b/src/app/project/app/[tabName]/domains/internal-hostnames.tsx index 69b7d8d..f65ab86 100644 --- a/src/app/project/app/[tabName]/domains/internal-hostnames.tsx +++ b/src/app/project/app/[tabName]/domains/internal-hostnames.tsx @@ -3,29 +3,29 @@ import { SubmitButton } from "@/components/custom/submit-button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; -import { FormUtils } from "@/lib/form.utilts"; +import { FormUtils } from "@/frontend/utils/form.utilts"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { saveDefaultPortConfiguration } from "./actions"; import { useFormState } from "react-dom"; -import { ServerActionResult } from "@/model/server-action-error-return.model"; +import { ServerActionResult } from "@/shared/model/server-action-error-return.model"; import { Input } from "@/components/ui/input"; import { useEffect } from "react"; import { toast } from "sonner"; -import { AppExtendedModel } from "@/model/app-extended.model"; -import { AppDefaultPortsModel, appdefaultPortZodModel } from "@/model/default-port.model"; -import { StringUtils } from "@/server/utils/string.utils"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; +import { AppDefaultPortsModel, appdefaultPortZodModel } from "@/shared/model/default-port.model"; +import { KubeObjectNameUtils } from "@/server/utils/kube-object-name.utils"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { QuestionMarkCircledIcon } from "@radix-ui/react-icons"; import { Code } from "@/components/custom/code"; -import { ListUtils } from "@/server/utils/list.utils"; +import { ListUtils } from "@/shared/utils/list.utils"; export default function InternalHostnames({ app }: { app: AppExtendedModel }) { - const internalUrl = StringUtils.toServiceName(app.id); + const internalUrl = KubeObjectNameUtils.toServiceName(app.id); const form = useForm({ resolver: zodResolver(appdefaultPortZodModel), diff --git a/src/app/project/app/[tabName]/environment/actions.ts b/src/app/project/app/[tabName]/environment/actions.ts index 0fd87a1..232f821 100644 --- a/src/app/project/app/[tabName]/environment/actions.ts +++ b/src/app/project/app/[tabName]/environment/actions.ts @@ -1,6 +1,6 @@ 'use server' -import { AppEnvVariablesModel, appEnvVariablesZodModel } from "@/model/env-edit.model"; +import { AppEnvVariablesModel, appEnvVariablesZodModel } from "@/shared/model/env-edit.model"; import appService from "@/server/services/app.service"; import { getAuthUserSession, saveFormAction } from "@/server/utils/action-wrapper.utils"; diff --git a/src/app/project/app/[tabName]/environment/env-edit.tsx b/src/app/project/app/[tabName]/environment/env-edit.tsx index 07f6c3e..2eb4a63 100644 --- a/src/app/project/app/[tabName]/environment/env-edit.tsx +++ b/src/app/project/app/[tabName]/environment/env-edit.tsx @@ -3,23 +3,23 @@ import { SubmitButton } from "@/components/custom/submit-button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; -import { FormUtils } from "@/lib/form.utilts"; -import { AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/model/app-source-info.model"; +import { FormUtils } from "@/frontend/utils/form.utilts"; +import { AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/shared/model/app-source-info.model"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { saveEnvVariables } from "./actions"; import { useFormState } from "react-dom"; -import { ServerActionResult } from "@/model/server-action-error-return.model"; +import { ServerActionResult } from "@/shared/model/server-action-error-return.model"; import { Input } from "@/components/ui/input"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Label } from "@/components/ui/label"; -import { AppRateLimitsModel, appRateLimitsZodModel } from "@/model/app-rate-limits.model"; +import { AppRateLimitsModel, appRateLimitsZodModel } from "@/shared/model/app-rate-limits.model"; import { App } from "@prisma/client"; import { useEffect } from "react"; import { toast } from "sonner"; -import { AppEnvVariablesModel, appEnvVariablesZodModel } from "@/model/env-edit.model"; +import { AppEnvVariablesModel, appEnvVariablesZodModel } from "@/shared/model/env-edit.model"; import { Textarea } from "@/components/ui/textarea"; -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; export default function EnvEdit({ app }: { diff --git a/src/app/project/app/[tabName]/general/actions.ts b/src/app/project/app/[tabName]/general/actions.ts index aab7773..291d77f 100644 --- a/src/app/project/app/[tabName]/general/actions.ts +++ b/src/app/project/app/[tabName]/general/actions.ts @@ -1,10 +1,10 @@ 'use server' -import { AppRateLimitsModel, appRateLimitsZodModel } from "@/model/app-rate-limits.model"; -import { appSourceInfoContainerZodModel, appSourceInfoGitZodModel, AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/model/app-source-info.model"; -import { AuthFormInputSchema, authFormInputSchemaZod } from "@/model/auth-form"; -import { ErrorActionResult, ServerActionResult, SuccessActionResult } from "@/model/server-action-error-return.model"; -import { ServiceException } from "@/model/service.exception.model"; +import { AppRateLimitsModel, appRateLimitsZodModel } from "@/shared/model/app-rate-limits.model"; +import { appSourceInfoContainerZodModel, appSourceInfoGitZodModel, AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/shared/model/app-source-info.model"; +import { AuthFormInputSchema, authFormInputSchemaZod } from "@/shared/model/auth-form"; +import { ErrorActionResult, ServerActionResult, SuccessActionResult } from "@/shared/model/server-action-error-return.model"; +import { ServiceException } from "@/shared/model/service.exception.model"; import appService from "@/server/services/app.service"; import userService from "@/server/services/user.service"; import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils"; diff --git a/src/app/project/app/[tabName]/general/app-rate-limits.tsx b/src/app/project/app/[tabName]/general/app-rate-limits.tsx index c3c3d8d..51a4354 100644 --- a/src/app/project/app/[tabName]/general/app-rate-limits.tsx +++ b/src/app/project/app/[tabName]/general/app-rate-limits.tsx @@ -3,21 +3,21 @@ import { SubmitButton } from "@/components/custom/submit-button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; -import { FormUtils } from "@/lib/form.utilts"; -import { AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/model/app-source-info.model"; +import { FormUtils } from "@/frontend/utils/form.utilts"; +import { AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/shared/model/app-source-info.model"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { saveGeneralAppRateLimits, saveGeneralAppSourceInfo } from "./actions"; import { useFormState } from "react-dom"; -import { ServerActionResult } from "@/model/server-action-error-return.model"; +import { ServerActionResult } from "@/shared/model/server-action-error-return.model"; import { Input } from "@/components/ui/input"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Label } from "@/components/ui/label"; -import { AppRateLimitsModel, appRateLimitsZodModel } from "@/model/app-rate-limits.model"; +import { AppRateLimitsModel, appRateLimitsZodModel } from "@/shared/model/app-rate-limits.model"; import { App } from "@prisma/client"; import { useEffect } from "react"; import { toast } from "sonner"; -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; export default function GeneralAppRateLimits({ app }: { diff --git a/src/app/project/app/[tabName]/general/app-source.tsx b/src/app/project/app/[tabName]/general/app-source.tsx index 249c0ff..dff8d59 100644 --- a/src/app/project/app/[tabName]/general/app-source.tsx +++ b/src/app/project/app/[tabName]/general/app-source.tsx @@ -3,20 +3,20 @@ import { SubmitButton } from "@/components/custom/submit-button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; -import { FormUtils } from "@/lib/form.utilts"; -import { AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/model/app-source-info.model"; +import { FormUtils } from "@/frontend/utils/form.utilts"; +import { AppSourceInfoInputModel, appSourceInfoInputZodModel } from "@/shared/model/app-source-info.model"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { saveGeneralAppSourceInfo } from "./actions"; import { useFormState } from "react-dom"; -import { ServerActionResult } from "@/model/server-action-error-return.model"; +import { ServerActionResult } from "@/shared/model/server-action-error-return.model"; import { Input } from "@/components/ui/input"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Label } from "@/components/ui/label"; import { useEffect } from "react"; import { App } from "@prisma/client"; import { toast } from "sonner"; -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; export default function GeneralAppSource({ app }: { app: AppExtendedModel diff --git a/src/app/project/app/[tabName]/monitoring/monitoring.tsx b/src/app/project/app/[tabName]/monitoring/monitoring.tsx index 8d33b6b..3d960f9 100644 --- a/src/app/project/app/[tabName]/monitoring/monitoring.tsx +++ b/src/app/project/app/[tabName]/monitoring/monitoring.tsx @@ -1,7 +1,7 @@ 'use client'; import { Card, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; diff --git a/src/app/project/app/[tabName]/overview/actions.ts b/src/app/project/app/[tabName]/overview/actions.ts index 879a5e6..cb8a430 100644 --- a/src/app/project/app/[tabName]/overview/actions.ts +++ b/src/app/project/app/[tabName]/overview/actions.ts @@ -1,9 +1,9 @@ 'use server' -import { BuildJobModel } from "@/model/build-job"; -import { DeploymentInfoModel } from "@/model/deployment-info.model"; -import { PodsInfoModel } from "@/model/pods-info.model"; -import { ServerActionResult, SuccessActionResult } from "@/model/server-action-error-return.model"; +import { BuildJobModel } from "@/shared/model/build-job"; +import { DeploymentInfoModel } from "@/shared/model/deployment-info.model"; +import { PodsInfoModel } from "@/shared/model/pods-info.model"; +import { ServerActionResult, SuccessActionResult } from "@/shared/model/server-action-error-return.model"; import appService from "@/server/services/app.service"; import buildService from "@/server/services/build.service"; import deploymentService from "@/server/services/deployment.service"; diff --git a/src/app/project/app/[tabName]/overview/build-logs-overlay.tsx b/src/app/project/app/[tabName]/overview/build-logs-overlay.tsx index 80ec53f..ec67ef3 100644 --- a/src/app/project/app/[tabName]/overview/build-logs-overlay.tsx +++ b/src/app/project/app/[tabName]/overview/build-logs-overlay.tsx @@ -12,10 +12,10 @@ import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import React, { useEffect } from "react"; import { set } from "date-fns"; -import { DeploymentInfoModel } from "@/model/deployment-info.model"; +import { DeploymentInfoModel } from "@/shared/model/deployment-info.model"; import LogsStreamed from "./logs-streamed"; -import { formatDate, formatDateTime } from "@/lib/format.utils"; -import { podLogsSocket } from "@/lib/sockets"; +import { formatDate, formatDateTime } from "@/frontend/utils/format.utils"; +import { podLogsSocket } from "@/frontend/sockets/sockets"; export function BuildLogsDialog({ deploymentInfo, diff --git a/src/app/project/app/[tabName]/overview/build-status-badge.tsx b/src/app/project/app/[tabName]/overview/build-status-badge.tsx index d796968..e2e3325 100644 --- a/src/app/project/app/[tabName]/overview/build-status-badge.tsx +++ b/src/app/project/app/[tabName]/overview/build-status-badge.tsx @@ -10,7 +10,7 @@ import { } from "@/components/ui/form" import { Input } from "@/components/ui/input"; import { isDate } from "date-fns"; -import { BuildJobStatus } from "@/model/build-job"; +import { BuildJobStatus } from "@/shared/model/build-job"; export default function BuildStatusBadge( diff --git a/src/app/project/app/[tabName]/overview/deployment-status-badge.tsx b/src/app/project/app/[tabName]/overview/deployment-status-badge.tsx index 48712b1..37882bb 100644 --- a/src/app/project/app/[tabName]/overview/deployment-status-badge.tsx +++ b/src/app/project/app/[tabName]/overview/deployment-status-badge.tsx @@ -1,6 +1,6 @@ 'use client' -import { DeplyomentStatus } from "@/model/deployment-info.model"; +import { DeplyomentStatus } from "@/shared/model/deployment-info.model"; export default function DeploymentStatusBadge( diff --git a/src/app/project/app/[tabName]/overview/deployments.tsx b/src/app/project/app/[tabName]/overview/deployments.tsx index 995103c..9163f96 100644 --- a/src/app/project/app/[tabName]/overview/deployments.tsx +++ b/src/app/project/app/[tabName]/overview/deployments.tsx @@ -1,14 +1,14 @@ import { SimpleDataTable } from "@/components/custom/simple-data-table"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; -import { formatDateTime } from "@/lib/format.utils"; -import { AppExtendedModel } from "@/model/app-extended.model"; +import { formatDateTime } from "@/frontend/utils/format.utils"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; import { useEffect, useState } from "react"; import { deleteBuild, getDeploymentsAndBuildsForApp } from "./actions"; import FullLoadingSpinner from "@/components/ui/full-loading-spinnter"; import { Button } from "@/components/ui/button"; -import { useConfirmDialog } from "@/lib/zustand.states"; -import { Toast } from "@/lib/toast.utils"; -import { DeploymentInfoModel } from "@/model/deployment-info.model"; +import { useConfirmDialog } from "@/frontend/states/zustand.states"; +import { Toast } from "@/frontend/utils/toast.utils"; +import { DeploymentInfoModel } from "@/shared/model/deployment-info.model"; import DeploymentStatusBadge from "./deployment-status-badge"; import { BuildLogsDialog } from "./build-logs-overlay"; import ShortCommitHash from "@/components/custom/short-commit-hash"; diff --git a/src/app/project/app/[tabName]/overview/logs.tsx b/src/app/project/app/[tabName]/overview/logs.tsx index cc8f337..b68b4c2 100644 --- a/src/app/project/app/[tabName]/overview/logs.tsx +++ b/src/app/project/app/[tabName]/overview/logs.tsx @@ -1,10 +1,10 @@ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; import { useEffect, useState } from "react"; -import { podLogsSocket } from "@/lib/sockets"; +import { podLogsSocket } from "@/frontend/sockets/sockets"; import LogsStreamed from "./logs-streamed"; import { getPodsForApp } from "./actions"; -import { PodsInfoModel } from "@/model/pods-info.model"; +import { PodsInfoModel } from "@/shared/model/pods-info.model"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import FullLoadingSpinner from "@/components/ui/full-loading-spinnter"; import { toast } from "sonner"; diff --git a/src/app/project/app/[tabName]/storage/actions.ts b/src/app/project/app/[tabName]/storage/actions.ts index 742df0a..897bea8 100644 --- a/src/app/project/app/[tabName]/storage/actions.ts +++ b/src/app/project/app/[tabName]/storage/actions.ts @@ -1,11 +1,11 @@ 'use server' -import { appVolumeEditZodModel } from "@/model/volume-edit.model"; -import { SuccessActionResult } from "@/model/server-action-error-return.model"; +import { appVolumeEditZodModel } from "@/shared/model/volume-edit.model"; +import { SuccessActionResult } from "@/shared/model/server-action-error-return.model"; import appService from "@/server/services/app.service"; import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils"; import { z } from "zod"; -import { ServiceException } from "@/model/service.exception.model"; +import { ServiceException } from "@/shared/model/service.exception.model"; import pvcStatusService from "@/server/services/pvc.status.service"; const actionAppVolumeEditZodModel = appVolumeEditZodModel.merge(z.object({ diff --git a/src/app/project/app/[tabName]/storage/storage-edit-overlay.tsx b/src/app/project/app/[tabName]/storage/storage-edit-overlay.tsx index 70e8edb..d450cb0 100644 --- a/src/app/project/app/[tabName]/storage/storage-edit-overlay.tsx +++ b/src/app/project/app/[tabName]/storage/storage-edit-overlay.tsx @@ -22,18 +22,18 @@ import { PopoverTrigger, } from "@/components/ui/popover" import { Input } from "@/components/ui/input" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" import { Button } from "@/components/ui/button" import { Check, ChevronsUpDown } from "lucide-react" import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import { useFormState } from 'react-dom' import { useEffect, useState } from "react"; -import { FormUtils } from "@/lib/form.utilts"; +import { FormUtils } from "@/frontend/utils/form.utilts"; import { SubmitButton } from "@/components/custom/submit-button"; import { AppVolume } from "@prisma/client" -import { AppVolumeEditModel, appVolumeEditZodModel } from "@/model/volume-edit.model" -import { ServerActionResult } from "@/model/server-action-error-return.model" +import { AppVolumeEditModel, appVolumeEditZodModel } from "@/shared/model/volume-edit.model" +import { ServerActionResult } from "@/shared/model/server-action-error-return.model" import { saveVolume } from "./actions" import { toast } from "sonner" import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; diff --git a/src/app/project/app/[tabName]/storage/storages.tsx b/src/app/project/app/[tabName]/storage/storages.tsx index 27f80bc..f6fe82c 100644 --- a/src/app/project/app/[tabName]/storage/storages.tsx +++ b/src/app/project/app/[tabName]/storage/storages.tsx @@ -1,12 +1,12 @@ 'use client'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { Button } from "@/components/ui/button"; import { EditIcon, TrashIcon } from "lucide-react"; import DialogEditDialog from "./storage-edit-overlay"; -import { Toast } from "@/lib/toast.utils"; +import { Toast } from "@/frontend/utils/toast.utils"; import { deleteVolume } from "./actions"; diff --git a/src/app/project/apps-table.tsx b/src/app/project/apps-table.tsx index a30702b..fc97276 100644 --- a/src/app/project/apps-table.tsx +++ b/src/app/project/apps-table.tsx @@ -4,13 +4,13 @@ import { Button } from "@/components/ui/button"; import Link from "next/link"; import { SimpleDataTable } from "@/components/custom/simple-data-table"; -import { formatDateTime } from "@/lib/format.utils"; +import { formatDateTime } from "@/frontend/utils/format.utils"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { MoreHorizontal } from "lucide-react"; -import { Toast } from "@/lib/toast.utils"; +import { Toast } from "@/frontend/utils/toast.utils"; import { App } from "@prisma/client"; import { deleteApp } from "./actions"; -import { useConfirmDialog } from "@/lib/zustand.states"; +import { useConfirmDialog } from "@/frontend/states/zustand.states"; diff --git a/src/app/project/create-app-dialog.tsx b/src/app/project/create-app-dialog.tsx index 9378af7..c98141c 100644 --- a/src/app/project/create-app-dialog.tsx +++ b/src/app/project/create-app-dialog.tsx @@ -2,7 +2,7 @@ import { InputDialog } from "@/components/custom/input-dialog" import { Button } from "@/components/ui/button" -import { Toast } from "@/lib/toast.utils"; +import { Toast } from "@/frontend/utils/toast.utils"; import { createApp } from "./actions"; import { redirect } from "next/navigation"; import { useRouter } from "next/navigation"; diff --git a/src/app/projects/actions.ts b/src/app/projects/actions.ts index 9d93209..c979225 100644 --- a/src/app/projects/actions.ts +++ b/src/app/projects/actions.ts @@ -1,6 +1,6 @@ 'use server' -import { SuccessActionResult } from "@/model/server-action-error-return.model"; +import { SuccessActionResult } from "@/shared/model/server-action-error-return.model"; import projectService from "@/server/services/project.service"; import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils"; import { z } from "zod"; diff --git a/src/app/projects/create-project-dialog.tsx b/src/app/projects/create-project-dialog.tsx index 0a547d2..ef05ab0 100644 --- a/src/app/projects/create-project-dialog.tsx +++ b/src/app/projects/create-project-dialog.tsx @@ -2,7 +2,7 @@ import { InputDialog } from "@/components/custom/input-dialog" import { Button } from "@/components/ui/button" -import { Toast } from "@/lib/toast.utils"; +import { Toast } from "@/frontend/utils/toast.utils"; import { createProject } from "./actions"; diff --git a/src/app/projects/projects-table.tsx b/src/app/projects/projects-table.tsx index 98ad192..a16a3bc 100644 --- a/src/app/projects/projects-table.tsx +++ b/src/app/projects/projects-table.tsx @@ -4,10 +4,10 @@ import { Button } from "@/components/ui/button"; import Link from "next/link"; import { SimpleDataTable } from "@/components/custom/simple-data-table"; -import { formatDateTime } from "@/lib/format.utils"; +import { formatDateTime } from "@/frontend/utils/format.utils"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import { MoreHorizontal } from "lucide-react"; -import { Toast } from "@/lib/toast.utils"; +import { Toast } from "@/frontend/utils/toast.utils"; import { Project } from "@prisma/client"; import { deleteProject } from "./actions"; diff --git a/src/app/settings/cluster/actions.ts b/src/app/settings/cluster/actions.ts index 246bbcd..11f8a16 100644 --- a/src/app/settings/cluster/actions.ts +++ b/src/app/settings/cluster/actions.ts @@ -1,7 +1,7 @@ 'use server' import { getAuthUserSession, simpleAction } from "@/server/utils/action-wrapper.utils"; -import { SuccessActionResult } from "@/model/server-action-error-return.model"; +import { SuccessActionResult } from "@/shared/model/server-action-error-return.model"; import clusterService from "@/server/services/node.service"; export const setNodeStatus = async (nodeName: string, schedulable: boolean) => diff --git a/src/app/settings/cluster/nodeInfo.tsx b/src/app/settings/cluster/nodeInfo.tsx index 24b063f..f5ef9e6 100644 --- a/src/app/settings/cluster/nodeInfo.tsx +++ b/src/app/settings/cluster/nodeInfo.tsx @@ -1,12 +1,12 @@ 'use client' -import { NodeInfoModel } from "@/model/node-info.model"; +import { NodeInfoModel } from "@/shared/model/node-info.model"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Code } from "@/components/custom/code"; -import { Toast } from "@/lib/toast.utils"; +import { Toast } from "@/frontend/utils/toast.utils"; import { setNodeStatus } from "./actions"; import { Button } from "@/components/ui/button"; -import { useConfirmDialog } from "@/lib/zustand.states"; +import { useConfirmDialog } from "@/frontend/states/zustand.states"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; export default async function NodeInfo({ nodeInfos }: { nodeInfos: NodeInfoModel[] }) { diff --git a/src/app/settings/profile/actions.ts b/src/app/settings/profile/actions.ts index 8dfc6cf..55ceaca 100644 --- a/src/app/settings/profile/actions.ts +++ b/src/app/settings/profile/actions.ts @@ -1,11 +1,11 @@ 'use server' -import { ServiceException } from "@/model/service.exception.model"; -import { ProfilePasswordChangeModel, profilePasswordChangeZodModel } from "@/model/update-password.model"; +import { ServiceException } from "@/shared/model/service.exception.model"; +import { ProfilePasswordChangeModel, profilePasswordChangeZodModel } from "@/shared/model/update-password.model"; import userService from "@/server/services/user.service"; import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils"; -import { TotpModel, totpZodModel } from "@/model/totp.model"; -import { SuccessActionResult } from "@/model/server-action-error-return.model"; +import { TotpModel, totpZodModel } from "@/shared/model/totp.model"; +import { SuccessActionResult } from "@/shared/model/server-action-error-return.model"; export const changePassword = async (prevState: any, inputData: ProfilePasswordChangeModel) => saveFormAction(inputData, profilePasswordChangeZodModel, async (validatedData) => { diff --git a/src/app/settings/profile/profile-password-change.tsx b/src/app/settings/profile/profile-password-change.tsx index 867c41d..7ee9dcb 100644 --- a/src/app/settings/profile/profile-password-change.tsx +++ b/src/app/settings/profile/profile-password-change.tsx @@ -3,15 +3,15 @@ import { SubmitButton } from "@/components/custom/submit-button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; -import { FormUtils } from "@/lib/form.utilts"; +import { FormUtils } from "@/frontend/utils/form.utilts"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { useFormState } from "react-dom"; -import { ServerActionResult } from "@/model/server-action-error-return.model"; +import { ServerActionResult } from "@/shared/model/server-action-error-return.model"; import { Input } from "@/components/ui/input"; import { useEffect } from "react"; import { toast } from "sonner"; -import { ProfilePasswordChangeModel, profilePasswordChangeZodModel } from "@/model/update-password.model"; +import { ProfilePasswordChangeModel, profilePasswordChangeZodModel } from "@/shared/model/update-password.model"; import { changePassword } from "./actions"; export default function ProfilePasswordChange() { diff --git a/src/app/settings/profile/totp-create-dialog.tsx b/src/app/settings/profile/totp-create-dialog.tsx index 38357a3..647a6f2 100644 --- a/src/app/settings/profile/totp-create-dialog.tsx +++ b/src/app/settings/profile/totp-create-dialog.tsx @@ -2,19 +2,19 @@ import { SubmitButton } from "@/components/custom/submit-button"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; -import { FormUtils } from "@/lib/form.utilts"; +import { FormUtils } from "@/frontend/utils/form.utilts"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { useFormState } from "react-dom"; -import { ServerActionResult } from "@/model/server-action-error-return.model"; +import { ServerActionResult } from "@/shared/model/server-action-error-return.model"; import { Input } from "@/components/ui/input"; import { useEffect } from "react"; import { toast } from "sonner"; import { createNewTotpToken, verifyTotpToken } from "./actions"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import React from "react"; -import { TotpModel, totpZodModel } from "@/model/totp.model"; -import { Toast } from "@/lib/toast.utils"; +import { TotpModel, totpZodModel } from "@/shared/model/totp.model"; +import { Toast } from "@/frontend/utils/toast.utils"; import FullLoadingSpinner from "@/components/ui/full-loading-spinnter"; export default function TotpCreateDialog({ diff --git a/src/app/settings/profile/totp-settings.tsx b/src/app/settings/profile/totp-settings.tsx index 3897b74..34250f6 100644 --- a/src/app/settings/profile/totp-settings.tsx +++ b/src/app/settings/profile/totp-settings.tsx @@ -2,7 +2,7 @@ import { Card, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { deactivate2fa } from "./actions"; -import { Toast } from "@/lib/toast.utils"; +import { Toast } from "@/frontend/utils/toast.utils"; import TotpCreateDialog from "./totp-create-dialog"; import { Button } from "@/components/ui/button"; diff --git a/src/app/settings/server/actions.ts b/src/app/settings/server/actions.ts index 8f17b83..e807322 100644 --- a/src/app/settings/server/actions.ts +++ b/src/app/settings/server/actions.ts @@ -2,10 +2,10 @@ import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils/action-wrapper.utils"; import paramService, { ParamService } from "@/server/services/param.service"; -import { QsIngressSettingsModel, qsIngressSettingsZodModel } from "@/model/qs-settings.model"; -import { QsLetsEncryptSettingsModel, qsLetsEncryptSettingsZodModel } from "@/model/qs-letsencrypt-settings.model"; +import { QsIngressSettingsModel, qsIngressSettingsZodModel } from "@/shared/model/qs-settings.model"; +import { QsLetsEncryptSettingsModel, qsLetsEncryptSettingsZodModel } from "@/shared/model/qs-letsencrypt-settings.model"; import quickStackService from "@/server/services/qs.service"; -import { ServerActionResult, SuccessActionResult } from "@/model/server-action-error-return.model"; +import { ServerActionResult, SuccessActionResult } from "@/shared/model/server-action-error-return.model"; export const updateIngressSettings = async (prevState: any, inputData: QsIngressSettingsModel) => saveFormAction(inputData, qsIngressSettingsZodModel, async (validatedData) => { diff --git a/src/app/settings/server/qs-ingress-settings.tsx b/src/app/settings/server/qs-ingress-settings.tsx index d656029..0717525 100644 --- a/src/app/settings/server/qs-ingress-settings.tsx +++ b/src/app/settings/server/qs-ingress-settings.tsx @@ -3,15 +3,15 @@ import { SubmitButton } from "@/components/custom/submit-button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; -import { FormUtils } from "@/lib/form.utilts"; +import { FormUtils } from "@/frontend/utils/form.utilts"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { useFormState } from "react-dom"; -import { ServerActionResult } from "@/model/server-action-error-return.model"; +import { ServerActionResult } from "@/shared/model/server-action-error-return.model"; import { Input } from "@/components/ui/input"; import { useEffect } from "react"; import { toast } from "sonner"; -import { QsIngressSettingsModel, qsIngressSettingsZodModel } from "@/model/qs-settings.model"; +import { QsIngressSettingsModel, qsIngressSettingsZodModel } from "@/shared/model/qs-settings.model"; import { updateIngressSettings } from "./actions"; import CheckboxFormField from "@/components/custom/checkbox-form-field"; diff --git a/src/app/settings/server/qs-letsencrypt-settings.tsx b/src/app/settings/server/qs-letsencrypt-settings.tsx index 14f98d2..b6133b8 100644 --- a/src/app/settings/server/qs-letsencrypt-settings.tsx +++ b/src/app/settings/server/qs-letsencrypt-settings.tsx @@ -3,16 +3,16 @@ import { SubmitButton } from "@/components/custom/submit-button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; -import { FormUtils } from "@/lib/form.utilts"; +import { FormUtils } from "@/frontend/utils/form.utilts"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { useFormState } from "react-dom"; -import { ServerActionResult } from "@/model/server-action-error-return.model"; +import { ServerActionResult } from "@/shared/model/server-action-error-return.model"; import { Input } from "@/components/ui/input"; import { useEffect } from "react"; import { toast } from "sonner"; import { updateLetsEncryptSettings } from "./actions"; -import { QsLetsEncryptSettingsModel, qsLetsEncryptSettingsZodModel } from "@/model/qs-letsencrypt-settings.model"; +import { QsLetsEncryptSettingsModel, qsLetsEncryptSettingsZodModel } from "@/shared/model/qs-letsencrypt-settings.model"; export default function QuickStackLetsEncryptSettings({ letsEncryptMail, diff --git a/src/app/settings/server/qs-maintenance-settings.tsx b/src/app/settings/server/qs-maintenance-settings.tsx index 427e96b..4c7baa2 100644 --- a/src/app/settings/server/qs-maintenance-settings.tsx +++ b/src/app/settings/server/qs-maintenance-settings.tsx @@ -3,8 +3,8 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { updateQuickstack } from "./actions"; import { Button } from "@/components/ui/button"; -import { Toast } from "@/lib/toast.utils"; -import { useConfirmDialog } from "@/lib/zustand.states"; +import { Toast } from "@/frontend/utils/toast.utils"; +import { useConfirmDialog } from "@/frontend/states/zustand.states"; export default function QuickStackMaintenanceSettings() { diff --git a/src/components/custom/confirm-dialog.tsx b/src/components/custom/confirm-dialog.tsx index 8f2b34e..405f44f 100644 --- a/src/components/custom/confirm-dialog.tsx +++ b/src/components/custom/confirm-dialog.tsx @@ -10,7 +10,7 @@ import { DialogTitle, } from "@/components/ui/dialog" import React from "react"; -import { useConfirmDialog } from "@/lib/zustand.states"; +import { useConfirmDialog } from "@/frontend/states/zustand.states"; export function ConfirmDialog() { const { isDialogOpen, data, closeDialog } = useConfirmDialog(); diff --git a/src/components/custom/multiselect-field.tsx b/src/components/custom/multiselect-field.tsx index f767f14..40b01f0 100644 --- a/src/components/custom/multiselect-field.tsx +++ b/src/components/custom/multiselect-field.tsx @@ -1,7 +1,7 @@ import { CaretSortIcon, CheckIcon, Cross2Icon } from '@radix-ui/react-icons' import * as React from 'react' -import { cn } from '@/lib/utils' +import { cn } from '@/frontend/utils/utils' import { Command, diff --git a/src/components/ui/alert-dialog.tsx b/src/components/ui/alert-dialog.tsx index 25e7b47..de5cb10 100644 --- a/src/components/ui/alert-dialog.tsx +++ b/src/components/ui/alert-dialog.tsx @@ -3,7 +3,7 @@ import * as React from "react" import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" import { buttonVariants } from "@/components/ui/button" const AlertDialog = AlertDialogPrimitive.Root diff --git a/src/components/ui/breadcrumb.tsx b/src/components/ui/breadcrumb.tsx index 60e6c96..3618ad7 100644 --- a/src/components/ui/breadcrumb.tsx +++ b/src/components/ui/breadcrumb.tsx @@ -2,7 +2,7 @@ import * as React from "react" import { Slot } from "@radix-ui/react-slot" import { ChevronRight, MoreHorizontal } from "lucide-react" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const Breadcrumb = React.forwardRef< HTMLElement, diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 36496a2..aa45a8c 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -2,7 +2,7 @@ import * as React from "react" import { Slot } from "@radix-ui/react-slot" import { cva, type VariantProps } from "class-variance-authority" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const buttonVariants = cva( "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", diff --git a/src/components/ui/calendar.tsx b/src/components/ui/calendar.tsx index 83c173a..f18460d 100644 --- a/src/components/ui/calendar.tsx +++ b/src/components/ui/calendar.tsx @@ -4,7 +4,7 @@ import * as React from "react" import { ChevronLeft, ChevronRight } from "lucide-react" import { DayPicker } from "react-day-picker" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" import { buttonVariants } from "@/components/ui/button" export type CalendarProps = React.ComponentProps diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx index afa13ec..5ddaf41 100644 --- a/src/components/ui/card.tsx +++ b/src/components/ui/card.tsx @@ -1,6 +1,6 @@ import * as React from "react" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const Card = React.forwardRef< HTMLDivElement, diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsx index df61a13..84dd339 100644 --- a/src/components/ui/checkbox.tsx +++ b/src/components/ui/checkbox.tsx @@ -4,7 +4,7 @@ import * as React from "react" import * as CheckboxPrimitive from "@radix-ui/react-checkbox" import { Check } from "lucide-react" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const Checkbox = React.forwardRef< React.ElementRef, diff --git a/src/components/ui/column-header.tsx b/src/components/ui/column-header.tsx index 89a62a3..a7521e4 100644 --- a/src/components/ui/column-header.tsx +++ b/src/components/ui/column-header.tsx @@ -1,4 +1,4 @@ -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" import { Button } from "./button" import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from "./dropdown-menu" import { diff --git a/src/components/ui/command.tsx b/src/components/ui/command.tsx index 1a37e67..de05e36 100644 --- a/src/components/ui/command.tsx +++ b/src/components/ui/command.tsx @@ -5,7 +5,7 @@ import { type DialogProps } from "@radix-ui/react-dialog" import { Command as CommandPrimitive } from "cmdk" import { Search } from "lucide-react" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" import { Dialog, DialogContent } from "@/components/ui/dialog" const Command = React.forwardRef< diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index 01ff19c..55dd81e 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -4,7 +4,7 @@ import * as React from "react" import * as DialogPrimitive from "@radix-ui/react-dialog" import { X } from "lucide-react" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const Dialog = DialogPrimitive.Root diff --git a/src/components/ui/drawer.tsx b/src/components/ui/drawer.tsx index 6a0ef53..eacf39b 100644 --- a/src/components/ui/drawer.tsx +++ b/src/components/ui/drawer.tsx @@ -3,7 +3,7 @@ import * as React from "react" import { Drawer as DrawerPrimitive } from "vaul" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const Drawer = ({ shouldScaleBackground = true, diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsx index f69a0d6..159608f 100644 --- a/src/components/ui/dropdown-menu.tsx +++ b/src/components/ui/dropdown-menu.tsx @@ -4,7 +4,7 @@ import * as React from "react" import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" import { Check, ChevronRight, Circle } from "lucide-react" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const DropdownMenu = DropdownMenuPrimitive.Root diff --git a/src/components/ui/form.tsx b/src/components/ui/form.tsx index ce264ae..764fe39 100644 --- a/src/components/ui/form.tsx +++ b/src/components/ui/form.tsx @@ -12,7 +12,7 @@ import { useFormContext, } from "react-hook-form" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" import { Label } from "@/components/ui/label" const Form = FormProvider diff --git a/src/components/ui/full-loading-spinnter.tsx b/src/components/ui/full-loading-spinnter.tsx index 604f1b0..e5a1a1f 100644 --- a/src/components/ui/full-loading-spinnter.tsx +++ b/src/components/ui/full-loading-spinnter.tsx @@ -1,4 +1,4 @@ -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" import LoadingSpinner from "./loading-spinner"; export default function FullLoadingSpinner() { diff --git a/src/components/ui/hover-card.tsx b/src/components/ui/hover-card.tsx index e54d91c..ce06049 100644 --- a/src/components/ui/hover-card.tsx +++ b/src/components/ui/hover-card.tsx @@ -3,7 +3,7 @@ import * as React from "react" import * as HoverCardPrimitive from "@radix-ui/react-hover-card" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const HoverCard = HoverCardPrimitive.Root diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx index 677d05f..b8a45c8 100644 --- a/src/components/ui/input.tsx +++ b/src/components/ui/input.tsx @@ -1,6 +1,6 @@ import * as React from "react" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" export interface InputProps extends React.InputHTMLAttributes {} diff --git a/src/components/ui/label.tsx b/src/components/ui/label.tsx index 5341821..c0f8825 100644 --- a/src/components/ui/label.tsx +++ b/src/components/ui/label.tsx @@ -4,7 +4,7 @@ import * as React from "react" import * as LabelPrimitive from "@radix-ui/react-label" import { cva, type VariantProps } from "class-variance-authority" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const labelVariants = cva( "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" diff --git a/src/components/ui/loading-spinner.tsx b/src/components/ui/loading-spinner.tsx index 89f3965..2ffe6c3 100644 --- a/src/components/ui/loading-spinner.tsx +++ b/src/components/ui/loading-spinner.tsx @@ -1,4 +1,4 @@ -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" export default function LoadingSpinner() { return , diff --git a/src/components/ui/select.tsx b/src/components/ui/select.tsx index cbe5a36..4e56e53 100644 --- a/src/components/ui/select.tsx +++ b/src/components/ui/select.tsx @@ -4,7 +4,7 @@ import * as React from "react" import * as SelectPrimitive from "@radix-ui/react-select" import { Check, ChevronDown, ChevronUp } from "lucide-react" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const Select = SelectPrimitive.Root diff --git a/src/components/ui/skeleton.tsx b/src/components/ui/skeleton.tsx index 01b8b6d..e0619ef 100644 --- a/src/components/ui/skeleton.tsx +++ b/src/components/ui/skeleton.tsx @@ -1,4 +1,4 @@ -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" function Skeleton({ className, diff --git a/src/components/ui/table.tsx b/src/components/ui/table.tsx index 7f3502f..ebd668c 100644 --- a/src/components/ui/table.tsx +++ b/src/components/ui/table.tsx @@ -1,6 +1,6 @@ import * as React from "react" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const Table = React.forwardRef< HTMLTableElement, diff --git a/src/components/ui/tabs.tsx b/src/components/ui/tabs.tsx index 26eb109..43b3402 100644 --- a/src/components/ui/tabs.tsx +++ b/src/components/ui/tabs.tsx @@ -3,7 +3,7 @@ import * as React from "react" import * as TabsPrimitive from "@radix-ui/react-tabs" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const Tabs = TabsPrimitive.Root diff --git a/src/components/ui/textarea.tsx b/src/components/ui/textarea.tsx index 9f9a6dc..4e6e430 100644 --- a/src/components/ui/textarea.tsx +++ b/src/components/ui/textarea.tsx @@ -1,6 +1,6 @@ import * as React from "react" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" export interface TextareaProps extends React.TextareaHTMLAttributes {} diff --git a/src/components/ui/tooltip.tsx b/src/components/ui/tooltip.tsx index 30fc44d..60a9b43 100644 --- a/src/components/ui/tooltip.tsx +++ b/src/components/ui/tooltip.tsx @@ -3,7 +3,7 @@ import * as React from "react" import * as TooltipPrimitive from "@radix-ui/react-tooltip" -import { cn } from "@/lib/utils" +import { cn } from "@/frontend/utils/utils" const TooltipProvider = TooltipPrimitive.Provider diff --git a/src/lib/sockets.ts b/src/frontend/sockets/sockets.ts similarity index 100% rename from src/lib/sockets.ts rename to src/frontend/sockets/sockets.ts diff --git a/src/lib/zustand.states.ts b/src/frontend/states/zustand.states.ts similarity index 100% rename from src/lib/zustand.states.ts rename to src/frontend/states/zustand.states.ts diff --git a/src/lib/form.utilts.ts b/src/frontend/utils/form.utilts.ts similarity index 90% rename from src/lib/form.utilts.ts rename to src/frontend/utils/form.utilts.ts index 69f3522..fa99bab 100644 --- a/src/lib/form.utilts.ts +++ b/src/frontend/utils/form.utilts.ts @@ -1,4 +1,4 @@ -import { ServerActionResult, SuccessActionResult } from "@/model/server-action-error-return.model"; +import { ServerActionResult, SuccessActionResult } from "@/shared/model/server-action-error-return.model"; import { UseFormReturn } from "react-hook-form"; import { z, ZodType } from "zod"; diff --git a/src/lib/format.utils.ts b/src/frontend/utils/format.utils.ts similarity index 100% rename from src/lib/format.utils.ts rename to src/frontend/utils/format.utils.ts diff --git a/src/lib/toast.utils.ts b/src/frontend/utils/toast.utils.ts similarity index 94% rename from src/lib/toast.utils.ts rename to src/frontend/utils/toast.utils.ts index e6087e0..ef9fea2 100644 --- a/src/lib/toast.utils.ts +++ b/src/frontend/utils/toast.utils.ts @@ -1,4 +1,4 @@ -import { ServerActionResult } from "@/model/server-action-error-return.model"; +import { ServerActionResult } from "@/shared/model/server-action-error-return.model"; import { toast } from "sonner"; export class Toast { diff --git a/src/lib/utils.ts b/src/frontend/utils/utils.ts similarity index 100% rename from src/lib/utils.ts rename to src/frontend/utils/utils.ts diff --git a/src/server.ts b/src/server.ts index 81f6946..c4f1722 100644 --- a/src/server.ts +++ b/src/server.ts @@ -5,8 +5,8 @@ import socketIoServer from './socket-io.server' import quickStackService from './server/services/qs.service' import { CommandExecutorUtils } from './server/utils/command-executor.utils' import dataAccess from './server/adapter/db.client' -import { FancyConsoleUtils } from './server/utils/fancy-console.utils' -import { Constants } from './server/utils/constants' +import { FancyConsoleUtils } from './shared/utils/fancy-console.utils' +import { Constants } from './shared/utils/constants' // Source: https://nextjs.org/docs/app/building-your-application/configuring/custom-server diff --git a/src/server/adapter/db.client.ts b/src/server/adapter/db.client.ts index 11c50e3..c33f614 100644 --- a/src/server/adapter/db.client.ts +++ b/src/server/adapter/db.client.ts @@ -1,6 +1,6 @@ import { Prisma, PrismaClient } from "@prisma/client"; import { DefaultArgs } from "@prisma/client/runtime/library"; -import { ListUtils } from "../utils/list.utils"; +import { ListUtils } from "../../shared/utils/list.utils"; type clientType = keyof PrismaClient; diff --git a/src/server/services/app.service.ts b/src/server/services/app.service.ts index 000c32d..d13d999 100644 --- a/src/server/services/app.service.ts +++ b/src/server/services/app.service.ts @@ -3,9 +3,9 @@ import dataAccess from "../adapter/db.client"; import { Tags } from "../utils/cache-tag-generator.utils"; import { App, AppDomain, AppVolume, Prisma } from "@prisma/client"; import { DefaultArgs } from "@prisma/client/runtime/library"; -import { AppExtendedModel } from "@/model/app-extended.model"; -import { ServiceException } from "@/model/service.exception.model"; -import { StringUtils } from "../utils/string.utils"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; +import { ServiceException } from "@/shared/model/service.exception.model"; +import { KubeObjectNameUtils } from "../utils/kube-object-name.utils"; import deploymentService from "./deployment.service"; import buildService, { BUILD_NAMESPACE } from "./build.service"; import namespaceService from "./namespace.service"; @@ -100,7 +100,7 @@ class AppService { data: item }); } else { - item.id = StringUtils.toAppId(item.name as string); + item.id = KubeObjectNameUtils.toAppId(item.name as string); savedItem = dataAccess.client.app.create({ data: item as Prisma.AppUncheckedCreateInput }); diff --git a/src/server/services/build.service.ts b/src/server/services/build.service.ts index fdbd478..69f9b2c 100644 --- a/src/server/services/build.service.ts +++ b/src/server/services/build.service.ts @@ -1,12 +1,12 @@ -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; import k3s from "../adapter/kubernetes-api.adapter"; import { V1Job, V1JobStatus } from "@kubernetes/client-node"; -import { StringUtils } from "../utils/string.utils"; -import { BuildJobModel } from "@/model/build-job"; -import { ServiceException } from "@/model/service.exception.model"; -import { PodsInfoModel } from "@/model/pods-info.model"; +import { KubeObjectNameUtils } from "../utils/kube-object-name.utils"; +import { BuildJobModel } from "@/shared/model/build-job"; +import { ServiceException } from "@/shared/model/service.exception.model"; +import { PodsInfoModel } from "@/shared/model/pods-info.model"; import namespaceService from "./namespace.service"; -import { Constants } from "../utils/constants"; +import { Constants } from "../../shared/utils/constants"; import gitService from "./git.service"; import deploymentService from "./deployment.service"; import deploymentLogService from "./deployment-logs.service"; @@ -46,7 +46,7 @@ class BuildService { private async createAndStartBuildJob(app: AppExtendedModel, latestRemoteGitHash: string): Promise<[string, string, Promise]> { - const buildName = StringUtils.addRandomSuffix(StringUtils.toJobName(app.id)); + const buildName = KubeObjectNameUtils.addRandomSuffix(KubeObjectNameUtils.toJobName(app.id)); const jobDefinition: V1Job = { apiVersion: "batch/v1", kind: "Job", @@ -118,7 +118,7 @@ class BuildService { async deleteAllBuildsOfApp(appId: string) { - const jobNamePrefix = StringUtils.toJobName(appId); + const jobNamePrefix = KubeObjectNameUtils.toJobName(appId); const jobs = await k3s.batch.listNamespacedJob(BUILD_NAMESPACE); const jobsOfBuild = jobs.body.items.filter((job) => job.metadata?.name?.startsWith(jobNamePrefix)); for (const job of jobsOfBuild) { @@ -140,7 +140,7 @@ class BuildService { } async getBuildsForApp(appId: string) { - const jobNamePrefix = StringUtils.toJobName(appId); + const jobNamePrefix = KubeObjectNameUtils.toJobName(appId); const jobs = await k3s.batch.listNamespacedJob(BUILD_NAMESPACE); const jobsOfBuild = jobs.body.items.filter((job) => job.metadata?.name?.startsWith(jobNamePrefix)); const builds = jobsOfBuild.map((job) => { diff --git a/src/server/services/deployment.service.ts b/src/server/services/deployment.service.ts index 19b9580..9d1294c 100644 --- a/src/server/services/deployment.service.ts +++ b/src/server/services/deployment.service.ts @@ -1,17 +1,17 @@ -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; import k3s from "../adapter/kubernetes-api.adapter"; import { V1Deployment, V1ReplicaSet } from "@kubernetes/client-node"; import buildService from "./build.service"; -import { ListUtils } from "../utils/list.utils"; -import { DeploymentInfoModel, DeplyomentStatus } from "@/model/deployment-info.model"; -import { BuildJobStatus } from "@/model/build-job"; -import { ServiceException } from "@/model/service.exception.model"; -import { PodsInfoModel } from "@/model/pods-info.model"; -import { StringUtils } from "../utils/string.utils"; +import { ListUtils } from "../../shared/utils/list.utils"; +import { DeploymentInfoModel, DeplyomentStatus } from "@/shared/model/deployment-info.model"; +import { BuildJobStatus } from "@/shared/model/build-job"; +import { ServiceException } from "@/shared/model/service.exception.model"; +import { PodsInfoModel } from "@/shared/model/pods-info.model"; +import { KubeObjectNameUtils } from "../utils/kube-object-name.utils"; import pvcService from "./pvc.service"; import ingressService from "./ingress.service"; import namespaceService from "./namespace.service"; -import { Constants } from "../utils/constants"; +import { Constants } from "../../shared/utils/constants"; import svcService from "./svc.service"; class DeploymentService { diff --git a/src/server/services/git.service.ts b/src/server/services/git.service.ts index 97421b6..a21a476 100644 --- a/src/server/services/git.service.ts +++ b/src/server/services/git.service.ts @@ -1,5 +1,5 @@ -import { ServiceException } from "@/model/service.exception.model"; -import { AppExtendedModel } from "@/model/app-extended.model"; +import { ServiceException } from "@/shared/model/service.exception.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; import simpleGit from "simple-git"; import { PathUtils } from "../utils/path.utils"; import { FsUtils } from "../utils/fs.utils"; diff --git a/src/server/services/ingress.service.ts b/src/server/services/ingress.service.ts index 65d7a60..64cbcd0 100644 --- a/src/server/services/ingress.service.ts +++ b/src/server/services/ingress.service.ts @@ -1,9 +1,9 @@ -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; import k3s from "../adapter/kubernetes-api.adapter"; import { V1Ingress } from "@kubernetes/client-node"; -import { StringUtils } from "../utils/string.utils"; +import { KubeObjectNameUtils } from "../utils/kube-object-name.utils"; import { App, AppDomain } from "@prisma/client"; -import { Constants } from "../utils/constants"; +import { Constants } from "../../shared/utils/constants"; const traefikNamespace = 'kube-system'; @@ -17,7 +17,7 @@ class IngressService { async getIngress(projectId: string, domainId: string) { const res = await k3s.network.listNamespacedIngress(projectId); - return res.body.items.find((item) => item.metadata?.name === StringUtils.getIngressName(domainId)); + return res.body.items.find((item) => item.metadata?.name === KubeObjectNameUtils.getIngressName(domainId)); } async deleteUnusedIngressesOfApp(app: AppExtendedModel) { @@ -63,7 +63,7 @@ class IngressService { async createIngress(app: AppExtendedModel, domain: AppDomain) { const hostname = domain.hostname; - const ingressName = StringUtils.getIngressName(domain.id); + const ingressName = KubeObjectNameUtils.getIngressName(domain.id); const existingIngress = await this.getIngress(app.projectId, domain.id); const ingressDefinition: V1Ingress = { @@ -92,7 +92,7 @@ class IngressService { pathType: 'Prefix', backend: { service: { - name: StringUtils.toServiceName(app.id), + name: KubeObjectNameUtils.toServiceName(app.id), port: { number: domain.port, }, diff --git a/src/server/services/namespace.service.ts b/src/server/services/namespace.service.ts index 14ff1b1..7a553f2 100644 --- a/src/server/services/namespace.service.ts +++ b/src/server/services/namespace.service.ts @@ -1,16 +1,16 @@ -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; import k3s from "../adapter/kubernetes-api.adapter"; import { V1Deployment, V1Ingress, V1PersistentVolumeClaim } from "@kubernetes/client-node"; import buildService from "./build.service"; -import { ListUtils } from "../utils/list.utils"; -import { DeploymentInfoModel, DeplyomentStatus } from "@/model/deployment-info.model"; -import { BuildJobStatus } from "@/model/build-job"; -import { ServiceException } from "@/model/service.exception.model"; -import { PodsInfoModel } from "@/model/pods-info.model"; -import { StringUtils } from "../utils/string.utils"; +import { ListUtils } from "../../shared/utils/list.utils"; +import { DeploymentInfoModel, DeplyomentStatus } from "@/shared/model/deployment-info.model"; +import { BuildJobStatus } from "@/shared/model/build-job"; +import { ServiceException } from "@/shared/model/service.exception.model"; +import { PodsInfoModel } from "@/shared/model/pods-info.model"; +import { KubeObjectNameUtils } from "../utils/kube-object-name.utils"; import pvcService from "./pvc.service"; import ingressService from "./ingress.service"; -import { Constants } from "../utils/constants"; +import { Constants } from "../../shared/utils/constants"; class NamespaceService { diff --git a/src/server/services/node.service.ts b/src/server/services/node.service.ts index 4b087f3..b7c6dda 100644 --- a/src/server/services/node.service.ts +++ b/src/server/services/node.service.ts @@ -1,6 +1,6 @@ import { spec } from "node:test/reporters"; import k3s from "../adapter/kubernetes-api.adapter"; -import { NodeInfoModel } from "@/model/node-info.model"; +import { NodeInfoModel } from "@/shared/model/node-info.model"; import { Tags } from "../utils/cache-tag-generator.utils"; import { revalidateTag, unstable_cache } from "next/cache"; diff --git a/src/server/services/param.service.ts b/src/server/services/param.service.ts index c45cdda..6db94e6 100644 --- a/src/server/services/param.service.ts +++ b/src/server/services/param.service.ts @@ -2,7 +2,7 @@ import { revalidateTag, unstable_cache } from "next/cache"; import dataAccess from "../adapter/db.client"; import { Tags } from "../utils/cache-tag-generator.utils"; import { Parameter, Prisma } from "@prisma/client"; -import { Constants } from "../utils/constants"; +import { Constants } from "../../shared/utils/constants"; export class ParamService { diff --git a/src/server/services/pod.service.ts b/src/server/services/pod.service.ts index 93a400b..973726d 100644 --- a/src/server/services/pod.service.ts +++ b/src/server/services/pod.service.ts @@ -1,6 +1,6 @@ -import { PodsInfoModel } from "@/model/pods-info.model"; +import { PodsInfoModel } from "@/shared/model/pods-info.model"; import k3s from "../adapter/kubernetes-api.adapter"; -import { ServiceException } from "@/model/service.exception.model"; +import { ServiceException } from "@/shared/model/service.exception.model"; import setupPodService from "./setup-services/setup-pod.service"; diff --git a/src/server/services/project.service.ts b/src/server/services/project.service.ts index 74d0fc1..465e7f9 100644 --- a/src/server/services/project.service.ts +++ b/src/server/services/project.service.ts @@ -2,7 +2,7 @@ import { revalidateTag, unstable_cache } from "next/cache"; import dataAccess from "../adapter/db.client"; import { Tags } from "../utils/cache-tag-generator.utils"; import { Prisma, Project } from "@prisma/client"; -import { StringUtils } from "../utils/string.utils"; +import { KubeObjectNameUtils } from "../utils/kube-object-name.utils"; import deploymentService from "./deployment.service"; import namespaceService from "./namespace.service"; import buildService from "./build.service"; @@ -53,7 +53,7 @@ class ProjectService { data: item }); } else { - item.id = StringUtils.toProjectId(item.name as string); + item.id = KubeObjectNameUtils.toProjectId(item.name as string); savedItem = await dataAccess.client.project.create({ data: item as Prisma.ProjectUncheckedCreateInput }); diff --git a/src/server/services/pvc.service.ts b/src/server/services/pvc.service.ts index cb4e5cf..f3c422c 100644 --- a/src/server/services/pvc.service.ts +++ b/src/server/services/pvc.service.ts @@ -1,10 +1,10 @@ -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; import k3s from "../adapter/kubernetes-api.adapter"; import { V1PersistentVolumeClaim } from "@kubernetes/client-node"; -import { ServiceException } from "@/model/service.exception.model"; +import { ServiceException } from "@/shared/model/service.exception.model"; import { AppVolume } from "@prisma/client"; -import { StringUtils } from "../utils/string.utils"; -import { Constants } from "../utils/constants"; +import { KubeObjectNameUtils } from "../utils/kube-object-name.utils"; +import { Constants } from "../../shared/utils/constants"; import { MemoryCalcUtils } from "../utils/memory-caluclation.utils"; class PvcService { @@ -15,7 +15,7 @@ class PvcService { const existingPvcs = await this.getAllPvcForApp(app.projectId, app.id); for (const appVolume of app.appVolumes) { - const pvcName = StringUtils.toPvcName(appVolume.id); + const pvcName = KubeObjectNameUtils.toPvcName(appVolume.id); const existingPvc = existingPvcs.find(pvc => pvc.metadata?.name === pvcName); if (existingPvc && existingPvc.spec!.resources!.requests!.storage !== MemoryCalcUtils.formatSize(appVolume.size)) { return true; @@ -56,7 +56,7 @@ class PvcService { const existingPvcs = await this.getAllPvcForApp(app.projectId, app.id); for (const appVolume of app.appVolumes) { - const pvcName = StringUtils.toPvcName(appVolume.id); + const pvcName = KubeObjectNameUtils.toPvcName(appVolume.id); const pvcDefinition: V1PersistentVolumeClaim = { apiVersion: 'v1', @@ -107,16 +107,16 @@ class PvcService { const volumes = app.appVolumes .filter(pvcObj => pvcObj.appId === app.id) .map(pvcObj => ({ - name: StringUtils.toPvcName(pvcObj.id), + name: KubeObjectNameUtils.toPvcName(pvcObj.id), persistentVolumeClaim: { - claimName: StringUtils.toPvcName(pvcObj.id) + claimName: KubeObjectNameUtils.toPvcName(pvcObj.id) }, })); const volumeMounts = app.appVolumes .filter(pvcObj => pvcObj.appId === app.id) .map(pvcObj => ({ - name: StringUtils.toPvcName(pvcObj.id), + name: KubeObjectNameUtils.toPvcName(pvcObj.id), mountPath: pvcObj.containerMountPath, })); diff --git a/src/server/services/qs.service.ts b/src/server/services/qs.service.ts index c0e2b38..bc4c495 100644 --- a/src/server/services/qs.service.ts +++ b/src/server/services/qs.service.ts @@ -1,9 +1,9 @@ import k3s from "../adapter/kubernetes-api.adapter"; import { V1Deployment, V1Ingress, V1Service } from "@kubernetes/client-node"; import namespaceService from "./namespace.service"; -import { StringUtils } from "../utils/string.utils"; +import { KubeObjectNameUtils } from "../utils/kube-object-name.utils"; import crypto from "crypto"; -import { FancyConsoleUtils } from "../utils/fancy-console.utils"; +import { FancyConsoleUtils } from "../../shared/utils/fancy-console.utils"; import setupPodService from "./setup-services/setup-pod.service"; class QuickStackService { @@ -57,7 +57,7 @@ class QuickStackService { } async createOrUpdateIngress(hostname: string) { - const ingressName = StringUtils.getIngressName(this.QUICKSTACK_NAMESPACE); + const ingressName = KubeObjectNameUtils.getIngressName(this.QUICKSTACK_NAMESPACE); const existingIngresses = await k3s.network.listNamespacedIngress(this.QUICKSTACK_NAMESPACE); const existingIngress = existingIngresses.body.items.find((item) => item.metadata?.name === ingressName); @@ -84,7 +84,7 @@ class QuickStackService { pathType: 'Prefix', backend: { service: { - name: StringUtils.toServiceName(this.QUICKSTACK_DEPLOYMENT_NAME), + name: KubeObjectNameUtils.toServiceName(this.QUICKSTACK_DEPLOYMENT_NAME), port: { number: this.QUICKSTACK_PORT_NUMBER, }, @@ -185,7 +185,7 @@ class QuickStackService { } async createOrUpdateService(openNodePort = false) { - const serviceName = StringUtils.toServiceName(this.QUICKSTACK_DEPLOYMENT_NAME); + const serviceName = KubeObjectNameUtils.toServiceName(this.QUICKSTACK_DEPLOYMENT_NAME); const body: V1Service = { apiVersion: 'v1', kind: 'Service', @@ -223,7 +223,7 @@ class QuickStackService { } private async createOrUpdatePvc() { - const pvcName = StringUtils.toPvcName(this.QUICKSTACK_DEPLOYMENT_NAME); + const pvcName = KubeObjectNameUtils.toPvcName(this.QUICKSTACK_DEPLOYMENT_NAME); const pvc = { apiVersion: 'v1', kind: 'PersistentVolumeClaim', @@ -318,7 +318,7 @@ class QuickStackService { volumes: [{ name: 'quickstack-volume', persistentVolumeClaim: { - claimName: StringUtils.toPvcName(this.QUICKSTACK_DEPLOYMENT_NAME) + claimName: KubeObjectNameUtils.toPvcName(this.QUICKSTACK_DEPLOYMENT_NAME) } }] } diff --git a/src/server/services/svc.service.ts b/src/server/services/svc.service.ts index 1a1290a..2be4b27 100644 --- a/src/server/services/svc.service.ts +++ b/src/server/services/svc.service.ts @@ -1,10 +1,10 @@ -import { AppExtendedModel } from "@/model/app-extended.model"; +import { AppExtendedModel } from "@/shared/model/app-extended.model"; import k3s from "../adapter/kubernetes-api.adapter"; import { V1PersistentVolumeClaim } from "@kubernetes/client-node"; -import { ServiceException } from "@/model/service.exception.model"; +import { ServiceException } from "@/shared/model/service.exception.model"; import { AppVolume } from "@prisma/client"; -import { StringUtils } from "../utils/string.utils"; -import { Constants } from "../utils/constants"; +import { KubeObjectNameUtils } from "../utils/kube-object-name.utils"; +import { Constants } from "../../shared/utils/constants"; class SvcService { @@ -13,16 +13,16 @@ class SvcService { if (!existingService) { return; } - const returnVal = await k3s.core.deleteNamespacedService(StringUtils.toServiceName(appId), projectId); - console.log(`Deleted Service ${StringUtils.toServiceName(appId)} in namespace ${projectId}`); + const returnVal = await k3s.core.deleteNamespacedService(KubeObjectNameUtils.toServiceName(appId), projectId); + console.log(`Deleted Service ${KubeObjectNameUtils.toServiceName(appId)} in namespace ${projectId}`); return returnVal; } async getService(projectId: string, appId: string) { const allServices = await k3s.core.listNamespacedService(projectId); - if (allServices.body.items.some((item) => item.metadata?.name === StringUtils.toServiceName(appId))) { - const res = await k3s.core.readNamespacedService(StringUtils.toServiceName(appId), projectId); + if (allServices.body.items.some((item) => item.metadata?.name === KubeObjectNameUtils.toServiceName(appId))) { + const res = await k3s.core.readNamespacedService(KubeObjectNameUtils.toServiceName(appId), projectId); return res.body; } } @@ -50,7 +50,7 @@ class SvcService { const body = { metadata: { - name: StringUtils.toServiceName(app.id) + name: KubeObjectNameUtils.toServiceName(app.id) }, spec: { selector: { @@ -60,7 +60,7 @@ class SvcService { } }; if (existingService) { - await k3s.core.replaceNamespacedService(StringUtils.toServiceName(app.id), app.projectId, body); + await k3s.core.replaceNamespacedService(KubeObjectNameUtils.toServiceName(app.id), app.projectId, body); } else { await k3s.core.createNamespacedService(app.projectId, body); } diff --git a/src/server/services/user.service.ts b/src/server/services/user.service.ts index a6fb2a5..76a611f 100644 --- a/src/server/services/user.service.ts +++ b/src/server/services/user.service.ts @@ -3,7 +3,7 @@ import dataAccess from "../adapter/db.client"; import { revalidateTag, unstable_cache } from "next/cache"; import { Tags } from "../utils/cache-tag-generator.utils"; import bcrypt from "bcrypt"; -import { ServiceException } from "@/model/service.exception.model"; +import { ServiceException } from "@/shared/model/service.exception.model"; import QRCode from "qrcode"; import * as OTPAuth from "otpauth"; diff --git a/src/server/utils/action-wrapper.utils.ts b/src/server/utils/action-wrapper.utils.ts index 9a4b54c..1a413a4 100644 --- a/src/server/utils/action-wrapper.utils.ts +++ b/src/server/utils/action-wrapper.utils.ts @@ -1,11 +1,11 @@ -import { ServiceException } from "@/model/service.exception.model"; -import { UserSession } from "@/model/sim-session.model"; +import { ServiceException } from "@/shared/model/service.exception.model"; +import { UserSession } from "@/shared/model/sim-session.model"; import { getServerSession } from "next-auth"; import { ZodRawShape, ZodObject, objectUtil, baseObjectOutputType, z, ZodType } from "zod"; import { redirect } from "next/navigation"; -import { ServerActionResult } from "@/model/server-action-error-return.model"; -import { FormValidationException } from "@/model/form-validation-exception.model"; -import { authOptions } from "@/lib/auth-options"; +import { ServerActionResult } from "@/shared/model/server-action-error-return.model"; +import { FormValidationException } from "@/shared/model/form-validation-exception.model"; +import { authOptions } from "@/server/utils/auth-options"; import { NextResponse } from "next/server"; /** diff --git a/src/lib/auth-options.ts b/src/server/utils/auth-options.ts similarity index 79% rename from src/lib/auth-options.ts rename to src/server/utils/auth-options.ts index 313f2b4..67840f6 100644 --- a/src/lib/auth-options.ts +++ b/src/server/utils/auth-options.ts @@ -3,7 +3,7 @@ import NextAuth, { NextAuthOptions, Session } from "next-auth" import EmailProvider from "next-auth/providers/email"; import { PrismaAdapter } from "@next-auth/prisma-adapter" import { JWT } from "next-auth/jwt"; -import { UserSession } from "@/model/sim-session.model"; +import { UserSession } from "@/shared/model/sim-session.model"; import dataAccess from "@/server/adapter/db.client"; import CredentialsProvider from "next-auth/providers/credentials"; import bcrypt from "bcrypt"; @@ -54,25 +54,6 @@ export const authOptions: NextAuthOptions = { } }) ], - callbacks: { - /* async jwt({ token, user }) { - // Initial sign in - if (user) { - token.id = user.id; - token.role = 'tenant'; //user.role; - } - return token; - },*/ - /*async session({ session, token, user }) { - // Add the user's role to the session - const dbUser = user as User; - const simSession = session as SimSession; - simSession.userId = dbUser.id; - - - return simSession; - },*/ - }, adapter: PrismaAdapter(dataAccess.client), }; diff --git a/src/server/utils/string.utils.ts b/src/server/utils/kube-object-name.utils.ts similarity index 82% rename from src/server/utils/string.utils.ts rename to src/server/utils/kube-object-name.utils.ts index 75229b2..06ce5a8 100644 --- a/src/server/utils/string.utils.ts +++ b/src/server/utils/kube-object-name.utils.ts @@ -1,6 +1,6 @@ import * as crypto from 'crypto'; -export class StringUtils { +export class KubeObjectNameUtils { private static readonly MAX_OBJECT_NAME_LENGTH = 30; // in Kubernetes, the maximum length of an object name is 63 characters @@ -16,7 +16,7 @@ export class StringUtils { } static toObjectId(str: string): string { - let snakeCase = StringUtils.toSnakeCase(str); + let snakeCase = KubeObjectNameUtils.toSnakeCase(str); const randomString = crypto.randomBytes(4).toString('hex'); snakeCase = `${snakeCase}-${randomString}`; return snakeCase @@ -26,13 +26,13 @@ export class StringUtils { } static toProjectId(str: string): `proj-${string}` { - str = str.substring(0, StringUtils.MAX_OBJECT_NAME_LENGTH).trim(); - return `proj-${StringUtils.toObjectId(str)}`; + str = str.substring(0, KubeObjectNameUtils.MAX_OBJECT_NAME_LENGTH).trim(); + return `proj-${KubeObjectNameUtils.toObjectId(str)}`; } static toAppId(str: string): `app-${string}` { - str = str.substring(0, StringUtils.MAX_OBJECT_NAME_LENGTH).trim(); - return `app-${StringUtils.toObjectId(str)}`; + str = str.substring(0, KubeObjectNameUtils.MAX_OBJECT_NAME_LENGTH).trim(); + return `app-${KubeObjectNameUtils.toObjectId(str)}`; } static toJobName(appId: string): `build-${string}` { diff --git a/src/model/app-extended.model.ts b/src/shared/model/app-extended.model.ts similarity index 100% rename from src/model/app-extended.model.ts rename to src/shared/model/app-extended.model.ts diff --git a/src/model/app-rate-limits.model.ts b/src/shared/model/app-rate-limits.model.ts similarity index 80% rename from src/model/app-rate-limits.model.ts rename to src/shared/model/app-rate-limits.model.ts index 0256136..94a07ee 100644 --- a/src/model/app-rate-limits.model.ts +++ b/src/shared/model/app-rate-limits.model.ts @@ -1,4 +1,4 @@ -import { stringToNumber, stringToOptionalNumber } from "@/lib/zod.utils"; +import { stringToNumber, stringToOptionalNumber } from "@/shared/utils/zod.utils"; import { z } from "zod"; export const appRateLimitsZodModel = z.object({ diff --git a/src/model/app-source-info.model.ts b/src/shared/model/app-source-info.model.ts similarity index 100% rename from src/model/app-source-info.model.ts rename to src/shared/model/app-source-info.model.ts diff --git a/src/model/auth-form.ts b/src/shared/model/auth-form.ts similarity index 100% rename from src/model/auth-form.ts rename to src/shared/model/auth-form.ts diff --git a/src/model/build-job.ts b/src/shared/model/build-job.ts similarity index 100% rename from src/model/build-job.ts rename to src/shared/model/build-job.ts diff --git a/src/model/default-port.model.ts b/src/shared/model/default-port.model.ts similarity index 68% rename from src/model/default-port.model.ts rename to src/shared/model/default-port.model.ts index ce51fc2..3d719dc 100644 --- a/src/model/default-port.model.ts +++ b/src/shared/model/default-port.model.ts @@ -1,4 +1,4 @@ -import { stringToNumber, stringToOptionalNumber } from "@/lib/zod.utils"; +import { stringToNumber, stringToOptionalNumber } from "@/shared/utils/zod.utils"; import { z } from "zod"; export const appdefaultPortZodModel = z.object({ diff --git a/src/model/deployment-info.model.ts b/src/shared/model/deployment-info.model.ts similarity index 100% rename from src/model/deployment-info.model.ts rename to src/shared/model/deployment-info.model.ts diff --git a/src/model/domain-edit.model.ts b/src/shared/model/domain-edit.model.ts similarity index 78% rename from src/model/domain-edit.model.ts rename to src/shared/model/domain-edit.model.ts index 4723848..ff14f5b 100644 --- a/src/model/domain-edit.model.ts +++ b/src/shared/model/domain-edit.model.ts @@ -1,4 +1,4 @@ -import { stringToBoolean, stringToNumber } from "@/lib/zod.utils"; +import { stringToBoolean, stringToNumber } from "@/shared/utils/zod.utils"; import { z } from "zod"; export const appDomainEditZodModel = z.object({ diff --git a/src/model/env-edit.model.ts b/src/shared/model/env-edit.model.ts similarity index 100% rename from src/model/env-edit.model.ts rename to src/shared/model/env-edit.model.ts diff --git a/src/model/form-validation-exception.model.ts b/src/shared/model/form-validation-exception.model.ts similarity index 86% rename from src/model/form-validation-exception.model.ts rename to src/shared/model/form-validation-exception.model.ts index adfec49..ce81a53 100644 --- a/src/model/form-validation-exception.model.ts +++ b/src/shared/model/form-validation-exception.model.ts @@ -1,4 +1,4 @@ -import { FormZodErrorValidationCallback } from "@/lib/form.utilts"; +import { FormZodErrorValidationCallback } from "@/frontend/utils/form.utilts"; import { ServiceException } from "./service.exception.model"; import { z, ZodType } from "zod"; diff --git a/src/model/generated-zod/account.ts b/src/shared/model/generated-zod/account.ts similarity index 100% rename from src/model/generated-zod/account.ts rename to src/shared/model/generated-zod/account.ts diff --git a/src/model/generated-zod/app.ts b/src/shared/model/generated-zod/app.ts similarity index 100% rename from src/model/generated-zod/app.ts rename to src/shared/model/generated-zod/app.ts diff --git a/src/model/generated-zod/appdomain.ts b/src/shared/model/generated-zod/appdomain.ts similarity index 100% rename from src/model/generated-zod/appdomain.ts rename to src/shared/model/generated-zod/appdomain.ts diff --git a/src/model/generated-zod/appvolume.ts b/src/shared/model/generated-zod/appvolume.ts similarity index 100% rename from src/model/generated-zod/appvolume.ts rename to src/shared/model/generated-zod/appvolume.ts diff --git a/src/model/generated-zod/authenticator.ts b/src/shared/model/generated-zod/authenticator.ts similarity index 100% rename from src/model/generated-zod/authenticator.ts rename to src/shared/model/generated-zod/authenticator.ts diff --git a/src/model/generated-zod/index.ts b/src/shared/model/generated-zod/index.ts similarity index 100% rename from src/model/generated-zod/index.ts rename to src/shared/model/generated-zod/index.ts diff --git a/src/model/generated-zod/parameter.ts b/src/shared/model/generated-zod/parameter.ts similarity index 100% rename from src/model/generated-zod/parameter.ts rename to src/shared/model/generated-zod/parameter.ts diff --git a/src/model/generated-zod/project.ts b/src/shared/model/generated-zod/project.ts similarity index 100% rename from src/model/generated-zod/project.ts rename to src/shared/model/generated-zod/project.ts diff --git a/src/model/generated-zod/session.ts b/src/shared/model/generated-zod/session.ts similarity index 100% rename from src/model/generated-zod/session.ts rename to src/shared/model/generated-zod/session.ts diff --git a/src/model/generated-zod/user.ts b/src/shared/model/generated-zod/user.ts similarity index 100% rename from src/model/generated-zod/user.ts rename to src/shared/model/generated-zod/user.ts diff --git a/src/model/generated-zod/verificationtoken.ts b/src/shared/model/generated-zod/verificationtoken.ts similarity index 100% rename from src/model/generated-zod/verificationtoken.ts rename to src/shared/model/generated-zod/verificationtoken.ts diff --git a/src/model/node-info.model.ts b/src/shared/model/node-info.model.ts similarity index 89% rename from src/model/node-info.model.ts rename to src/shared/model/node-info.model.ts index 4675f66..ff863a9 100644 --- a/src/model/node-info.model.ts +++ b/src/shared/model/node-info.model.ts @@ -1,4 +1,4 @@ -import { stringToNumber, stringToOptionalNumber } from "@/lib/zod.utils"; +import { stringToNumber, stringToOptionalNumber } from "@/shared/utils/zod.utils"; import { pid } from "process"; import { z } from "zod"; diff --git a/src/model/pods-info.model.ts b/src/shared/model/pods-info.model.ts similarity index 100% rename from src/model/pods-info.model.ts rename to src/shared/model/pods-info.model.ts diff --git a/src/model/qs-letsencrypt-settings.model.ts b/src/shared/model/qs-letsencrypt-settings.model.ts similarity index 78% rename from src/model/qs-letsencrypt-settings.model.ts rename to src/shared/model/qs-letsencrypt-settings.model.ts index 1e76aca..7f57fd4 100644 --- a/src/model/qs-letsencrypt-settings.model.ts +++ b/src/shared/model/qs-letsencrypt-settings.model.ts @@ -1,4 +1,4 @@ -import { stringToBoolean } from "@/lib/zod.utils"; +import { stringToBoolean } from "@/shared/utils/zod.utils"; import { z } from "zod"; export const qsLetsEncryptSettingsZodModel = z.object({ diff --git a/src/model/qs-settings.model.ts b/src/shared/model/qs-settings.model.ts similarity index 80% rename from src/model/qs-settings.model.ts rename to src/shared/model/qs-settings.model.ts index 49ab92a..138f4a0 100644 --- a/src/model/qs-settings.model.ts +++ b/src/shared/model/qs-settings.model.ts @@ -1,4 +1,4 @@ -import { stringToBoolean } from "@/lib/zod.utils"; +import { stringToBoolean } from "@/shared/utils/zod.utils"; import { z } from "zod"; export const qsIngressSettingsZodModel = z.object({ diff --git a/src/model/server-action-error-return.model.ts b/src/shared/model/server-action-error-return.model.ts similarity index 90% rename from src/model/server-action-error-return.model.ts rename to src/shared/model/server-action-error-return.model.ts index 5770b46..01348b3 100644 --- a/src/model/server-action-error-return.model.ts +++ b/src/shared/model/server-action-error-return.model.ts @@ -1,4 +1,4 @@ -import { FormZodErrorValidationCallback } from "@/lib/form.utilts"; +import { FormZodErrorValidationCallback } from "@/frontend/utils/form.utilts"; export class ServerActionResult { diff --git a/src/model/service.exception.model.ts b/src/shared/model/service.exception.model.ts similarity index 100% rename from src/model/service.exception.model.ts rename to src/shared/model/service.exception.model.ts diff --git a/src/model/sim-session.model.ts b/src/shared/model/sim-session.model.ts similarity index 100% rename from src/model/sim-session.model.ts rename to src/shared/model/sim-session.model.ts diff --git a/src/model/totp.model.ts b/src/shared/model/totp.model.ts similarity index 100% rename from src/model/totp.model.ts rename to src/shared/model/totp.model.ts diff --git a/src/model/update-password.model.ts b/src/shared/model/update-password.model.ts similarity index 100% rename from src/model/update-password.model.ts rename to src/shared/model/update-password.model.ts diff --git a/src/model/volume-edit.model.ts b/src/shared/model/volume-edit.model.ts similarity index 83% rename from src/model/volume-edit.model.ts rename to src/shared/model/volume-edit.model.ts index 19c0896..00b5582 100644 --- a/src/model/volume-edit.model.ts +++ b/src/shared/model/volume-edit.model.ts @@ -1,4 +1,4 @@ -import { stringToNumber } from "@/lib/zod.utils"; +import { stringToNumber } from "@/shared/utils/zod.utils"; import { access } from "fs"; import { z } from "zod"; diff --git a/src/server/utils/constants.ts b/src/shared/utils/constants.ts similarity index 100% rename from src/server/utils/constants.ts rename to src/shared/utils/constants.ts diff --git a/src/server/utils/fancy-console.utils.ts b/src/shared/utils/fancy-console.utils.ts similarity index 100% rename from src/server/utils/fancy-console.utils.ts rename to src/shared/utils/fancy-console.utils.ts diff --git a/src/server/utils/list.utils.ts b/src/shared/utils/list.utils.ts similarity index 100% rename from src/server/utils/list.utils.ts rename to src/shared/utils/list.utils.ts diff --git a/src/lib/zod.utils.ts b/src/shared/utils/zod.utils.ts similarity index 100% rename from src/lib/zod.utils.ts rename to src/shared/utils/zod.utils.ts