-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.wasp
348 lines (297 loc) · 10.6 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
app cloudcontext {
wasp: {
version: "^0.16.0"
},
title: "Cloud Context",
head: [
"<meta charset='utf-8' />",
"<meta name='description' content='Simplifying context management for your projects' />",
"<meta name='author' content='CloudContext' />",
"<meta name='keywords' content='solution, product, app, service, cloud, context management, productivity, SaaS, software' />",//TODO: CHANGE
"<meta property='og:type' content='website' />",
"<meta property='og:title' content='Cloud Context' />",
"<meta property='og:site_name' content='Cloud Context' />",
"<meta property='og:url' content='https://cloudcontext.cc' />",
"<meta property='og:description' content='Simplifying context management for your projects' />",
"<meta property='og:image' content='https://cloudcontext.cc/public-banner.webp' />",
"<meta name='twitter:image' content='https://cloudcontext.cc/public-banner.webp' />",
"<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='cloudcontext.cc' src='https://plausible.io/js/script.js'></script>", // for production
//"<script defer data-domain='cloudcontext.cc' src='https://plausible.io/js/script.local.js'></script>", // for development
],
auth: {
userEntity: User,
methods: {
email: {
fromField: {
name: "Cloud Context",
email: "[email protected]"
},
emailVerification: {
clientRoute: EmailVerificationRoute,
getEmailContentFn: import { getVerificationEmailContent } from "@src/auth/email-and-pass/emails",
},
passwordReset: {
clientRoute: PasswordResetRoute,
getEmailContentFn: import { getPasswordResetEmailContent } from "@src/auth/email-and-pass/emails",
},
userSignupFields: import { getEmailUserFields } from "@src/auth/userSignupFields",
},
google: {
userSignupFields: import { getGoogleUserFields } from "@src/auth/userSignupFields",
configFn: import { getGoogleAuthConfig } from "@src/auth/userSignupFields",
},
gitHub: {
userSignupFields: import { getGitHubUserFields } from "@src/auth/userSignupFields",
configFn: import { getGitHubAuthConfig } from "@src/auth/userSignupFields",
},
discord: {
userSignupFields: import { getDiscordUserFields } from "@src/auth/userSignupFields",
configFn: import { getDiscordAuthConfig } from "@src/auth/userSignupFields"
}
},
onAfterSignup: import { onAfterSignup } from "@src/auth/hooks",
onAuthFailedRedirectTo: "/login",
onAuthSucceededRedirectTo: "/pricing",
},
server: {
middlewareConfigFn: import { serverMiddlewareFn } from "@src/server/middleware"
},
db: {
// Run `wasp db seed` to seed the database with the seed functions below:
seeds: [
// Populates the database with a bunch of fake users to work with during development.
import { seedMockUsers } from "@src/server/scripts/dbSeeds",
]
},
client: {
rootComponent: import App from "@src/client/App",
},
emailSender: {
provider: SMTP,
defaultFrom: {
name: "CloudContext", //TODO: CHANGE
email: "[email protected]" //TODO: CHANGE
},
},
}
route LandingPageRoute { path: "/", to: LandingPage }
page LandingPage {
component: import LandingPage from "@src/landing-page/LandingPage"
}
route FAQPageRoute { path: "/faq", to: FAQPage }
page FAQPage {
component: import FAQPage from "@src/faq/FAQPage"
}
//#region Auth Pages
route LoginRoute { path: "/login", to: LoginPage }
page LoginPage {
component: import Login from "@src/auth/LoginPage"
}
route SignupRoute { path: "/signup", to: SignupPage }
page SignupPage {
component: import { Signup } from "@src/auth/SignupPage"
}
route RequestPasswordResetRoute { path: "/forgotpassword", to: RequestPasswordResetPage }
page RequestPasswordResetPage {
component: import { RequestPasswordResetPage } from "@src/auth/email-and-pass/RequestPasswordResetPage",
}
route PasswordResetRoute { path: "/passwordreset", to: PasswordResetPage }
page PasswordResetPage {
component: import { PasswordResetPage } from "@src/auth/email-and-pass/PasswordResetPage",
}
route EmailVerificationRoute { path: "/emailverification", to: EmailVerificationPage }
page EmailVerificationPage {
component: import { EmailVerificationPage } from "@src/auth/email-and-pass/EmailVerificationPage",
}
//#endregion
//#region User
route AccountRoute { path: "/account", to: AccountPage }
page AccountPage {
authRequired: true,
component: import Account from "@src/user/AccountPage"
}
query getPaginatedUsers {
fn: import { getPaginatedUsers } from "@src/user/operations",
entities: [User]
}
query getCurrentUser {
fn: import { getCurrentUser } from "@src/user/operations",
entities: [User]
}
action updateCurrentUser {
fn: import { updateCurrentUser } from "@src/user/operations",
entities: [User]
}
action updateUserById {
fn: import { updateUserById } from "@src/user/operations",
entities: [User]
}
//#endregion
//#region Payment
route PricingPageRoute { path: "/pricing", to: PricingPage }
page PricingPage {
component: import PricingPage from "@src/payment/PricingPage"
}
route CheckoutRoute { path: "/checkout", to: CheckoutPage }
page CheckoutPage {
authRequired: true,
component: import Checkout from "@src/payment/CheckoutPage"
}
query getCustomerPortalUrl {
fn: import { getCustomerPortalUrl } from "@src/payment/operations",
entities: [User]
}
action generateCheckoutSession {
fn: import { generateCheckoutSession } from "@src/payment/operations",
entities: [User]
}
api paymentsWebhook {
fn: import { paymentsWebhook } from "@src/payment/webhook",
entities: [User],
middlewareConfigFn: import { paymentsMiddlewareConfigFn } from "@src/payment/webhook",
httpRoute: (POST, "/payments-webhook")
}
//#endregion
//#region File Upload
route FileUploadRoute { path: "/fileupload", to: FileUploadPage }
page FileUploadPage {
authRequired: true,
component: import FileUpload from "@src/file-upload/FileUploadPage"
}
action createFile {
fn: import { createFile } from "@src/file-upload/operations",
entities: [User, File]
}
query getAllFilesByUser {
fn: import { getAllFilesByUser } from "@src/file-upload/operations",
entities: [User, File]
}
query getDownloadFileSignedURL {
fn: import { getDownloadFileSignedURL } from "@src/file-upload/operations",
entities: [User, File]
}
//#endregion
//#region Analytics
query getDailyStats {
fn: import { getDailyStats } from "@src/analytics/operations",
entities: [User, DailyStats]
}
job dailyStatsJob {
executor: PgBoss,
perform: {
fn: import { calculateDailyStats } from "@src/analytics/stats"
},
schedule: {
cron: "0 * * * *" // every hour. useful in production
// cron: "* * * * *" // every minute. useful for debugging
},
entities: [User, DailyStats, Logs, PageViewSource]
}
//#endregion
//#region Admin Dashboard
route AdminRoute { path: "/admin", to: AnalyticsDashboardPage }
page AnalyticsDashboardPage {
authRequired: true,
component: import AnalyticsDashboardPage from "@src/admin/dashboards/analytics/AnalyticsDashboardPage"
}
route AdminUsersRoute { path: "/admin/users", to: AdminUsersPage }
page AdminUsersPage {
authRequired: true,
component: import AdminUsers from "@src/admin/dashboards/users/UsersDashboardPage"
}
route AdminSettingsRoute { path: "/admin/settings", to: AdminSettingsPage }
page AdminSettingsPage {
authRequired: true,
component: import AdminSettings from "@src/admin/elements/settings/SettingsPage"
}
route AdminChartsRoute { path: "/admin/chart", to: AdminChartsPage }
page AdminChartsPage {
authRequired: true,
component: import AdminCharts from "@src/admin/elements/charts/ChartsPage"
}
route AdminFormElementsRoute { path: "/admin/forms/form-elements", to: AdminFormElementsPage }
page AdminFormElementsPage {
authRequired: true,
component: import AdminForms from "@src/admin/elements/forms/FormElementsPage"
}
route AdminFormLayoutsRoute { path: "/admin/forms/form-layouts", to: AdminFormLayoutsPage }
page AdminFormLayoutsPage {
authRequired: true,
component: import AdminForms from "@src/admin/elements/forms/FormLayoutsPage"
}
route AdminCalendarRoute { path: "/admin/calendar", to: AdminCalendarPage }
page AdminCalendarPage {
authRequired: true,
component: import AdminCalendar from "@src/admin/elements/calendar/CalendarPage"
}
route AdminUIAlertsRoute { path: "/admin/ui/alerts", to: AdminUIAlertsPage }
page AdminUIAlertsPage {
authRequired: true,
component: import AdminUI from "@src/admin/elements/ui-elements/AlertsPage"
}
route AdminUIButtonsRoute { path: "/admin/ui/buttons", to: AdminUIButtonsPage }
page AdminUIButtonsPage {
authRequired: true,
component: import AdminUI from "@src/admin/elements/ui-elements/ButtonsPage"
}
route NotFoundRoute { path: "*", to: NotFoundPage }
page NotFoundPage {
component: import { NotFoundPage } from "@src/client/components/NotFoundPage"
}
//#endregion
//#region Contact Form Messages
route AdminMessagesRoute { path: "/admin/messages", to: AdminMessagesPage }
page AdminMessagesPage {
authRequired: true,
component: import AdminMessages from "@src/messages/MessagesPage"
}
route ContactPageRoute { path: "/contact", to: ContactPage }
page ContactPage {
component: import { ContactPage } from "@src/client/ContactPage"
}
query getMessages {
fn: import { getMessages } from "@src/messages/operations",
entities: [ContactFormMessage]
}
action createMessage {
fn: import { createMessage } from "@src/messages/operations",
entities: [ContactFormMessage]
}
action updateMessageStatus {
fn: import { updateMessageStatus } from "@src/messages/operations",
entities: [ContactFormMessage]
}
//#endregion
//#region Legal
route PrivacyPageRoute { path: "/privacy", to: PrivacyPage }
page PrivacyPage {
component: import PrivacyPage from "@src/legal/PrivacyPolicyPage"
}
route TOSPageRoute { path: "/tos", to: TOSPage }
page TOSPage {
component: import TOSPage from "@src/legal/TermsOfServicePage"
}
route RefundPageRoute { path: "/refund", to: RefundPage }
page RefundPage {
component: import RefundPage from "@src/legal/RefundPage"
}
route DocsPageRoute { path: "/docs", to: DocsPage }
page DocsPage {
component: import DocsPage from "@src/legal/DocumentationPage"
}
//#endregion
//#region Newsletter
job sendNewsletter {
executor: PgBoss,
perform: {
fn: import { checkAndQueueNewsletterEmails } from "@src/newsletter/sendNewsletter"
},
schedule: {
cron: "0 7 * * 1" // at 7:00 am every Monday
},
entities: [User]
}
//#endregion