wasp/examples/waspello/main.wasp

117 lines
2.3 KiB
JavaScript
Raw Normal View History

2021-07-05 19:08:13 +03:00
app trello {
title: "trello",
2021-07-05 19:08:13 +03:00
db: {
system: PostgreSQL
},
2021-07-05 19:08:13 +03:00
auth: {
2021-07-05 19:08:13 +03:00
userEntity: User,
methods: {
usernameAndPassword: {}
},
2021-07-05 19:08:13 +03:00
onAuthFailedRedirectTo: "/login"
},
dependencies: [
("react-feather", "2.0.9"),
("classnames", "2.3.1"),
("react-tiny-popover", "7.1.0"),
("react-beautiful-dnd", "13.1.0")
]
2021-07-05 19:08:13 +03:00
}
route MainRoute { path: "/", to: Main }
2021-07-05 19:08:13 +03:00
page Main {
authRequired: true,
component: import Main from "@ext/MainPage.js"
}
route SignupRoute { path: "/signup", to: Signup }
2021-07-05 19:08:13 +03:00
page Signup {
component: import Signup from "@ext/SignupPage"
}
route LoginRoute { path: "/login", to: Login }
2021-07-05 19:08:13 +03:00
page Login {
component: import Login from "@ext/LoginPage"
}
// Entities
entity User {=psl
id Int @id @default(autoincrement())
username String @unique
2021-07-05 19:08:13 +03:00
password String
lists List[]
cards Card[]
psl=}
entity List {=psl
id Int @id @default(autoincrement())
name String
pos Float
// List has a single author.
user User @relation(fields: [userId], references: [id])
userId Int
cards Card[]
psl=}
entity Card {=psl
id Int @id @default(autoincrement())
title String
pos Float
// Card belongs to a single list.
list List @relation(fields: [listId], references: [id])
listId Int
// Card has a single author.
author User @relation(fields: [authorId], references: [id])
authorId Int
psl=}
// ------------------- Queries and actions
query getListsAndCards {
fn: import { getListsAndCards } from "@ext/queries.js",
entities: [List, Card]
}
// Lists
action createList {
fn: import { createList } from "@ext/actions.js",
entities: [List]
}
action updateList {
fn: import { updateList } from "@ext/actions.js",
entities: [List]
}
action deleteList {
fn: import { deleteList } from "@ext/actions.js",
entities: [List, Card]
}
action createListCopy {
fn: import { createListCopy } from "@ext/actions.js",
entities: [List, Card]
}
2021-07-05 19:08:13 +03:00
// Cards
action createCard {
fn: import { createCard } from "@ext/actions.js",
entities: [Card]
}
action updateCard {
fn: import { updateCard } from "@ext/actions.js",
entities: [Card]
}