wasp/waspc/examples/todoApp/todoApp.wasp
Matija Sosic 68155711e8
Implemented FE ACL & updated the examples. (#165)
* Implemented FE ACL & updated the examples.

* PR fixes, fixed tests.
2021-02-01 16:32:07 +01:00

94 lines
1.9 KiB
JavaScript

app todoApp {
title: "ToDo App"
}
auth {
userEntity: User,
methods: [ EmailAndPassword ],
onAuthFailedRedirectTo: "/login"
}
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 "/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"
}
route "/" -> page Main
page Main {
authRequired: true,
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 {
authRequired: true,
component: import { ProfilePage } from "@ext/pages/ProfilePage"
}
// Page for viewing a specific task
//
route "/task/:id" -> page Task
page Task {
authRequired: true,
component: import Task from "@ext/pages/Task"
}
// --------- Queries --------- //
query getTasks {
fn: import { getTasks } from "@ext/queries.js",
entities: [Task]
}
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]
}