2020-01-30 19:13:00 +03:00
|
|
|
app todoApp {
|
2022-11-01 01:00:03 +03:00
|
|
|
wasp: {
|
2023-12-22 17:14:38 +03:00
|
|
|
version: "^0.12.0"
|
2022-11-01 01:00:03 +03:00
|
|
|
},
|
2022-01-20 13:45:14 +03:00
|
|
|
title: "ToDo App",
|
2022-11-04 16:39:13 +03:00
|
|
|
// head: [],
|
2022-01-20 13:45:14 +03:00
|
|
|
dependencies: [
|
2022-11-04 16:39:13 +03:00
|
|
|
("@tailwindcss/forms", "^0.5.3"),
|
|
|
|
("@tailwindcss/typography", "^0.5.7")
|
2022-01-20 13:45:14 +03:00
|
|
|
],
|
2023-06-19 11:49:57 +03:00
|
|
|
webSocket: {
|
|
|
|
fn: import { webSocketFn } from "@server/webSocket.js",
|
|
|
|
// autoConnect: false
|
|
|
|
},
|
2022-01-20 13:45:14 +03:00
|
|
|
auth: {
|
2020-10-19 15:45:54 +03:00
|
|
|
userEntity: User,
|
2022-09-06 21:35:59 +03:00
|
|
|
methods: {
|
2024-01-18 15:42:00 +03:00
|
|
|
// usernameAndPassword: {
|
|
|
|
// userSignupFields: import { userSignupFields } from "@server/auth/github.js",
|
|
|
|
// },
|
2024-01-03 16:40:08 +03:00
|
|
|
google: {
|
|
|
|
configFn: import { config } from "@server/auth/google.js",
|
2024-01-18 15:42:00 +03:00
|
|
|
userSignupFields: import { userSignupFields } from "@server/auth/google.js"
|
2024-01-03 16:40:08 +03:00
|
|
|
},
|
2023-04-06 22:12:18 +03:00
|
|
|
// gitHub: {
|
|
|
|
// // configFn: import { config } from "@server/auth/github.js",
|
2024-01-18 15:42:00 +03:00
|
|
|
// // userSignupFields: import { getUserFields } from "@server/auth/github.js"
|
2023-04-06 22:12:18 +03:00
|
|
|
// },
|
2023-04-06 00:25:03 +03:00
|
|
|
email: {
|
2024-01-18 15:42:00 +03:00
|
|
|
userSignupFields: import { userSignupFields } from "@server/auth/email.js",
|
2023-04-06 00:25:03 +03:00
|
|
|
fromField: {
|
|
|
|
name: "ToDO App",
|
|
|
|
email: "mihovil@ilakovac.com"
|
|
|
|
},
|
|
|
|
emailVerification: {
|
|
|
|
getEmailContentFn: import { getVerificationEmailContent } from "@server/auth/email.js",
|
|
|
|
clientRoute: EmailVerificationRoute,
|
|
|
|
},
|
|
|
|
passwordReset: {
|
|
|
|
getEmailContentFn: import { getPasswordResetEmailContent } from "@server/auth/email.js",
|
|
|
|
clientRoute: PasswordResetRoute
|
|
|
|
},
|
|
|
|
},
|
2022-09-06 21:35:59 +03:00
|
|
|
},
|
2021-11-22 16:23:19 +03:00
|
|
|
onAuthFailedRedirectTo: "/login",
|
|
|
|
onAuthSucceededRedirectTo: "/profile"
|
2022-01-20 13:45:14 +03:00
|
|
|
},
|
|
|
|
server: {
|
2023-04-24 19:16:54 +03:00
|
|
|
setupFn: import setup from "@server/serverSetup.js",
|
2023-06-20 14:31:20 +03:00
|
|
|
middlewareConfigFn: import { serverMiddlewareFn } from "@server/serverSetup.js",
|
2022-05-03 21:34:25 +03:00
|
|
|
},
|
2022-05-20 15:49:26 +03:00
|
|
|
client: {
|
2023-04-06 22:12:18 +03:00
|
|
|
rootComponent: import { App } from "@client/App.tsx",
|
|
|
|
setupFn: import setup from "@client/clientSetup.js"
|
2022-05-20 15:49:26 +03:00
|
|
|
},
|
2022-05-03 21:34:25 +03:00
|
|
|
db: {
|
2023-04-05 12:33:52 +03:00
|
|
|
system: PostgreSQL,
|
|
|
|
seeds: [
|
|
|
|
import { devSeedSimple } from "@server/dbSeeds.js",
|
|
|
|
import { prodSeed } from "@server/dbSeeds.js"
|
|
|
|
]
|
2023-03-24 14:42:22 +03:00
|
|
|
},
|
2023-04-06 00:25:03 +03:00
|
|
|
emailSender: {
|
|
|
|
provider: SMTP,
|
|
|
|
defaultFrom: {
|
|
|
|
email: "mihovil@ilakovac.com"
|
|
|
|
},
|
|
|
|
},
|
2020-10-19 15:45:54 +03:00
|
|
|
}
|
|
|
|
|
2020-10-21 17:37:20 +03:00
|
|
|
entity User {=psl
|
2022-09-06 21:35:59 +03:00
|
|
|
id Int @id @default(autoincrement())
|
2023-04-06 00:25:03 +03:00
|
|
|
// Business logic
|
|
|
|
tasks Task[]
|
2023-09-12 14:19:47 +03:00
|
|
|
address String?
|
2022-09-06 21:35:59 +03:00
|
|
|
psl=}
|
|
|
|
|
2020-10-21 17:37:20 +03:00
|
|
|
entity Task {=psl
|
2020-09-07 17:33:47 +03:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
description String
|
|
|
|
isDone Boolean @default(false)
|
2020-10-19 21:32:34 +03:00
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
userId Int
|
2020-09-07 17:33:47 +03:00
|
|
|
psl=}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route SignupRoute { path: "/signup", to: SignupPage }
|
|
|
|
page SignupPage {
|
2023-04-06 21:29:05 +03:00
|
|
|
component: import Signup from "@client/pages/auth/Signup.tsx"
|
2021-01-25 21:39:50 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route LoginRoute { path: "/login", to: LoginPage }
|
|
|
|
page LoginPage {
|
2023-04-05 23:56:05 +03:00
|
|
|
component: import Login from "@client/pages/auth/Login.tsx"
|
2021-01-25 21:39:50 +03:00
|
|
|
}
|
|
|
|
|
2023-04-06 00:25:03 +03:00
|
|
|
route PasswordResetRoute { path: "/password-reset", to: PasswordResetPage }
|
|
|
|
page PasswordResetPage {
|
|
|
|
component: import { PasswordReset } from "@client/pages/auth/PasswordReset.tsx",
|
|
|
|
}
|
|
|
|
|
|
|
|
route EmailVerificationRoute { path: "/email-verification-", to: EmailVerificationPage }
|
|
|
|
page EmailVerificationPage {
|
|
|
|
component: import { EmailVerification } from "@client/pages/auth/EmailVerification.tsx",
|
|
|
|
}
|
|
|
|
|
|
|
|
route RequestPasswordResetRoute { path: "/request-password-reset", to: RequestPasswordResetPage }
|
|
|
|
page RequestPasswordResetPage {
|
|
|
|
component: import { RequestPasswordReset } from "@client/pages/auth/RequestPasswordReset.tsx",
|
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route HomeRoute { path: "/", to: MainPage }
|
|
|
|
page MainPage {
|
|
|
|
authRequired: true,
|
2023-03-01 19:14:14 +03:00
|
|
|
component: import Main from "@client/pages/Main.jsx"
|
2020-08-04 14:02:34 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route AboutRoute { path: "/about", to: AboutPage }
|
|
|
|
page AboutPage {
|
2023-03-01 19:14:14 +03:00
|
|
|
component: import About from "@client/pages/About.jsx"
|
2020-08-04 14:02:34 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route ProfileRoute { path: "/profile", to: ProfilePage }
|
|
|
|
page ProfilePage {
|
|
|
|
authRequired: true,
|
2023-03-01 19:14:14 +03:00
|
|
|
component: import { ProfilePage } from "@client/pages/ProfilePage.tsx"
|
2020-02-05 14:50:57 +03:00
|
|
|
}
|
|
|
|
|
2020-08-31 14:58:53 +03:00
|
|
|
// Page for viewing a specific task
|
|
|
|
//
|
2022-01-20 13:45:14 +03:00
|
|
|
route TaskRoute { path: "/task/:id", to: TaskPage }
|
|
|
|
page TaskPage {
|
|
|
|
authRequired: true,
|
2023-03-01 19:14:14 +03:00
|
|
|
component: import Task from "@client/pages/Task.tsx"
|
2020-08-31 14:58:53 +03:00
|
|
|
}
|
|
|
|
|
2020-10-01 12:25:59 +03:00
|
|
|
// --------- Queries --------- //
|
|
|
|
|
2020-08-25 21:10:59 +03:00
|
|
|
query getTasks {
|
2022-11-11 19:20:49 +03:00
|
|
|
fn: import { getTasks } from "@server/queries.js",
|
2020-09-30 22:16:41 +03:00
|
|
|
entities: [Task]
|
2020-08-25 21:10:59 +03:00
|
|
|
}
|
2020-08-31 15:41:49 +03:00
|
|
|
|
2023-03-14 21:04:51 +03:00
|
|
|
api fooBar {
|
|
|
|
fn: import { fooBar } from "@server/apis.js",
|
2023-04-24 19:16:54 +03:00
|
|
|
middlewareConfigFn: import { fooBarMiddlewareFn } from "@server/apis.js",
|
2023-03-14 21:04:51 +03:00
|
|
|
entities: [Task],
|
2023-04-24 19:16:54 +03:00
|
|
|
// ALL here let's our CORS work. If we did GET, we would need an apiNamespace over it with CORS.
|
|
|
|
httpRoute: (ALL, "/foo/bar")
|
|
|
|
}
|
|
|
|
|
|
|
|
apiNamespace bar {
|
|
|
|
middlewareConfigFn: import { barNamespaceMiddlewareFn } from "@server/apis.js",
|
|
|
|
path: "/bar"
|
2023-03-14 21:04:51 +03:00
|
|
|
}
|
|
|
|
|
2023-04-06 22:12:18 +03:00
|
|
|
api barBaz {
|
|
|
|
fn: import { barBaz } from "@server/apis.js",
|
|
|
|
auth: false,
|
|
|
|
entities: [Task],
|
|
|
|
httpRoute: (GET, "/bar/baz")
|
|
|
|
}
|
|
|
|
|
2023-04-24 19:16:54 +03:00
|
|
|
api webhookCallback {
|
|
|
|
fn: import { webhookCallback } from "@server/apis.js",
|
|
|
|
middlewareConfigFn: import { webhookCallbackMiddlewareFn } from "@server/apis.js",
|
|
|
|
httpRoute: (POST, "/webhook/callback"),
|
|
|
|
auth: false
|
|
|
|
}
|
|
|
|
|
2021-07-18 20:34:21 +03:00
|
|
|
query getNumTasks {
|
2022-11-11 19:20:49 +03:00
|
|
|
fn: import { getNumTasks } from "@server/queries.js",
|
2022-02-02 21:38:47 +03:00
|
|
|
entities: [Task],
|
2021-07-18 20:34:21 +03:00
|
|
|
auth: false
|
|
|
|
}
|
|
|
|
|
2020-10-01 12:25:59 +03:00
|
|
|
query getTask {
|
2022-11-11 19:20:49 +03:00
|
|
|
fn: import { getTask } from "@server/queries.js",
|
2020-10-19 15:45:54 +03:00
|
|
|
entities: [Task]
|
2020-10-01 12:25:59 +03:00
|
|
|
}
|
|
|
|
|
2023-04-06 22:12:18 +03:00
|
|
|
query getDate {
|
|
|
|
fn: import { getDate } from "@server/queries.js"
|
|
|
|
}
|
|
|
|
|
2020-10-01 12:25:59 +03:00
|
|
|
// --------- Actions --------- //
|
|
|
|
|
2020-09-04 13:44:05 +03:00
|
|
|
action createTask {
|
2022-11-11 19:20:49 +03:00
|
|
|
fn: import { createTask } from "@server/actions.js",
|
2020-09-30 22:16:41 +03:00
|
|
|
entities: [Task]
|
2020-09-07 17:33:47 +03:00
|
|
|
}
|
2020-09-29 11:44:27 +03:00
|
|
|
|
|
|
|
action updateTaskIsDone {
|
2022-11-11 19:20:49 +03:00
|
|
|
fn: import { updateTaskIsDone } from "@server/actions.js",
|
2020-09-30 22:16:41 +03:00
|
|
|
entities: [Task]
|
2020-09-29 11:44:27 +03:00
|
|
|
}
|
2020-09-30 11:08:20 +03:00
|
|
|
|
|
|
|
action deleteCompletedTasks {
|
2022-11-11 19:20:49 +03:00
|
|
|
fn: import { deleteCompletedTasks } from "@server/actions.js",
|
2020-09-30 22:16:41 +03:00
|
|
|
entities: [Task]
|
2020-09-30 11:08:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
action toggleAllTasks {
|
2022-11-11 19:20:49 +03:00
|
|
|
fn: import { toggleAllTasks } from "@server/actions.js",
|
2020-09-30 22:16:41 +03:00
|
|
|
entities: [Task]
|
2020-09-30 11:08:20 +03:00
|
|
|
}
|
2022-04-13 19:30:29 +03:00
|
|
|
|
|
|
|
job mySpecialJob {
|
2022-05-03 21:34:25 +03:00
|
|
|
executor: PgBoss,
|
|
|
|
perform: {
|
2022-11-11 19:20:49 +03:00
|
|
|
fn: import { foo } from "@server/jobs/bar.js",
|
2022-05-13 19:30:55 +03:00
|
|
|
executorOptions: {
|
|
|
|
pgBoss: {=json { "retryLimit": 1 } json=}
|
|
|
|
}
|
2022-08-17 20:53:05 +03:00
|
|
|
},
|
|
|
|
entities: [Task]
|
2022-05-13 19:30:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
job mySpecialScheduledJob {
|
|
|
|
executor: PgBoss,
|
|
|
|
perform: {
|
2022-11-11 19:20:49 +03:00
|
|
|
fn: import { foo } from "@server/jobs/bar.js"
|
2022-05-13 19:30:55 +03:00
|
|
|
},
|
|
|
|
schedule: {
|
2022-09-06 21:35:59 +03:00
|
|
|
cron: "0 * * * *",
|
2022-05-13 19:30:55 +03:00
|
|
|
args: {=json { "foo": "bar" } json=},
|
|
|
|
executorOptions: {
|
|
|
|
pgBoss: {=json { "retryLimit": 2 } json=}
|
|
|
|
}
|
2022-05-03 21:34:25 +03:00
|
|
|
}
|
2023-04-05 12:33:52 +03:00
|
|
|
}
|