mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-09-11 15:26:19 +03:00
328 lines
8.2 KiB
JavaScript
328 lines
8.2 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",
|
|
// },
|
|
discord: {
|
|
configFn: import { config } from "@src/auth/discord",
|
|
userSignupFields: import { userSignupFields } from "@src/auth/discord"
|
|
},
|
|
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",
|
|
onBeforeSignup: import { onBeforeSignup } from "@src/auth/hooks.js",
|
|
onAfterSignup: import { onAfterSignup } from "@src/auth/hooks.js",
|
|
onBeforeOAuthRedirect: import { onBeforeOAuthRedirect } from "@src/auth/hooks.js",
|
|
onBeforeLogin: import { onBeforeLogin } from "@src/auth/hooks.js",
|
|
onAfterLogin: import { onAfterLogin } from "@src/auth/hooks.js",
|
|
},
|
|
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: {
|
|
seeds: [
|
|
import { devSeedSimple } from "@src/dbSeeds",
|
|
import { prodSeed } from "@src/dbSeeds"
|
|
]
|
|
},
|
|
emailSender: {
|
|
provider: SMTP,
|
|
defaultFrom: {
|
|
email: "mihovil@ilakovac.com"
|
|
},
|
|
},
|
|
}
|
|
|
|
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"
|
|
}
|
|
|
|
route CatchAllRoute { path: "*", to: CatchAllPage }
|
|
page CatchAllPage {
|
|
component: import { CatchAllPage } from "@src/pages/CatchAll"
|
|
}
|
|
|
|
// --------- 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]
|
|
}
|
|
|
|
|
|
// --------- 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=}
|
|
}
|
|
}
|
|
}
|
|
|
|
// --------- Testing --------- //
|
|
|
|
action testingAction {
|
|
fn: import { testingAction } from "@src/testTypes/operations/server",
|
|
entities: []
|
|
}
|
|
|
|
query getDate {
|
|
fn: import { getDate } from "@src/testTypes/operations/definitions"
|
|
}
|
|
|
|
|
|
query getAnythingNoAuth {
|
|
fn: import { getAnythingNoAuth } from "@src/testTypes/operations/definitions",
|
|
auth: false,
|
|
entities: []
|
|
}
|
|
|
|
query getAnythingAuth {
|
|
fn: import { getAnythingAuth } from "@src/testTypes/operations/definitions",
|
|
auth: true,
|
|
entities: []
|
|
}
|
|
|
|
query getTrueVoid {
|
|
fn: import { getTrueVoid } from "@src/testTypes/operations/definitions",
|
|
entities: []
|
|
}
|
|
|
|
query getAnyNoAuth {
|
|
fn: import { getAnyNoAuth } from "@src/testTypes/operations/definitions",
|
|
auth: false,
|
|
entities: []
|
|
}
|
|
|
|
query getAnyAuth {
|
|
fn: import { getAnyAuth } from "@src/testTypes/operations/definitions",
|
|
auth: true,
|
|
entities: []
|
|
}
|
|
|
|
query getAnyToNumberSpecified {
|
|
fn: import { getAnyToNumberSpecified } from "@src/testTypes/operations/definitions",
|
|
auth: true,
|
|
entities: []
|
|
}
|
|
|
|
|
|
action taskToTaskUnspecified {
|
|
fn: import { taskToTaskUnspecified } from "@src/testTypes/operations/definitions",
|
|
entities: [Task]
|
|
}
|
|
|
|
action taskToTaskSatisfies {
|
|
fn: import { taskToTaskSatisfies } from "@src/testTypes/operations/definitions",
|
|
entities: [Task]
|
|
}
|
|
|
|
action taskToTaskSpecified {
|
|
fn: import { taskToTaskSpecified } from "@src/testTypes/operations/definitions",
|
|
entities: [Task]
|
|
}
|
|
|
|
action voidToStringAuth {
|
|
fn: import { voidToStringAuth } from "@src/testTypes/operations/definitions",
|
|
auth: true,
|
|
entities: [Task]
|
|
}
|
|
|
|
action voidToStringNoAuth {
|
|
fn: import { voidToStringNoAuth } from "@src/testTypes/operations/definitions",
|
|
auth: false,
|
|
entities: [Task]
|
|
}
|
|
|
|
action unspecifiedToNumber {
|
|
fn: import { unspecifiedToNumber } from "@src/testTypes/operations/definitions",
|
|
entities: [Task]
|
|
|
|
}
|
|
|
|
action boolToStringAuth {
|
|
fn: import { boolToStringAuth } from "@src/testTypes/operations/definitions",
|
|
auth: true,
|
|
entities: [Task]
|
|
}
|
|
|
|
action boolToStringNoAuth {
|
|
fn: import { boolToStringNoAuth } from "@src/testTypes/operations/definitions",
|
|
auth: false,
|
|
entities: [Task]
|
|
}
|
|
|
|
action boolToVoidNoAuth {
|
|
fn: import { boolToVoidNoAuth } from "@src/testTypes/operations/definitions",
|
|
auth: false,
|
|
entities: [Task]
|
|
}
|
|
|
|
action boolToVoidAuth {
|
|
fn: import { boolToVoidAuth } from "@src/testTypes/operations/definitions",
|
|
auth: true,
|
|
entities: [Task]
|
|
}
|