wasp/examples/realworld/main.wasp

166 lines
3.7 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"
}
2020-11-24 23:10:26 +03:00
route "/editor/:articleSlug?" -> page ArticleEditor
2020-11-20 20:22:49 +03:00
page ArticleEditor {
component: import ArticleEditor from "@ext/ArticleEditorPage.js"
}
2020-11-24 23:10:26 +03:00
route "/article/:articleSlug" -> page ArticleView
2020-11-20 20:22:49 +03:00
page ArticleView {
component: import ArticleView from "@ext/ArticleViewPage.js"
}
entity User {=psl
2020-11-25 00:57:14 +03:00
id Int @id @default(autoincrement())
username String @unique
email String @unique
password String
bio String?
profilePictureUrl String?
2020-11-25 00:57:14 +03:00
articles Article[]
comments Comment[]
2020-11-27 00:48:35 +03:00
favoriteArticles Article[] @relation("FavoritedArticles")
2020-11-20 20:22:49 +03:00
psl=}
entity Article {=psl
2020-11-24 22:39:36 +03:00
id Int @id @default(autoincrement())
2020-11-24 23:10:26 +03:00
slug String @unique
2020-11-24 22:39:36 +03:00
createdAt DateTime @default(now())
2020-11-24 23:10:26 +03:00
updatedAt DateTime @updatedAt
2020-11-24 22:39:36 +03:00
title String
description String
markdownContent String
2020-11-25 00:57:14 +03:00
2020-11-24 22:39:36 +03:00
user User @relation(fields: [userId], references: [id])
userId Int
2020-11-25 00:57:14 +03:00
comments Comment[]
2020-11-25 18:25:26 +03:00
tags ArticleTag[]
2020-11-27 00:48:35 +03:00
favoritedBy User[] @relation("FavoritedArticles")
2020-11-25 00:57:14 +03:00
psl=}
entity Comment {=psl
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
content String
user User @relation(fields: [userId], references: [id])
userId Int
article Article @relation(fields: [articleId], references: [id])
articleId Int
psl=}
2020-11-25 18:25:26 +03:00
entity ArticleTag {=psl
name String @id
articles Article[]
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]
}
2020-11-27 00:48:35 +03:00
query getFavoritedArticles {
fn: import { getFavoritedArticles } from "@ext/queries.js",
entities: [Article]
}
2020-11-20 20:22:49 +03:00
query getArticle {
fn: import { getArticle } from "@ext/queries.js",
entities: [Article]
}
2020-11-25 00:57:14 +03:00
query getArticleComments {
fn: import { getArticleComments } from "@ext/queries.js",
entities: [Comment]
}
2020-11-20 20:22:49 +03:00
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
}
2020-11-27 00:48:35 +03:00
action setArticleFavorited {
fn: import { setArticleFavorited } from "@ext/actions.js",
entities: [Article]
}
2020-11-25 00:57:14 +03:00
action createComment {
fn: import { createComment } from "@ext/actions.js",
entities: [Comment]
}
action deleteComment {
fn: import { deleteComment } from "@ext/actions.js",
entities: [Comment]
}
2020-11-26 18:35:38 +03:00
query getTags {
fn: import { getTags } from "@ext/actions.js",
entities: [ArticleTag, Article]
}
2020-11-24 22:39:36 +03:00
dependencies {=json
2020-11-25 00:57:14 +03:00
"prop-types": "15.7.2",
2020-11-24 22:39:36 +03:00
"react-markdown": "5.0.3",
2020-11-24 23:10:26 +03:00
"moment": "2.29.1",
"slug": "4.0.2"
2020-11-24 22:39:36 +03:00
json=}