2020-01-30 19:13:00 +03:00
|
|
|
app todoApp {
|
2022-01-20 13:45:14 +03:00
|
|
|
title: "ToDo App",
|
|
|
|
head: [
|
|
|
|
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap\" />"
|
|
|
|
],
|
|
|
|
dependencies: [
|
|
|
|
("@material-ui/core", "4.11.3")
|
|
|
|
],
|
|
|
|
auth: {
|
2020-10-19 15:45:54 +03:00
|
|
|
userEntity: User,
|
2021-02-01 18:32:07 +03:00
|
|
|
methods: [ EmailAndPassword ],
|
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"
|
|
|
|
}
|
2020-10-19 15:45:54 +03:00
|
|
|
}
|
|
|
|
|
2020-10-21 17:37:20 +03:00
|
|
|
entity User {=psl
|
2020-10-19 15:45:54 +03:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
email String @unique
|
|
|
|
password String
|
2020-10-19 21:32:34 +03:00
|
|
|
tasks Task[]
|
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=}
|
|
|
|
|
2021-07-16 15:03:53 +03:00
|
|
|
|
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-01-20 13:45:14 +03:00
|
|
|
|
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
|
|
|
}
|