wasp/examples/waspello/main.wasp

134 lines
2.8 KiB
JavaScript

app waspello {
wasp: {
version: "^0.8.0"
},
title: "Waspello",
db: {
system: PostgreSQL
},
auth: {
userEntity: User,
externalAuthEntity: SocialLogin,
methods: {
usernameAndPassword: {},
google: {}
},
onAuthFailedRedirectTo: "/login"
},
dependencies: [
("react-feather", "2.0.9"),
("classnames", "2.3.1"),
("react-tiny-popover", "7.1.0"),
("react-beautiful-dnd", "13.1.0")
]
}
route MainRoute { path: "/", to: Main }
page Main {
authRequired: true,
component: import Main from "@client/MainPage.js"
}
route SignupRoute { path: "/signup", to: Signup }
page Signup {
component: import Signup from "@client/SignupPage"
}
route LoginRoute { path: "/login", to: Login }
page Login {
component: import Login from "@client/LoginPage"
}
// Entities
entity User {=psl
id Int @id @default(autoincrement())
username String @unique
password String
lists List[]
cards Card[]
externalAuthAssociations SocialLogin[]
psl=}
entity SocialLogin {=psl
id Int @id @default(autoincrement())
provider String
providerId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId Int
createdAt DateTime @default(now())
@@unique([provider, providerId, userId])
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 "@server/queries.js",
entities: [List, Card]
}
// Lists
action createList {
fn: import { createList } from "@server/actions.js",
entities: [List]
}
action updateList {
fn: import { updateList } from "@server/actions.js",
entities: [List]
}
action deleteList {
fn: import { deleteList } from "@server/actions.js",
entities: [List, Card]
}
action createListCopy {
fn: import { createListCopy } from "@server/actions.js",
entities: [List, Card]
}
// Cards
action createCard {
fn: import { createCard } from "@server/actions.js",
entities: [Card]
}
action updateCard {
fn: import { updateCard } from "@server/actions.js",
entities: [Card]
}