mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-29 03:53:14 +03:00
94 lines
1.9 KiB
JavaScript
94 lines
1.9 KiB
JavaScript
app crudTesting {
|
|
wasp: {
|
|
version: "^0.12.0"
|
|
},
|
|
head: [
|
|
"<link rel=\"stylesheet\" href=\"https://unpkg.com/mvp.css@1.12/mvp.css\">"
|
|
],
|
|
title: "crud-testing",
|
|
auth: {
|
|
userEntity: User,
|
|
methods: {
|
|
usernameAndPassword: {
|
|
userSignupFields: import { userSignupFields } from "@server/auth.js",
|
|
},
|
|
},
|
|
onAuthFailedRedirectTo: "/login",
|
|
},
|
|
dependencies: [
|
|
("zod", "^3.22.2")
|
|
],
|
|
db: {
|
|
system: PostgreSQL,
|
|
seeds: [
|
|
import { migrateAuth } from "@server/seeds/migrateAuth.js"
|
|
]
|
|
}
|
|
}
|
|
|
|
route RootRoute { path: "/", to: MainPage }
|
|
page MainPage {
|
|
component: import Main from "@client/MainPage.tsx",
|
|
authRequired: true,
|
|
}
|
|
|
|
route LoginRoute { path: "/login", to: LoginPage }
|
|
page LoginPage {
|
|
component: import { LoginPage } from "@client/LoginPage.tsx",
|
|
}
|
|
|
|
route SignupRoute { path: "/signup", to: SignupPage }
|
|
page SignupPage {
|
|
component: import { SignupPage } from "@client/SignupPage.tsx",
|
|
}
|
|
|
|
route DetailRoute { path: "/:id/:something?", to: DetailPage }
|
|
page DetailPage {
|
|
component: import Main from "@client/DetailPage.tsx",
|
|
authRequired: true,
|
|
}
|
|
|
|
entity User {=psl
|
|
id Int @id @default(autoincrement())
|
|
address String?
|
|
tasks Task[]
|
|
psl=}
|
|
|
|
// TODO: validate the fields
|
|
// Maybe delegate to Prisma
|
|
entity Task {=psl
|
|
id Int @id @default(autoincrement())
|
|
title String
|
|
userId Int
|
|
user User @relation(fields: [userId], references: [id])
|
|
psl=}
|
|
|
|
crud tasks {
|
|
entity: Task,
|
|
operations: {
|
|
get: {},
|
|
getAll: {
|
|
overrideFn: import { getAllTasks } from "@server/tasks.js",
|
|
},
|
|
create: {
|
|
overrideFn: import { createTask } from "@server/tasks.js",
|
|
},
|
|
update: {},
|
|
delete: {},
|
|
},
|
|
}
|
|
|
|
job simplePrintJob {
|
|
executor: PgBoss,
|
|
schedule: {
|
|
cron: "* * * * *",
|
|
},
|
|
perform: {
|
|
fn: import { simplePrint } from "@server/jobs.js",
|
|
},
|
|
entities: [Task]
|
|
}
|
|
|
|
action customSignup {
|
|
fn: import { signup } from "@server/auth.js",
|
|
} |