mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-25 18:13:52 +03:00
c2f9eff3b8
Co-authored-by: shayneczyzewski <shayne.czyzewski@gmail.com>
110 lines
2.4 KiB
JavaScript
110 lines
2.4 KiB
JavaScript
app todoApp {
|
|
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: {
|
|
userEntity: User,
|
|
methods: [ EmailAndPassword ],
|
|
onAuthFailedRedirectTo: "/login",
|
|
onAuthSucceededRedirectTo: "/profile"
|
|
},
|
|
server: {
|
|
setupFn: import setup from "@ext/serverSetup.js"
|
|
}
|
|
}
|
|
|
|
entity User {=psl
|
|
id Int @id @default(autoincrement())
|
|
email String @unique
|
|
password String
|
|
tasks Task[]
|
|
psl=}
|
|
|
|
entity Task {=psl
|
|
id Int @id @default(autoincrement())
|
|
description String
|
|
isDone Boolean @default(false)
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId Int
|
|
psl=}
|
|
|
|
|
|
route SignupRoute { path: "/signup", to: SignupPage }
|
|
page SignupPage {
|
|
component: import Signup from "@ext/pages/auth/Signup"
|
|
}
|
|
|
|
route LoginRoute { path: "/login", to: LoginPage }
|
|
page LoginPage {
|
|
component: import Login from "@ext/pages/auth/Login"
|
|
}
|
|
|
|
route HomeRoute { path: "/", to: MainPage }
|
|
page MainPage {
|
|
authRequired: true,
|
|
component: import Main from "@ext/pages/Main"
|
|
}
|
|
|
|
route AboutRoute { path: "/about", to: AboutPage }
|
|
page AboutPage {
|
|
component: import About from "@ext/pages/About"
|
|
}
|
|
|
|
route ProfileRoute { path: "/profile", to: ProfilePage }
|
|
page ProfilePage {
|
|
authRequired: true,
|
|
component: import { ProfilePage } from "@ext/pages/ProfilePage"
|
|
}
|
|
|
|
// Page for viewing a specific task
|
|
//
|
|
route TaskRoute { path: "/task/:id", to: TaskPage }
|
|
page TaskPage {
|
|
authRequired: true,
|
|
component: import Task from "@ext/pages/Task"
|
|
}
|
|
|
|
// --------- Queries --------- //
|
|
|
|
query getTasks {
|
|
fn: import { getTasks } from "@ext/queries.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
query getNumTasks {
|
|
fn: import { getNumTasks } from "@ext/queries.js",
|
|
entities: [Task],
|
|
auth: false
|
|
}
|
|
|
|
query getTask {
|
|
fn: import { getTask } from "@ext/queries.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
// --------- Actions --------- //
|
|
|
|
action createTask {
|
|
fn: import { createTask } from "@ext/actions.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
action updateTaskIsDone {
|
|
fn: import { updateTaskIsDone } from "@ext/actions.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
action deleteCompletedTasks {
|
|
fn: import { deleteCompletedTasks } from "@ext/actions.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
action toggleAllTasks {
|
|
fn: import { toggleAllTasks } from "@ext/actions.js",
|
|
entities: [Task]
|
|
}
|