2020-01-30 19:13:00 +03:00
|
|
|
app todoApp {
|
|
|
|
title: "ToDo App"
|
2019-07-04 22:51:05 +03:00
|
|
|
}
|
|
|
|
|
2020-10-19 15:45:54 +03:00
|
|
|
auth {
|
|
|
|
userEntity: User,
|
2021-02-01 18:32:07 +03:00
|
|
|
methods: [ EmailAndPassword ],
|
|
|
|
onAuthFailedRedirectTo: "/login"
|
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-01-25 21:39:50 +03:00
|
|
|
route "/signup" -> page Signup
|
|
|
|
page Signup {
|
|
|
|
component: import Signup from "@ext/pages/auth/Signup"
|
|
|
|
}
|
|
|
|
|
|
|
|
route "/login" -> page Login
|
|
|
|
page Login {
|
|
|
|
component: import Login from "@ext/pages/auth/Login"
|
|
|
|
}
|
|
|
|
|
2020-07-31 15:26:10 +03:00
|
|
|
route "/" -> page Main
|
2019-07-04 22:51:05 +03:00
|
|
|
page Main {
|
2021-02-01 18:32:07 +03:00
|
|
|
authRequired: true,
|
2020-08-04 14:02:34 +03:00
|
|
|
component: import Main from "@ext/pages/Main"
|
|
|
|
}
|
|
|
|
|
|
|
|
route "/about" -> page About
|
|
|
|
page About {
|
|
|
|
component: import About from "@ext/pages/About"
|
|
|
|
}
|
|
|
|
|
|
|
|
route "/profile" -> page Profile
|
|
|
|
page Profile {
|
2021-02-01 18:32:07 +03:00
|
|
|
authRequired: true,
|
2020-10-15 22:02:05 +03:00
|
|
|
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
|
|
|
|
//
|
|
|
|
route "/task/:id" -> page Task
|
|
|
|
page Task {
|
2021-02-01 18:32:07 +03:00
|
|
|
authRequired: true,
|
2020-08-31 14:58:53 +03:00
|
|
|
component: import Task from "@ext/pages/Task"
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
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
|
|
|
}
|