mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-06 05:40:02 -06:00
fix: Incorrect created_at value while duplicating a survey (#2217)
Co-authored-by: Matti Nannt <mail@matthiasnannt.com>
This commit is contained in:
committed by
GitHub
parent
29a9b7e23e
commit
a56c354e84
@@ -503,7 +503,7 @@ export const createSurvey = async (environmentId: string, surveyBody: TSurveyInp
|
||||
export const duplicateSurvey = async (environmentId: string, surveyId: string, userId: string) => {
|
||||
validateInputs([environmentId, ZId], [surveyId, ZId]);
|
||||
const existingSurvey = await getSurvey(surveyId);
|
||||
|
||||
const currentDate = new Date();
|
||||
if (!existingSurvey) {
|
||||
throw new ResourceNotFoundError("Survey", surveyId);
|
||||
}
|
||||
@@ -516,6 +516,8 @@ export const duplicateSurvey = async (environmentId: string, surveyId: string, u
|
||||
...existingSurvey,
|
||||
id: undefined, // id is auto-generated
|
||||
environmentId: undefined, // environmentId is set below
|
||||
createdAt: currentDate,
|
||||
updatedAt: currentDate,
|
||||
createdBy: undefined,
|
||||
name: `${existingSurvey.name} (copy)`,
|
||||
status: "draft",
|
||||
|
||||
Reference in New Issue
Block a user