Mxrcy
Explore posts from serversWWasp-lang
•Created by Mxrcy on 8/12/2024 in #đŸ™‹questions
wasp db migrate-dev Error
Here is my Main.Wasp
app rapidFm {
wasp: {
version: "^0.14.0"
},
title: "rapidFm",
client: {
rootComponent: import Layout from "@src/Layout.jsx",
},
auth: {
userEntity: User,
methods: {
usernameAndPassword: {}
},
onAuthFailedRedirectTo: "/login",
onAuthSucceededRedirectTo: "/"
},
}
entity User {
email: String
password: String
stationRole: String
djs: [Dj] // Correct syntax for array of related entities
}
entity Station {
name: String
url: String
shows: [Show]
djs: [Dj]
}
entity Show {
title: String
time: String
duration: Int
stationId: Int
station: Station @relation(fields: [stationId], references: [id]) // Correct relation syntax
}
entity Dj {
alias: String
userId: Int
user: User @relation(fields: [userId], references: [id]) // Correct relation syntax
stationId: Int
station: Station @relation(fields: [stationId], references: [id]) // Correct relation syntax
}
route LoginRoute { path: "/login", to: LoginPage }
page LoginPage {
component: import Login from "@src/pages/auth/Login.jsx"
}
route SignupRoute { path: "/signup", to: SignupPage }
page SignupPage {
component: import Signup from "@src/pages/auth/Signup.jsx"
}
action createStation {
fn: import { createStation } from "@src/actions.js",
entities: [Station]
}
action updateStation {
fn: import { updateStation } from "@src/actions.js",
entities: [Station]
}
action deleteStation {
fn: import { deleteStation } from "@src/actions.js",
entities: [Station]
}
action createShow {
fn: import { createShow } from "@src/actions.js",
entities: [Show, Station]
}
action updateShow {
fn: import { updateShow } from "@src/actions.js",
entities: [Show]
}
action handleWebSocketConnection {
fn: import { handleWebSocketConnection } from "@src/actions.js",
entities: []
}
query getStations {
fn: import { getStations } from "@src/queries.js",
entities: [Station]
}
query getShows {
fn: import { getShows } from "@src/queries.js",
entities: [Show, Station]
}
query getDjs {
fn: import { getDjs } from "@src/queries.js",
entities: [Dj, Station]
}
route HomeRoute { path: "/", to: HomePage }
page HomePage {
component: import HomePage from "@src/pages/Home.jsx",
authRequired: true
}
route StationRoute { path: "/station/:stationId", to: StationPage }
page StationPage {
component: import Station from "@src/pages/Station.jsx",
authRequired: true
}
route AdminRoute { path: "/admin", to: AdminPage }
page AdminPage {
component: import AdminPage from "@src/pages/Admin.jsx",
authRequired: true
}
app rapidFm {
wasp: {
version: "^0.14.0"
},
title: "rapidFm",
client: {
rootComponent: import Layout from "@src/Layout.jsx",
},
auth: {
userEntity: User,
methods: {
usernameAndPassword: {}
},
onAuthFailedRedirectTo: "/login",
onAuthSucceededRedirectTo: "/"
},
}
entity User {
email: String
password: String
stationRole: String
djs: [Dj] // Correct syntax for array of related entities
}
entity Station {
name: String
url: String
shows: [Show]
djs: [Dj]
}
entity Show {
title: String
time: String
duration: Int
stationId: Int
station: Station @relation(fields: [stationId], references: [id]) // Correct relation syntax
}
entity Dj {
alias: String
userId: Int
user: User @relation(fields: [userId], references: [id]) // Correct relation syntax
stationId: Int
station: Station @relation(fields: [stationId], references: [id]) // Correct relation syntax
}
route LoginRoute { path: "/login", to: LoginPage }
page LoginPage {
component: import Login from "@src/pages/auth/Login.jsx"
}
route SignupRoute { path: "/signup", to: SignupPage }
page SignupPage {
component: import Signup from "@src/pages/auth/Signup.jsx"
}
action createStation {
fn: import { createStation } from "@src/actions.js",
entities: [Station]
}
action updateStation {
fn: import { updateStation } from "@src/actions.js",
entities: [Station]
}
action deleteStation {
fn: import { deleteStation } from "@src/actions.js",
entities: [Station]
}
action createShow {
fn: import { createShow } from "@src/actions.js",
entities: [Show, Station]
}
action updateShow {
fn: import { updateShow } from "@src/actions.js",
entities: [Show]
}
action handleWebSocketConnection {
fn: import { handleWebSocketConnection } from "@src/actions.js",
entities: []
}
query getStations {
fn: import { getStations } from "@src/queries.js",
entities: [Station]
}
query getShows {
fn: import { getShows } from "@src/queries.js",
entities: [Show, Station]
}
query getDjs {
fn: import { getDjs } from "@src/queries.js",
entities: [Dj, Station]
}
route HomeRoute { path: "/", to: HomePage }
page HomePage {
component: import HomePage from "@src/pages/Home.jsx",
authRequired: true
}
route StationRoute { path: "/station/:stationId", to: StationPage }
page StationPage {
component: import Station from "@src/pages/Station.jsx",
authRequired: true
}
route AdminRoute { path: "/admin", to: AdminPage }
page AdminPage {
component: import AdminPage from "@src/pages/Admin.jsx",
authRequired: true
}
6 replies