-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.wasp
112 lines (91 loc) · 2.91 KB
/
main.wasp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
app GetCommunityIdeasApp { // Main declaration, defines a new web app.
title: "GetCommunityIdeas app", // Used as a browser tab title.
dependencies: [
("react-hook-form", "^7.29.0"),
("react-select", "^5.2.2"),
("@material-ui/core", "4.12.4"),
("moment", "2.29.1"),
("@material-ui/icons", "4.11.2"),
]
}
route RootRoute { path: "/", to: MainPage } // Render page MainPage on url `/` (default url).
route CreateIdeaRoute { path: "/create-idea", to: CreateIdeaPage } // Render page CreateIdeaPage on url `/create-idea`.
route CreateIdeaRoute { path: "/ideas", to: ListIdeasPage } // Render page CreateIdeaPage on url `/create-idea`.
route TaskRoute { path: "/idea/:id", to: IdeaPage }
page MainPage {
// We specify that ReactJS implementation of our page can be
// found in `ext/MainPage.js` as a default export (uses standard
// js import syntax).
component: import Main from "@ext/pages/MainPage.js"
}
page CreateIdeaPage {
// We specify that ReactJS implementation of our page can be
// found in `ext/MainPage.js` as a default export (uses standard
// js import syntax).
component: import Main from "@ext/pages/CreateIdeaPage.js"
}
page ListIdeasPage {
component: import Main from "@ext/pages/ListIdeasPage.js"
}
page IdeaPage {
component: import Main from "@ext/pages/IdeaPage.js"
}
// Entities
entity Idea {=psl
id Int @id @default(autoincrement())
description String
twitterHandle String
isApproved Boolean @default(false)
votes Int @default(0)
url String @default("")
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
goals Goal[]
category Category @relation(fields: [categoryId], references: [id])
categoryId Int
psl=}
entity Goal {=psl
id Int @id @default(autoincrement())
name String @unique
ideas Idea[]
createdAt DateTime @default(now())
psl=}
entity Category {=psl
id Int @id @default(autoincrement())
name String @unique
ideas Idea[]
createdAt DateTime @default(now())
psl=}
// Queries
query getApprovedIdeas {
fn: import { getApprovedIdeas } from "@ext/queries.js",
entities: [Idea]
}
query getApprovedUnvotedIdeas {
fn: import { getApprovedUnvotedIdeas } from "@ext/queries.js",
entities: [Idea]
}
query getIdeaById {
fn: import { getIdeaById } from "@ext/queries.js",
entities: [Idea]
}
query getGoals {
fn: import { getGoals } from "@ext/queries.js",
entities: [Goal]
}
query getCategories {
fn: import { getCategories } from "@ext/queries.js",
entities: [Category]
}
query getCategoriesAndGoals {
fn: import { getCategoriesAndGoals } from "@ext/queries.js",
entities: [Category, Goal]
}
action createIdea {
fn: import { createIdea } from "@ext/actions.js",
entities: [Idea]
}
action updateIdea {
fn: import { updateIdea } from "@ext/actions.js",
entities: [Idea]
}