mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-26 10:35:04 +03:00
82 lines
1.8 KiB
JavaScript
82 lines
1.8 KiB
JavaScript
app Thoughts {
|
|
title: "Thoughts",
|
|
db: { system: PostgreSQL },
|
|
auth: {
|
|
userEntity: User,
|
|
methods: [ EmailAndPassword ],
|
|
onAuthFailedRedirectTo: "/login"
|
|
},
|
|
dependencies: [
|
|
("react-markdown", "6.0.1"),
|
|
("color-hash", "2.0.1")
|
|
]
|
|
}
|
|
|
|
route MainRoute { path: "/", to: MainPage }
|
|
page MainPage {
|
|
component: import Main from "@ext/MainPage.js",
|
|
authRequired: true
|
|
}
|
|
|
|
route ThoughtsRoute { path: "/thoughts", to: ThoughtsPage }
|
|
page ThoughtsPage {
|
|
component: import Thoughts from "@ext/ThoughtsPage.js",
|
|
authRequired: true
|
|
}
|
|
|
|
route LoginRoute { path: "/login", to: LoginPage }
|
|
page LoginPage {
|
|
component: import Login from "@ext/LoginPage.js"
|
|
}
|
|
|
|
route SignupRoute { path: "/signup", to: SignupPage }
|
|
page SignupPage {
|
|
component: import Signup from "@ext/SignupPage"
|
|
}
|
|
|
|
action createThought {
|
|
fn: import { createThought } from "@ext/actions.js",
|
|
entities: [Thought, Tag]
|
|
}
|
|
|
|
query getThoughts {
|
|
fn: import { getThoughts } from "@ext/queries.js",
|
|
entities: [Thought]
|
|
}
|
|
|
|
query getTags {
|
|
fn: import { getTags } from "@ext/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())
|
|
email String @unique
|
|
password String
|
|
|
|
thoughts Thought[]
|
|
tags Tag[]
|
|
psl=} |