2020-01-30 19:13:00 +03:00
|
|
|
app todoApp {
|
2022-11-01 01:00:03 +03:00
|
|
|
wasp: {
|
|
|
|
version: "^0.6.0"
|
|
|
|
},
|
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
|
|
|
],
|
|
|
|
auth: {
|
2020-10-19 15:45:54 +03:00
|
|
|
userEntity: User,
|
2022-09-06 21:35:59 +03:00
|
|
|
// externalAuthEntity: SocialLogin,
|
|
|
|
methods: {
|
|
|
|
usernameAndPassword: {},
|
|
|
|
// google: {
|
|
|
|
// configFn: import { config } from "@ext/auth/google.js",
|
|
|
|
// getUserFieldsFn: import { getUserFields } from "@ext/auth/google.js"
|
|
|
|
// }
|
|
|
|
},
|
2021-11-22 16:23:19 +03:00
|
|
|
onAuthFailedRedirectTo: "/login",
|
|
|
|
onAuthSucceededRedirectTo: "/profile"
|
2022-01-20 13:45:14 +03:00
|
|
|
},
|
|
|
|
server: {
|
|
|
|
setupFn: import setup from "@ext/serverSetup.js"
|
2022-05-03 21:34:25 +03:00
|
|
|
},
|
2022-05-20 15:49:26 +03:00
|
|
|
client: {
|
|
|
|
setupFn: import setup from "@ext/clientSetup.js"
|
|
|
|
},
|
2022-05-03 21:34:25 +03:00
|
|
|
db: {
|
|
|
|
system: PostgreSQL
|
2022-01-20 13:45:14 +03:00
|
|
|
}
|
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())
|
|
|
|
username String @unique
|
|
|
|
password String
|
|
|
|
tasks Task[]
|
|
|
|
externalAuthAssociations SocialLogin[]
|
|
|
|
psl=}
|
|
|
|
|
|
|
|
entity SocialLogin {=psl
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
provider String
|
|
|
|
providerId String
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
userId Int
|
|
|
|
createdAt DateTime @default(now())
|
|
|
|
@@unique([provider, providerId, userId])
|
2020-09-07 17:33:47 +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 {
|
|
|
|
component: import Signup from "@ext/pages/auth/Signup"
|
2021-01-25 21:39:50 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route LoginRoute { path: "/login", to: LoginPage }
|
|
|
|
page LoginPage {
|
|
|
|
component: import Login from "@ext/pages/auth/Login"
|
2021-01-25 21:39:50 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route HomeRoute { path: "/", to: MainPage }
|
|
|
|
page MainPage {
|
|
|
|
authRequired: true,
|
|
|
|
component: import Main from "@ext/pages/Main"
|
2020-08-04 14:02:34 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route AboutRoute { path: "/about", to: AboutPage }
|
|
|
|
page AboutPage {
|
|
|
|
component: import About from "@ext/pages/About"
|
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,
|
|
|
|
component: import { ProfilePage } from "@ext/pages/ProfilePage"
|
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,
|
|
|
|
component: import Task from "@ext/pages/Task"
|
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 {
|
2020-09-30 22:16:41 +03:00
|
|
|
fn: import { getTasks } from "@ext/queries.js",
|
|
|
|
entities: [Task]
|
2020-08-25 21:10:59 +03:00
|
|
|
}
|
2020-08-31 15:41:49 +03:00
|
|
|
|
2021-07-18 20:34:21 +03:00
|
|
|
query getNumTasks {
|
|
|
|
fn: import { getNumTasks } from "@ext/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 {
|
2020-10-19 15:45:54 +03:00
|
|
|
fn: import { getTask } from "@ext/queries.js",
|
|
|
|
entities: [Task]
|
2020-10-01 12:25:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// --------- Actions --------- //
|
|
|
|
|
2020-09-04 13:44:05 +03:00
|
|
|
action createTask {
|
2020-09-30 22:16:41 +03:00
|
|
|
fn: import { createTask } from "@ext/actions.js",
|
|
|
|
entities: [Task]
|
2020-09-07 17:33:47 +03:00
|
|
|
}
|
2020-09-29 11:44:27 +03:00
|
|
|
|
|
|
|
action updateTaskIsDone {
|
2020-09-30 22:16:41 +03:00
|
|
|
fn: import { updateTaskIsDone } from "@ext/actions.js",
|
|
|
|
entities: [Task]
|
2020-09-29 11:44:27 +03:00
|
|
|
}
|
2020-09-30 11:08:20 +03:00
|
|
|
|
|
|
|
action deleteCompletedTasks {
|
2020-09-30 22:16:41 +03:00
|
|
|
fn: import { deleteCompletedTasks } from "@ext/actions.js",
|
|
|
|
entities: [Task]
|
2020-09-30 11:08:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
action toggleAllTasks {
|
2020-09-30 22:16:41 +03:00
|
|
|
fn: import { toggleAllTasks } from "@ext/actions.js",
|
|
|
|
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: {
|
|
|
|
fn: import { foo } from "@ext/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: {
|
|
|
|
fn: import { foo } from "@ext/jobs/bar.js"
|
|
|
|
},
|
|
|
|
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
|
|
|
}
|
2022-04-13 19:30:29 +03:00
|
|
|
}
|