mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-11-24 11:44:51 +03:00
88 lines
1.9 KiB
JavaScript
88 lines
1.9 KiB
JavaScript
app Thoughts {
|
|
wasp: {
|
|
version: "^0.8.0"
|
|
},
|
|
title: "Thoughts",
|
|
db: { system: PostgreSQL },
|
|
auth: {
|
|
userEntity: User,
|
|
methods: {
|
|
usernameAndPassword: {}
|
|
},
|
|
onAuthFailedRedirectTo: "/login"
|
|
},
|
|
dependencies: [
|
|
("react-markdown", "6.0.1"),
|
|
("color-hash", "2.0.1")
|
|
]
|
|
}
|
|
|
|
route MainRoute { path: "/", to: MainPage }
|
|
page MainPage {
|
|
component: import Main from "@client/MainPage.js",
|
|
authRequired: true
|
|
}
|
|
|
|
route ThoughtsRoute { path: "/thoughts", to: ThoughtsPage }
|
|
page ThoughtsPage {
|
|
component: import Thoughts from "@client/ThoughtsPage.js",
|
|
authRequired: true
|
|
}
|
|
|
|
route LoginRoute { path: "/login", to: LoginPage }
|
|
page LoginPage {
|
|
component: import Login from "@client/LoginPage.js"
|
|
}
|
|
|
|
route SignupRoute { path: "/signup", to: SignupPage }
|
|
page SignupPage {
|
|
component: import Signup from "@client/SignupPage"
|
|
}
|
|
|
|
action createThought {
|
|
fn: import { createThought } from "@server/actions.js",
|
|
entities: [Thought, Tag]
|
|
}
|
|
|
|
query getThoughts {
|
|
fn: import { getThoughts } from "@server/queries.js",
|
|
entities: [Thought]
|
|
}
|
|
|
|
query getTags {
|
|
fn: import { getTags } from "@server/queries.js",
|
|
entities: [Tag]
|
|
}
|
|
|
|
entity Thought {=psl
|
|
id Int @id @default(autoincrement())
|
|
textMarkdown String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
tags Tag[]
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId Int
|
|
psl=}
|
|
|
|
entity Tag {=psl
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
createdAt DateTime @default(now())
|
|
thoughts Thought[]
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId Int
|
|
|
|
@@unique([name, userId])
|
|
psl=}
|
|
|
|
entity User {=psl
|
|
id Int @id @default(autoincrement())
|
|
username String @unique
|
|
password String
|
|
|
|
thoughts Thought[]
|
|
tags Tag[]
|
|
psl=}
|