forked from noxious/server
DB updates, removed all CRUD func's from repositories as prisma's func's are sufficient and reduces boilerplate.
This commit is contained in:
@ -11,7 +11,6 @@ import path from 'path'
|
||||
import { TAsset } from './Types'
|
||||
import tileRepository from '../repositories/TileRepository'
|
||||
import objectRepository from '../repositories/ObjectRepository'
|
||||
import spriteRepository from '../repositories/SpriteRepository'
|
||||
|
||||
async function addHttpRoutes(app: Application) {
|
||||
app.get('/assets', async (req: Request, res: Response) => {
|
||||
@ -69,8 +68,7 @@ async function addHttpRoutes(app: Application) {
|
||||
const userService = new UserService()
|
||||
const user = await userService.login(username, password)
|
||||
|
||||
if (user) {
|
||||
//test
|
||||
if (user && typeof user !== 'boolean') {
|
||||
const token = jwt.sign({ id: user.id }, config.JWT_SECRET, { expiresIn: '4h' })
|
||||
return res.status(200).json({ token })
|
||||
}
|
||||
@ -91,8 +89,7 @@ async function addHttpRoutes(app: Application) {
|
||||
const user = await userService.register(username, password)
|
||||
|
||||
if (user) {
|
||||
const token = jwt.sign({ id: user.id }, config.JWT_SECRET, { expiresIn: '4h' })
|
||||
return res.status(200).json({ token })
|
||||
return res.status(200)
|
||||
}
|
||||
|
||||
return res.status(400).json({ message: 'Failed to register user' })
|
||||
|
Reference in New Issue
Block a user