1
1
mirror of https://github.com/wasp-lang/wasp.git synced 2024-12-23 00:51:36 +03:00
wasp/examples/realworld/main.wasp

113 lines
2.5 KiB
JavaScript
Raw Normal View History

app Conduit {
title: "Conduit"
}
route "/" -> page Main
page Main {
component: import Main from "@ext/MainPage.js"
}
route "/login" -> page Login
page Login {
component: import Login from "@ext/LoginPage.js"
}
route "/register" -> page Signup
page Signup {
component: import Signup from "@ext/SignupPage.js"
}
route "/settings" -> page UserSettings
page UserSettings {
component: import UserSettings from "@ext/UserSettingsPage.js"
}
route "/@:username" -> page UserProfile
page UserProfile {
component: import UserProfile from "@ext/UserProfilePage.js"
}
route "/editor/:articleId?" -> page ArticleEditor
2020-11-20 20:22:49 +03:00
page ArticleEditor {
component: import ArticleEditor from "@ext/ArticleEditorPage.js"
}
// TODO: Instead of articleId, we should some combination of its title and
// a random string, if I got it right. Figure out better what is the spec
// and implement it correctly.
route "/article/:articleId" -> page ArticleView
page ArticleView {
component: import ArticleView from "@ext/ArticleViewPage.js"
}
entity User {=psl
id Int @id @default(autoincrement())
username String @unique
email String @unique
password String
bio String?
profilePictureUrl String?
2020-11-20 20:22:49 +03:00
articles Article[]
psl=}
// TODO: Add tags.
// TODO: Add creation and update times.
entity Article {=psl
2020-11-24 22:39:36 +03:00
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
title String
description String
markdownContent String
user User @relation(fields: [userId], references: [id])
userId Int
psl=}
auth {
userEntity: User,
methods: [ EmailAndPassword ]
}
action signup {
fn: import { signup } from "@ext/actions.js",
entities: [User]
}
action updateUser {
fn: import { updateUser } from "@ext/actions.js",
entities: [User]
}
query getUser {
fn: import { getUser } from "@ext/queries.js",
entities: [User]
2020-11-20 20:22:49 +03:00
}
query getArticlesByUser {
fn: import { getArticlesByUser } from "@ext/queries.js",
entities: [Article]
}
query getArticle {
fn: import { getArticle } from "@ext/queries.js",
entities: [Article]
}
action createArticle {
fn: import { createArticle } from "@ext/actions.js",
entities: [Article]
}
action updateArticle {
fn: import { updateArticle } from "@ext/actions.js",
entities: [Article]
}
action deleteArticle {
fn: import { deleteArticle } from "@ext/actions.js",
entities: [Article]
2020-11-24 22:39:36 +03:00
}
dependencies {=json
"react-markdown": "5.0.3",
"moment": "2.29.1"
json=}