forked from wasp-lang/wasp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.wasp
222 lines (193 loc) · 5.46 KB
/
main.wasp
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
app waspAi {
wasp: {
version: "^0.13.0"
},
title: "MAGE - GPT Web App Generator ✨",
head: [
"<meta property=\"og:title\" content=\"MAGE GPT Web App Generator ✨ MageGPT\">",
"<meta property=\"og:description\" content=\"Generate your full-stack React, Node.js and Prisma web app using the magic of GPT and the Wasp full-stack framework.\">",
"<meta property=\"og:type\" content=\"website\">",
"<meta property=\"og:image\" content=\"https://usemage.ai/twitter.png\">",
"<meta name=\"twitter:image\" content=\"https://usemage.ai/twitter.png\" />",
"<meta name=\"twitter:image:width\" content=\"800\" />",
"<meta name=\"twitter:image:height\" content=\"400\" />",
"<meta name=\"twitter:card\" content=\"summary_large_image\" />",
"<script defer data-domain=\"usemage.ai\" data-api=\"/waspara/wasp/event\" src=\"/waspara/wasp/script.js\"></script>",
],
client: {
rootComponent: import { RootComponent } from "@src/client/RootComponent.jsx",
},
db: {
system: PostgreSQL,
},
auth: {
userEntity: User,
methods: {
gitHub: {
configFn: import { getGitHubAuthConfig } from "@src/server/auth.js",
userSignupFields: import { gitHubUserSignupFields } from "@src/server/auth.ts",
},
google: {
configFn: import { getGoogleAuthConfig } from "@src/server/auth.js",
userSignupFields: import { googleUserSignupFields } from "@src/server/auth.ts",
},
},
onAuthFailedRedirectTo: "/",
onAuthSucceededRedirectTo: "/"
}
}
route RootRoute { path: "/", to: MainPage }
page MainPage {
component: import Main from "@src/client/pages/MainPage.jsx"
}
route ResultRoute { path: "/result/:appId", to: ResultPage }
page ResultPage {
component: import { ResultPage } from "@src/client/pages/ResultPage.jsx"
}
route UserRoute { path: "/user", to: UserPage }
page UserPage {
component: import { UserPage } from "@src/client/pages/UserPage.jsx",
authRequired: true
}
route StatsRoute { path: "/stats", to: StatsPage }
page StatsPage {
component: import { Stats } from "@src/client/pages/StatsPage.jsx",
authRequired: true
}
route FeedbackRoute { path: "/feedback", to: FeedbackPage }
page FeedbackPage {
component: import { Feedback } from "@src/client/pages/FeedbackPage.jsx",
authRequired: true
}
route LoginRoute { path: "/login", to: LoginPage }
page LoginPage {
component: import { LoginPage } from "@src/client/pages/LoginPage.jsx",
}
action startGeneratingNewApp {
fn: import { startGeneratingNewApp } from "@src/server/operations.js",
entities: [
Project,
]
}
action registerZipDownload {
fn: import { registerZipDownload } from "@src/server/operations.js",
entities: [Project]
}
action createFeedback {
fn: import { createFeedback } from "@src/server/operations.js",
entities: [Feedback]
}
action deleteMyself {
fn: import { deleteMyself } from "@src/server/operations.js",
entities: [User, Project, File, Log]
}
query getFeedback {
fn: import { getFeedback } from "@src/server/operations.js",
entities: [Feedback]
}
query getProjectsByUser {
fn: import { getProjectsByUser } from "@src/server/operations.js",
entities: [Project]
}
query getAppGenerationResult {
fn: import { getAppGenerationResult } from "@src/server/operations.js",
entities: [
Project
]
}
query getProjects {
fn: import { getProjects } from "@src/server/operations.js",
entities: [
Project
]
}
query getStats {
fn: import { getStats } from "@src/server/operations.js",
entities: [
Project
]
}
query getNumProjects {
fn: import { getNumProjects } from "@src/server/operations.js",
entities: [
Project
]
}
entity User {=psl
id Int @id @default(autoincrement())
email String?
username String?
projects Project[]
psl=}
entity Project {=psl
id String @id @default(uuid())
name String
description String
primaryColor String @default("sky")
authMethod String @default("usernameAndPassword")
creativityLevel String @default("balanced")
createdAt DateTime @default(now())
status String @default("pending")
referrer String @default("unknown")
zipDownloadedAt DateTime?
userId Int?
user User? @relation(fields: [userId], references: [id])
files File[]
logs Log[]
feedbacks Feedback[]
psl=}
entity Feedback {=psl
id String @id @default(uuid())
score Int
message String
createdAt DateTime @default(now())
projectId String
project Project @relation(fields: [projectId], references: [id])
psl=}
entity File {=psl
id String @id @default(uuid())
name String
content String
createdAt DateTime @default(now())
projectId String
project Project @relation(fields: [projectId], references: [id])
@@index([name, projectId])
psl=}
entity Log {=psl
id String @id @default(uuid())
content String
createdAt DateTime @default(now())
projectId String
project Project @relation(fields: [projectId], references: [id])
psl=}
job checkPendingAppsJob {
executor: PgBoss,
schedule: {
cron: "* * * * *",
},
perform: {
fn: import { checkForPendingApps } from "@src/server/jobs/checkForPendingApps.js"
},
entities: [Project]
}
job failStaleAppsJobs {
executor: PgBoss,
schedule: {
cron: "* * * * *",
},
perform: {
fn: import { failStaleGenerations } from "@src/server/jobs/failStaleGenerations.js",
},
entities: [Project, Log]
}
job generateAppJob {
executor: PgBoss,
perform: {
fn: import { generateApp } from "@src/server/jobs/generateApp.js",
},
entities: [
Project,
File,
Log
]
}