Skip to content
Permalink
Browse files
Merge branch 'master' into fix-adding-game-page-categories
  • Loading branch information
soperd committed Dec 2, 2019
2 parents 3d94ed4 + 5212400 commit 0a3375cffd65f4b02012b1e2b1a51b5e19396f8b
Show file tree
Hide file tree
Showing 12 changed files with 592 additions and 477 deletions.
1 app.js
@@ -74,3 +74,4 @@ app.use(signup.routes())
app.use(home.routes())

module.exports = app

@@ -20,7 +20,7 @@ signup.post('/signup', async ctx => {

const user = await User.createFromPlainText(body.username, body.password)
await ctx.db.createUser(user)//adds new user to database
return ctx.redirect('login')
return ctx.redirect('homepage')
} catch(err) {
return ctx.render('signup.hbs', { errorMsg: err.message})
}
13 db.js
@@ -424,6 +424,17 @@ class SqliteDbContext extends DbContext {

return game
}

async getGameByTitle(title) {
const sqlite = await this.sqlitePromise

const query = 'SELECT `id` FROM `games` WHERE `title` = ?;'
const gameID = await sqlite.get(query, title)
if (!gameID) {
throw new EntityNotFound(`game with title ${title} not found`)
}
return this.getGame(gameID.id)
}
//delete a game by id
async deleteGame(id) {
// this will throw an error if game not found
@@ -865,7 +876,7 @@ class SqliteDbContext extends DbContext {

const reviews = await sqlite.all(query, gameID, 'yes')
return reviews
}
}
//selects a review by id
async getReview(id) {
const sqlite = await this.sqlitePromise

0 comments on commit 0a3375c

Please sign in to comment.