mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-11-23 19:29:17 +03:00
Updated app to v0.10, added db seeding.
This commit is contained in:
parent
218df5d989
commit
2edebdbcb3
@ -1,20 +1,21 @@
|
||||
app Thoughts {
|
||||
wasp: {
|
||||
version: "^0.9.1"
|
||||
version: "^0.10.0"
|
||||
},
|
||||
title: "Thoughts",
|
||||
db: { system: PostgreSQL },
|
||||
db: {
|
||||
system: PostgreSQL,
|
||||
seeds: [ import { devSeedBasic } from "@server/seeds.js" ]
|
||||
},
|
||||
auth: {
|
||||
userEntity: User,
|
||||
methods: {
|
||||
usernameAndPassword: {}
|
||||
},
|
||||
methods: { usernameAndPassword: {} },
|
||||
onAuthFailedRedirectTo: "/login"
|
||||
},
|
||||
dependencies: [
|
||||
("react-markdown", "6.0.1"),
|
||||
("color-hash", "2.0.1")
|
||||
]
|
||||
],
|
||||
}
|
||||
|
||||
route MainRoute { path: "/", to: MainPage }
|
||||
|
@ -1,17 +1,19 @@
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import LoginForm from '@wasp/auth/forms/Login'
|
||||
import { LoginForm } from '@wasp/auth/forms/Login'
|
||||
import addWaspSourceHeader from './addWaspSourceHeader'
|
||||
|
||||
const LoginPage = (props) => {
|
||||
return (
|
||||
<>
|
||||
<LoginForm/>
|
||||
<br/>
|
||||
<span>
|
||||
I don't have an account yet (<Link to="/signup">go to signup</Link>).
|
||||
</span>
|
||||
<div style={{maxWidth: "400px", margin: "0 auto"}}>
|
||||
<LoginForm/>
|
||||
<br/>
|
||||
<span>
|
||||
I don't have an account yet (<Link to="/signup">go to signup</Link>).
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
@ -1,17 +1,19 @@
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import SignupForm from '@wasp/auth/forms/Signup'
|
||||
import { SignupForm } from '@wasp/auth/forms/Signup'
|
||||
import addWaspSourceHeader from './addWaspSourceHeader'
|
||||
|
||||
const SignupPage = (props) => {
|
||||
return (
|
||||
<>
|
||||
<SignupForm/>
|
||||
<br/>
|
||||
<span>
|
||||
I already have an account (<Link to="/login">go to login</Link>).
|
||||
</span>
|
||||
<div style={{maxWidth: "400px", margin: "0 auto"}}>
|
||||
<SignupForm/>
|
||||
<br/>
|
||||
<span>
|
||||
I already have an account (<Link to="/login">go to login</Link>).
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
18
examples/thoughts/src/server/seeds.js
Normal file
18
examples/thoughts/src/server/seeds.js
Normal file
@ -0,0 +1,18 @@
|
||||
import { createThought } from './actions.js'
|
||||
|
||||
export const devSeedBasic = async (prismaClient) => {
|
||||
const user = await createUser(prismaClient, {
|
||||
username: "RiuTheDog",
|
||||
password: "bark1234"
|
||||
})
|
||||
|
||||
await createThought(
|
||||
{ tagNames: ["animals.cats"], textMarkdown: "## My favorite cats\n - Kira\n - Garfield" },
|
||||
{ user, entities: { Thought: prismaClient.thought } }
|
||||
)
|
||||
}
|
||||
|
||||
async function createUser (prismaClient, data) {
|
||||
const { password, ...newUser } = await prismaClient.user.create({ data })
|
||||
return newUser
|
||||
}
|
Loading…
Reference in New Issue
Block a user