mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-29 03:53:14 +03:00
239 lines
5.8 KiB
JavaScript
239 lines
5.8 KiB
JavaScript
app todoApp {
|
|
wasp: {
|
|
version: "^0.14.0"
|
|
},
|
|
title: "ToDo App",
|
|
// head: [],
|
|
webSocket: {
|
|
fn: import { webSocketFn } from "@src/webSocket",
|
|
// autoConnect: false
|
|
},
|
|
auth: {
|
|
userEntity: User,
|
|
methods: {
|
|
// usernameAndPassword: {
|
|
// userSignupFields: import { userSignupFields } from "@src/auth/github",
|
|
// },
|
|
google: {
|
|
configFn: import { config } from "@src/auth/google",
|
|
userSignupFields: import { userSignupFields } from "@src/auth/google"
|
|
},
|
|
gitHub: {
|
|
configFn: import { config } from "@src/auth/github.js",
|
|
userSignupFields: import { userSignupFields } from "@src/auth/github.js"
|
|
},
|
|
// keycloak: {},
|
|
email: {
|
|
userSignupFields: import { userSignupFields } from "@src/auth/email",
|
|
fromField: {
|
|
name: "ToDO App",
|
|
email: "mihovil@ilakovac.com"
|
|
},
|
|
emailVerification: {
|
|
getEmailContentFn: import { getVerificationEmailContent } from "@src/auth/email",
|
|
clientRoute: EmailVerificationRoute,
|
|
},
|
|
passwordReset: {
|
|
getEmailContentFn: import { getPasswordResetEmailContent } from "@src/auth/email",
|
|
clientRoute: PasswordResetRoute
|
|
},
|
|
},
|
|
},
|
|
onAuthFailedRedirectTo: "/login",
|
|
onAuthSucceededRedirectTo: "/profile"
|
|
},
|
|
server: {
|
|
setupFn: import setup from "@src/serverSetup",
|
|
middlewareConfigFn: import { serverMiddlewareFn } from "@src/serverSetup",
|
|
},
|
|
client: {
|
|
rootComponent: import { App } from "@src/App",
|
|
setupFn: import setup from "@src/clientSetup"
|
|
},
|
|
db: {
|
|
system: PostgreSQL,
|
|
seeds: [
|
|
import { devSeedSimple } from "@src/dbSeeds",
|
|
import { prodSeed } from "@src/dbSeeds"
|
|
]
|
|
},
|
|
emailSender: {
|
|
provider: SMTP,
|
|
defaultFrom: {
|
|
email: "mihovil@ilakovac.com"
|
|
},
|
|
},
|
|
}
|
|
|
|
entity User {=psl
|
|
id Int @id @default(autoincrement())
|
|
// Business logic
|
|
tasks Task[]
|
|
address String?
|
|
psl=}
|
|
|
|
entity Task {=psl
|
|
id Int @id @default(autoincrement())
|
|
description String
|
|
isDone Boolean @default(false)
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId Int
|
|
psl=}
|
|
|
|
route SignupRoute { path: "/signup", to: SignupPage }
|
|
page SignupPage {
|
|
component: import Signup from "@src/pages/auth/Signup"
|
|
}
|
|
|
|
route LoginRoute { path: "/login", to: LoginPage }
|
|
page LoginPage {
|
|
component: import Login from "@src/pages/auth/Login"
|
|
}
|
|
|
|
route PasswordResetRoute { path: "/password-reset", to: PasswordResetPage }
|
|
page PasswordResetPage {
|
|
component: import { PasswordReset } from "@src/pages/auth/PasswordReset",
|
|
}
|
|
|
|
route EmailVerificationRoute { path: "/email-verification-", to: EmailVerificationPage }
|
|
page EmailVerificationPage {
|
|
component: import { EmailVerification } from "@src/pages/auth/EmailVerification",
|
|
}
|
|
|
|
route RequestPasswordResetRoute { path: "/request-password-reset", to: RequestPasswordResetPage }
|
|
page RequestPasswordResetPage {
|
|
component: import { RequestPasswordReset } from "@src/pages/auth/RequestPasswordReset",
|
|
}
|
|
|
|
route HomeRoute { path: "/", to: MainPage }
|
|
page MainPage {
|
|
authRequired: true,
|
|
component: import Main from "@src/pages/Main"
|
|
}
|
|
|
|
route AboutRoute { path: "/about", to: AboutPage }
|
|
page AboutPage {
|
|
component: import About from "@src/pages/About"
|
|
}
|
|
|
|
route ProfileRoute { path: "/profile", to: ProfilePage }
|
|
page ProfilePage {
|
|
authRequired: true,
|
|
component: import { ProfilePage } from "@src/pages/ProfilePage"
|
|
}
|
|
|
|
// Page for viewing a specific task
|
|
//
|
|
route TaskRoute { path: "/task/:id", to: TaskPage }
|
|
page TaskPage {
|
|
authRequired: true,
|
|
component: import Task from "@src/pages/Task"
|
|
}
|
|
|
|
// --------- Queries --------- //
|
|
|
|
query getTasks {
|
|
fn: import { getTasks } from "@src/queries",
|
|
entities: [Task]
|
|
}
|
|
|
|
api fooBar {
|
|
fn: import { fooBar } from "@src/apis",
|
|
middlewareConfigFn: import { fooBarMiddlewareFn } from "@src/apis",
|
|
entities: [Task],
|
|
// ALL here let's our CORS work. If we did GET, we would need an apiNamespace over it with CORS.
|
|
httpRoute: (ALL, "/foo/bar")
|
|
}
|
|
|
|
apiNamespace bar {
|
|
middlewareConfigFn: import { barNamespaceMiddlewareFn } from "@src/apis",
|
|
path: "/bar"
|
|
}
|
|
|
|
api barBaz {
|
|
fn: import { barBaz } from "@src/apis",
|
|
auth: false,
|
|
entities: [Task],
|
|
httpRoute: (GET, "/bar/baz")
|
|
}
|
|
|
|
api webhookCallback {
|
|
fn: import { webhookCallback } from "@src/apis",
|
|
middlewareConfigFn: import { webhookCallbackMiddlewareFn } from "@src/apis",
|
|
httpRoute: (POST, "/webhook/callback"),
|
|
auth: false
|
|
}
|
|
|
|
query getNumTasks {
|
|
fn: import { getNumTasks } from "@src/queries",
|
|
entities: [Task],
|
|
auth: false
|
|
}
|
|
|
|
query getTask {
|
|
fn: import { getTask } from "@src/queries",
|
|
entities: [Task]
|
|
}
|
|
|
|
query getDate {
|
|
fn: import { getDate } from "@src/queries"
|
|
}
|
|
|
|
query getAnything {
|
|
fn: import { getAnything } from "@src/queries",
|
|
entities: []
|
|
}
|
|
|
|
query getTrueVoid {
|
|
fn: import { getTrueVoid } from "@src/queries",
|
|
entities: []
|
|
}
|
|
|
|
|
|
// --------- Actions --------- //
|
|
|
|
action createTask {
|
|
fn: import { createTask } from "@src/actions",
|
|
entities: [Task]
|
|
}
|
|
|
|
action updateTaskIsDone {
|
|
fn: import { updateTaskIsDone } from "@src/actions",
|
|
entities: [Task]
|
|
}
|
|
|
|
action deleteCompletedTasks {
|
|
fn: import { deleteCompletedTasks } from "@src/actions",
|
|
entities: [Task]
|
|
}
|
|
|
|
action toggleAllTasks {
|
|
fn: import { toggleAllTasks } from "@src/actions",
|
|
entities: [Task]
|
|
}
|
|
|
|
job mySpecialJob {
|
|
executor: PgBoss,
|
|
perform: {
|
|
fn: import { foo } from "@src/jobs/bar",
|
|
executorOptions: {
|
|
pgBoss: {=json { "retryLimit": 1 } json=}
|
|
}
|
|
},
|
|
entities: [Task]
|
|
}
|
|
|
|
job mySpecialScheduledJob {
|
|
executor: PgBoss,
|
|
perform: {
|
|
fn: import { foo } from "@src/jobs/bar"
|
|
},
|
|
schedule: {
|
|
cron: "0 * * * *",
|
|
args: {=json { "foo": "bar" } json=},
|
|
executorOptions: {
|
|
pgBoss: {=json { "retryLimit": 2 } json=}
|
|
}
|
|
}
|
|
}
|