mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-18 14:41:41 +03:00
0cde880f24
* Add wasp field to AppSpec.App * Validate app.wasp.version in AppSpec.Valid * Add app.wasp.version field on .wasp file generated by CreateNewProject * Add app.wasp.version to .wasp files of e2e tests * Add app.wasp.version to examples' .wasp files * Add app.wasp.version to docs * Change waspc version from 0.6.0.0 to 0.6.0 * Change app.wasp.version validation to use regular semver * Format code * Refactor app.wasp.version validation * Refactor app.wasp.version validation * Update supported app.wasp.version format in docs * Add TODO to validateWaspVersion * Refactor app.wasp.version using toEnum * Create Wasp.Version module with waspVersion constant * Fix parseWaspVersionRange regex Fixed: - The regex wasn't checking the string *starts* with ^. - The . symbols were not escaped. - The $ token is not specified as supported in the regex-tdfa docs. \' is used instead. * Add comment explaining wasp version validation restrictions * Use Wasp.Version.waspVersion instead of Paths_wasp.version
161 lines
3.7 KiB
JavaScript
161 lines
3.7 KiB
JavaScript
app todoApp {
|
|
wasp: {
|
|
version: "^0.6.0"
|
|
},
|
|
title: "ToDo App",
|
|
head: [
|
|
"<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap\" />"
|
|
],
|
|
dependencies: [
|
|
("@material-ui/core", "4.11.3")
|
|
],
|
|
auth: {
|
|
userEntity: User,
|
|
// externalAuthEntity: SocialLogin,
|
|
methods: {
|
|
usernameAndPassword: {},
|
|
// google: {
|
|
// configFn: import { config } from "@ext/auth/google.js",
|
|
// getUserFieldsFn: import { getUserFields } from "@ext/auth/google.js"
|
|
// }
|
|
},
|
|
onAuthFailedRedirectTo: "/login",
|
|
onAuthSucceededRedirectTo: "/profile"
|
|
},
|
|
server: {
|
|
setupFn: import setup from "@ext/serverSetup.js"
|
|
},
|
|
client: {
|
|
setupFn: import setup from "@ext/clientSetup.js"
|
|
},
|
|
db: {
|
|
system: PostgreSQL
|
|
}
|
|
}
|
|
|
|
entity User {=psl
|
|
id Int @id @default(autoincrement())
|
|
username String @unique
|
|
password String
|
|
tasks Task[]
|
|
externalAuthAssociations SocialLogin[]
|
|
psl=}
|
|
|
|
entity SocialLogin {=psl
|
|
id Int @id @default(autoincrement())
|
|
provider String
|
|
providerId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
userId Int
|
|
createdAt DateTime @default(now())
|
|
@@unique([provider, providerId, userId])
|
|
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 "@ext/pages/auth/Signup"
|
|
}
|
|
|
|
route LoginRoute { path: "/login", to: LoginPage }
|
|
page LoginPage {
|
|
component: import Login from "@ext/pages/auth/Login"
|
|
}
|
|
|
|
route HomeRoute { path: "/", to: MainPage }
|
|
page MainPage {
|
|
authRequired: true,
|
|
component: import Main from "@ext/pages/Main"
|
|
}
|
|
|
|
route AboutRoute { path: "/about", to: AboutPage }
|
|
page AboutPage {
|
|
component: import About from "@ext/pages/About"
|
|
}
|
|
|
|
route ProfileRoute { path: "/profile", to: ProfilePage }
|
|
page ProfilePage {
|
|
authRequired: true,
|
|
component: import { ProfilePage } from "@ext/pages/ProfilePage"
|
|
}
|
|
|
|
// Page for viewing a specific task
|
|
//
|
|
route TaskRoute { path: "/task/:id", to: TaskPage }
|
|
page TaskPage {
|
|
authRequired: true,
|
|
component: import Task from "@ext/pages/Task"
|
|
}
|
|
|
|
// --------- Queries --------- //
|
|
|
|
query getTasks {
|
|
fn: import { getTasks } from "@ext/queries.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
query getNumTasks {
|
|
fn: import { getNumTasks } from "@ext/queries.js",
|
|
entities: [Task],
|
|
auth: false
|
|
}
|
|
|
|
query getTask {
|
|
fn: import { getTask } from "@ext/queries.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
// --------- Actions --------- //
|
|
|
|
action createTask {
|
|
fn: import { createTask } from "@ext/actions.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
action updateTaskIsDone {
|
|
fn: import { updateTaskIsDone } from "@ext/actions.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
action deleteCompletedTasks {
|
|
fn: import { deleteCompletedTasks } from "@ext/actions.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
action toggleAllTasks {
|
|
fn: import { toggleAllTasks } from "@ext/actions.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
job mySpecialJob {
|
|
executor: PgBoss,
|
|
perform: {
|
|
fn: import { foo } from "@ext/jobs/bar.js",
|
|
executorOptions: {
|
|
pgBoss: {=json { "retryLimit": 1 } json=}
|
|
}
|
|
},
|
|
entities: [Task]
|
|
}
|
|
|
|
job mySpecialScheduledJob {
|
|
executor: PgBoss,
|
|
perform: {
|
|
fn: import { foo } from "@ext/jobs/bar.js"
|
|
},
|
|
schedule: {
|
|
cron: "0 * * * *",
|
|
args: {=json { "foo": "bar" } json=},
|
|
executorOptions: {
|
|
pgBoss: {=json { "retryLimit": 2 } json=}
|
|
}
|
|
}
|
|
}
|