diff --git a/wasp-ai/.prettierrc b/wasp-ai/.prettierrc new file mode 100644 index 0000000000..59e8c2d7a7 --- /dev/null +++ b/wasp-ai/.prettierrc @@ -0,0 +1,6 @@ +{ + "semi": true, + "singleQuote": false, + "trailingComma": "es5", + "printWidth": 100 +} diff --git a/wasp-ai/main.wasp b/wasp-ai/main.wasp index 78646385a6..cb4cd80177 100644 --- a/wasp-ai/main.wasp +++ b/wasp-ai/main.wasp @@ -106,6 +106,11 @@ action createFeedback { entities: [Feedback] } +action deleteMyself { + fn: import { deleteMyself } from "@server/operations.js", + entities: [User, Project, File, Log] +} + query getFeedback { fn: import { getFeedback } from "@server/operations.js", entities: [Feedback] @@ -154,7 +159,7 @@ entity SocialLogin {=psl providerId String userId Int - user User @relation(fields: [userId], references: [id]) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) createdAt DateTime @default(now()) psl=} diff --git a/wasp-ai/migrations/20231117102034_delete_user/migration.sql b/wasp-ai/migrations/20231117102034_delete_user/migration.sql new file mode 100644 index 0000000000..7f4a42b4b8 --- /dev/null +++ b/wasp-ai/migrations/20231117102034_delete_user/migration.sql @@ -0,0 +1,5 @@ +-- DropForeignKey +ALTER TABLE "SocialLogin" DROP CONSTRAINT "SocialLogin_userId_fkey"; + +-- AddForeignKey +ALTER TABLE "SocialLogin" ADD CONSTRAINT "SocialLogin_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/wasp-ai/src/client/components/Dialog.jsx b/wasp-ai/src/client/components/Dialog.jsx index f6e0b7b1f2..c7142000c0 100644 --- a/wasp-ai/src/client/components/Dialog.jsx +++ b/wasp-ai/src/client/components/Dialog.jsx @@ -49,9 +49,9 @@ export function MyDialog({ isOpen, onClose, title, children }) { xmlns="http://www.w3.org/2000/svg" > Close modal diff --git a/wasp-ai/src/client/components/StatusPill.jsx b/wasp-ai/src/client/components/StatusPill.jsx index fc8234a755..ab5e2d04a2 100644 --- a/wasp-ai/src/client/components/StatusPill.jsx +++ b/wasp-ai/src/client/components/StatusPill.jsx @@ -7,6 +7,7 @@ export function StatusPill({ children, status, className = "", sm = false }) { error: "bg-red-100 text-red-700", cancelled: "bg-red-100 text-red-700", warning: "bg-yellow-100 text-yellow-700", + deleted: "bg-red-100 text-red-700", }; return (
diff --git a/wasp-ai/src/client/components/WaitingRoomContent.jsx b/wasp-ai/src/client/components/WaitingRoomContent.jsx index 717e5076c9..ba4e566c43 100644 --- a/wasp-ai/src/client/components/WaitingRoomContent.jsx +++ b/wasp-ai/src/client/components/WaitingRoomContent.jsx @@ -77,7 +77,7 @@ export function WaitingRoomContent(props) {
{showcaseSamples.map((sample) => ( - + ))}
diff --git a/wasp-ai/src/client/pages/ResultPage.jsx b/wasp-ai/src/client/pages/ResultPage.jsx index fc855b4c3d..c73d092179 100644 --- a/wasp-ai/src/client/pages/ResultPage.jsx +++ b/wasp-ai/src/client/pages/ResultPage.jsx @@ -42,7 +42,11 @@ export const ResultPage = () => { data: appGenerationResult, isError, isLoading, - } = useQuery(getAppGenerationResult, { appId }, { enabled: !!appId && !generationDone, refetchInterval: 3000 }); + } = useQuery( + getAppGenerationResult, + { appId }, + { enabled: !!appId && !generationDone, refetchInterval: 3000 } + ); const [activeFilePath, setActiveFilePath] = useState(null); const [currentStatus, setCurrentStatus] = useState({ status: "idle", @@ -211,7 +215,10 @@ export const ResultPage = () => { return (
-
+
@@ -225,7 +232,8 @@ export const ResultPage = () => { {isError && (
- We couldn't find the app generation result. Maybe the link is incorrect or the app generation has failed. + We couldn't find the app generation result. Maybe the link is incorrect or the app + generation has failed.
Generate a new one @@ -244,7 +252,16 @@ export const ResultPage = () => { )} - + {appGenerationResult?.project.status.includes("deleted") ? ( +
+ This app has been deleted. + + ← Go back and generate a new app + +
+ ) : ( + + )}
- 🔮 This is a Wasp powered project. If you like it, star us on GitHub! + 🔮 This is a Wasp powered project. If you like it,{" "} + star us on GitHub!
{currentStatus.status === "pending" && ( - + )} {interestingFilePaths.length > 0 && ( <>
-

{appGenerationResult?.project?.name}

+

+ {appGenerationResult?.project?.name} +

-