-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.wasp
146 lines (132 loc) · 3.33 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
app dailyaicomic {
wasp: {
version: "^0.9.0"
},
title: "Daily AI Comics",
auth: {
userEntity: User,
externalAuthEntity: SocialLogin,
methods: {
google: {
getUserFieldsFn: import { getUserFields } from "@server/auth/google.js",
configFn: import { getConfig } from "@server/auth/google.js",
},
},
onAuthFailedRedirectTo: "/",
},
db: {
system: PostgreSQL
},
client: {
rootComponent: import { App } from "@client/App.tsx"
},
dependencies: [
("chatgpt", "5.1.1"),
("@chakra-ui/react", "1.8.8"),
("react-icons", "4.8.0"),
("@emotion/react", "11.10.6"),
("@emotion/styled", "11.10.6"),
("react-hook-form", "7.43.1"),
("@fontsource/libre-baskerville", "4.5.10"),
("@fontsource/source-sans-pro", "4.5.11"),
("axios", "^0.27.2"),
("@aws-sdk/client-s3", "3.295.0"),
("react-syntax-highlighter", "15.5.0"),
("@types/react-syntax-highlighter", "15.5.6")
],
}
route RootRoute { path: "/", to: MainPage }
page MainPage {
component: import Main from "@client/pages/MainPage.tsx"
}
route RootRoute { path: "/:comicId", to: DetailsPage }
page DetailsPage {
component: import Main from "@client/pages/DetailsPage.tsx"
}
query getComics {
fn: import { getComics } from "@server/queries/comics.js",
entities: [Comic]
}
query getComic {
fn: import { getComic } from "@server/queries/comics.js",
entities: [Comic]
}
action voteForComic {
fn: import { vote } from "@server/queries/vote.js",
entities: [Comic, Vote],
auth: true
}
query getTodaysUserVote {
fn: import { getUserVote } from "@server/queries/vote.js",
entities: [Vote],
auth: true
}
entity User {=psl
id Int @id @default(autoincrement())
username String
password String
externalAuthAssociations SocialLogin[]
votes Vote[]
psl=}
entity SocialLogin {=psl
id String @id @default(uuid())
userId Int
user User @relation(fields: [userId], references: [id])
provider String
providerId String
createdAt DateTime @default(now())
psl=}
entity ComicJob {=psl
id String @id @default(uuid())
status String
createdAt DateTime @default(now())
comics Comic[]
psl=}
entity Comic {=psl
id String @id @default(uuid())
title String @default("")
prompt String
imagePrefix String
images ComicImage[]
votes Vote[]
comicJobId String
comicJob ComicJob @relation(fields: [comicJobId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
psl=}
entity ComicImage {=psl
id String @id @default(uuid())
comicId String
comic Comic @relation(fields: [comicId], references: [id])
image String
imageIndex Int
text String
imagePrompt String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
psl=}
entity Vote {=psl
id String @id @default(uuid())
comicId String
comic Comic @relation(fields: [comicId], references: [id])
userId Int
user User @relation(fields: [userId], references: [id])
createdAt DateTime @default(now())
psl=}
job kickoffGeneration {
executor: PgBoss,
schedule: {
cron: "* * * * *",
},
perform: {
fn: import { dailyRun } from "@server/jobs/dailyRun.js"
},
entities: [ComicJob, Comic, ComicImage]
}
job generateComic {
executor: PgBoss,
perform: {
fn: import { generateComicFn } from "@server/jobs/generateComic.js"
},
entities: [ComicJob, Comic, ComicImage]
}