2020-10-30 22:18:17 +03:00
|
|
|
app Conduit {
|
2021-02-05 12:57:26 +03:00
|
|
|
title: "Conduit",
|
|
|
|
|
|
|
|
head: [
|
|
|
|
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap\" />"
|
2022-01-20 13:45:14 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
auth: {
|
|
|
|
userEntity: User,
|
|
|
|
methods: [ EmailAndPassword ],
|
|
|
|
onAuthFailedRedirectTo: "/login"
|
|
|
|
},
|
|
|
|
|
|
|
|
db: { system: PostgreSQL },
|
|
|
|
|
|
|
|
dependencies: [
|
|
|
|
("prop-types", "15.7.2"),
|
|
|
|
("react-markdown", "5.0.3"),
|
|
|
|
("moment", "2.29.1"),
|
|
|
|
("@material-ui/core", "4.11.3"),
|
|
|
|
("@material-ui/icons", "4.11.2"),
|
|
|
|
("slug", "4.0.2")
|
2021-02-05 12:57:26 +03:00
|
|
|
]
|
2020-10-30 18:28:50 +03:00
|
|
|
}
|
|
|
|
|
2020-12-01 20:48:39 +03:00
|
|
|
|
2021-04-21 15:06:25 +03:00
|
|
|
|
2020-12-01 20:48:39 +03:00
|
|
|
// ----------------- Pages ------------------ //
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route RootRoute { path: "/", to: MainPage }
|
|
|
|
page MainPage {
|
2020-10-30 18:28:50 +03:00
|
|
|
component: import Main from "@ext/MainPage.js"
|
|
|
|
}
|
2020-10-30 22:18:17 +03:00
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route LogInRoute { path: "/login", to: LogInPage }
|
|
|
|
page LogInPage {
|
2020-12-01 17:19:45 +03:00
|
|
|
component: import LogIn from "@ext/auth/LoginPage.js"
|
2020-10-30 22:18:17 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route RegisterRoute { path: "/register", to: SignUpPage }
|
|
|
|
page SignUpPage {
|
2020-12-01 17:19:45 +03:00
|
|
|
component: import SignUp from "@ext/auth/SignupPage.js"
|
2020-10-30 22:18:17 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route UserSettingsRoute { path: "/settings", to: UserSettingsPage }
|
|
|
|
page UserSettingsPage {
|
2021-02-01 18:32:07 +03:00
|
|
|
authRequired: true,
|
2020-11-30 20:11:40 +03:00
|
|
|
component: import UserSettings from "@ext/user/components/UserSettingsPage.js"
|
2020-11-19 17:11:23 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route UserProfileRoute { path: "/@:username", to: UserProfilePage }
|
|
|
|
page UserProfilePage {
|
2020-11-30 20:11:40 +03:00
|
|
|
component: import UserProfile from "@ext/user/components/UserProfilePage.js"
|
2020-11-19 17:11:23 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route ArticleEditorRoute { path: "/editor/:articleSlug?", to: ArticleEditorPage }
|
|
|
|
page ArticleEditorPage {
|
2021-02-01 18:32:07 +03:00
|
|
|
authRequired: true,
|
2020-11-30 20:11:40 +03:00
|
|
|
component: import ArticleEditor from "@ext/article/components/ArticleEditorPage.js"
|
2020-11-20 20:22:49 +03:00
|
|
|
}
|
|
|
|
|
2022-01-20 13:45:14 +03:00
|
|
|
route ArticleViewRoute { path: "/article/:articleSlug", to: ArticleViewPage }
|
|
|
|
page ArticleViewPage {
|
2020-11-30 20:11:40 +03:00
|
|
|
component: import ArticleView from "@ext/article/components/ArticleViewPage.js"
|
2020-11-20 20:22:49 +03:00
|
|
|
}
|
|
|
|
|
2020-12-01 20:48:39 +03:00
|
|
|
// ----------------- Entities ------------------ //
|
|
|
|
|
2020-10-30 22:18:17 +03:00
|
|
|
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?
|
2020-11-19 17:11:23 +03:00
|
|
|
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-27 18:10:02 +03:00
|
|
|
followedBy User[] @relation("FollowedUser", references: [id])
|
|
|
|
following User[] @relation("FollowedUser", references: [id])
|
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
|
2020-10-30 22:18:17 +03:00
|
|
|
psl=}
|
|
|
|
|
2020-11-25 18:25:26 +03:00
|
|
|
entity ArticleTag {=psl
|
|
|
|
name String @id
|
|
|
|
|
|
|
|
articles Article[]
|
|
|
|
psl=}
|
|
|
|
|
2020-12-01 20:48:39 +03:00
|
|
|
// ----------------- User operations ------------------ //
|
2020-10-30 22:18:17 +03:00
|
|
|
|
2020-11-27 23:47:12 +03:00
|
|
|
query getUser {
|
|
|
|
fn: import { getUser } from "@ext/user/queries.js",
|
2020-10-30 22:18:17 +03:00
|
|
|
entities: [User]
|
2020-11-19 17:11:23 +03:00
|
|
|
}
|
|
|
|
|
2020-11-27 23:47:12 +03:00
|
|
|
action updateUser {
|
|
|
|
fn: import { updateUser } from "@ext/user/actions.js",
|
2020-11-19 17:11:23 +03:00
|
|
|
entities: [User]
|
2020-11-20 20:22:49 +03:00
|
|
|
}
|
|
|
|
|
2020-11-27 18:10:02 +03:00
|
|
|
action followUser {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { followUser } from "@ext/user/actions.js",
|
2020-11-27 18:10:02 +03:00
|
|
|
entities: [User]
|
|
|
|
}
|
|
|
|
|
2020-12-01 20:48:39 +03:00
|
|
|
// ----------------- Article operations ------------------ //
|
|
|
|
|
2020-11-20 20:22:49 +03:00
|
|
|
query getArticlesByUser {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { getArticlesByUser } from "@ext/article/queries.js",
|
2020-11-20 20:22:49 +03:00
|
|
|
entities: [Article]
|
|
|
|
}
|
|
|
|
|
2020-11-27 00:48:35 +03:00
|
|
|
query getFavoritedArticles {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { getFavoritedArticles } from "@ext/article/queries.js",
|
2020-11-27 00:48:35 +03:00
|
|
|
entities: [Article]
|
|
|
|
}
|
|
|
|
|
2020-11-27 20:49:54 +03:00
|
|
|
query getFollowedArticles {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { getFollowedArticles } from "@ext/article/queries.js",
|
2020-11-27 20:49:54 +03:00
|
|
|
entities: [Article, User]
|
|
|
|
}
|
|
|
|
|
|
|
|
query getAllArticles {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { getAllArticles } from "@ext/article/queries.js",
|
2020-11-27 20:49:54 +03:00
|
|
|
entities: [Article]
|
|
|
|
}
|
|
|
|
|
2020-11-20 20:22:49 +03:00
|
|
|
query getArticle {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { getArticle } from "@ext/article/queries.js",
|
2020-11-20 20:22:49 +03:00
|
|
|
entities: [Article]
|
|
|
|
}
|
|
|
|
|
2020-11-25 00:57:14 +03:00
|
|
|
query getArticleComments {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { getArticleComments } from "@ext/article/queries.js",
|
2020-11-25 00:57:14 +03:00
|
|
|
entities: [Comment]
|
|
|
|
}
|
|
|
|
|
2020-11-20 20:22:49 +03:00
|
|
|
action createArticle {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { createArticle } from "@ext/article/actions.js",
|
2020-11-20 20:22:49 +03:00
|
|
|
entities: [Article]
|
|
|
|
}
|
|
|
|
|
|
|
|
action updateArticle {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { updateArticle } from "@ext/article/actions.js",
|
2020-11-20 20:22:49 +03:00
|
|
|
entities: [Article]
|
|
|
|
}
|
|
|
|
|
|
|
|
action deleteArticle {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { deleteArticle } from "@ext/article/actions.js",
|
2020-11-20 20:22:49 +03:00
|
|
|
entities: [Article]
|
2020-11-24 22:39:36 +03:00
|
|
|
}
|
|
|
|
|
2020-11-27 00:48:35 +03:00
|
|
|
action setArticleFavorited {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { setArticleFavorited } from "@ext/article/actions.js",
|
2020-11-27 00:48:35 +03:00
|
|
|
entities: [Article]
|
|
|
|
}
|
|
|
|
|
2020-11-25 00:57:14 +03:00
|
|
|
action createComment {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { createComment } from "@ext/article/actions.js",
|
2020-11-25 00:57:14 +03:00
|
|
|
entities: [Comment]
|
|
|
|
}
|
|
|
|
|
|
|
|
action deleteComment {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { deleteComment } from "@ext/article/actions.js",
|
2020-11-25 00:57:14 +03:00
|
|
|
entities: [Comment]
|
|
|
|
}
|
|
|
|
|
2020-11-26 18:35:38 +03:00
|
|
|
query getTags {
|
2020-11-27 23:47:12 +03:00
|
|
|
fn: import { getTags } from "@ext/article/queries.js",
|
2020-11-26 18:35:38 +03:00
|
|
|
entities: [ArticleTag, Article]
|
|
|
|
}
|
|
|
|
|
2020-12-01 20:48:39 +03:00
|
|
|
// -------------------------------------------- //
|