-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.wasp.ts
63 lines (52 loc) · 1.43 KB
/
main.wasp.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { App, type ExtImport } from "wasp-config";
const app = new App("socialpostgpt", {
title: "SocialPostGPT",
wasp: {
version: "^0.15.1",
},
head: [
`<script defer data-domain="socialpostgpt.xyz" src="http://plausible.apps.twoducks.dev/js/script.js"></script>`,
],
});
app.client({
rootComponent: { import: "App", from: "@src/App" },
});
defineRoute("MainPage", "/", {
importDefault: "MainPage",
from: "@src/pages/MainPage",
});
defineRoute("ResultPage", "/:generationId", {
importDefault: "ResultPage",
from: "@src/pages/ResultPage",
});
app.action("submitPrompt", {
fn: { import: "submitPrompt", from: "@src/generation" },
entities: ["Generation"],
});
app.query("getResult", {
fn: { import: "getResult", from: "@src/generation" },
entities: ["Generation"],
});
app.query("getLatestResults", {
fn: { import: "getLatestResults", from: "@src/generation" },
entities: ["Generation"],
});
app.query("getNumberOfResults", {
fn: { import: "getNumberOfResults", from: "@src/stats" },
entities: ["Result"],
});
app.job("generateResult", {
executor: "PgBoss",
perform: {
fn: { import: "generateResultJob", from: "@src/jobs" },
executorOptions: {
pgBoss: { retryLimit: 1 },
},
},
entities: ["Generation"],
});
export default app;
function defineRoute(name: string, path: string, component: ExtImport) {
const page = app.page(name, { component });
app.route(name, { path, to: page });
}