mirror of
https://github.com/biersoeckli/QuickStack.git
synced 2026-05-14 14:03:42 -05:00
fix/postgres template autogenerate password when value is empty
This commit is contained in:
@@ -6,6 +6,7 @@ import { getAuthUserSession, saveFormAction, simpleAction } from "@/server/utils
|
||||
import { z } from "zod";
|
||||
import appTemplateService from "@/server/services/app-template.service";
|
||||
import { AppTemplateModel, appTemplateZodModel } from "@/shared/model/app-template.model";
|
||||
import { ServiceException } from "@/shared/model/service.exception.model";
|
||||
|
||||
const createAppSchema = z.object({
|
||||
appName: z.string().min(1)
|
||||
@@ -27,6 +28,9 @@ export const createApp = async (appName: string, projectId: string, appId?: stri
|
||||
export const createAppFromTemplate = async(prevState: any, inputData: AppTemplateModel, projectId: string) =>
|
||||
saveFormAction(inputData, appTemplateZodModel, async (validatedData) => {
|
||||
await getAuthUserSession();
|
||||
if (validatedData.templates.some(x => x.inputSettings.some(y => !y.randomGeneratedIfEmpty && !y.value))) {
|
||||
throw new ServiceException('Please fill out all required fields.');
|
||||
}
|
||||
await appTemplateService.createAppFromTemplate(projectId, validatedData);
|
||||
return new SuccessActionResult(undefined, "App created successfully.");
|
||||
});
|
||||
|
||||
@@ -52,6 +52,9 @@ export default function CreateTemplateAppSetupDialog({
|
||||
description: `Click deploy to start the ${appLabel}.`,
|
||||
});
|
||||
setIsOpen(false);
|
||||
if (dialogClosed) {
|
||||
dialogClosed();
|
||||
}
|
||||
}
|
||||
FormUtils.mapValidationErrorsToForm<typeof appTemplateZodModel>(state, form);
|
||||
}, [state]);
|
||||
|
||||
@@ -31,7 +31,7 @@ export const postgreAppTemplate: AppTemplateModel = {
|
||||
label: "Database Password",
|
||||
value: "",
|
||||
isEnvVar: true,
|
||||
randomGeneratedIfEmpty: false,
|
||||
randomGeneratedIfEmpty: true,
|
||||
},
|
||||
],
|
||||
appModel: {
|
||||
|
||||
Reference in New Issue
Block a user