-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
begin writing routes/handlers for posting a sequence
ref #10
- Loading branch information
1 parent
038416b
commit a80cb55
Showing
10 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
'use strict'; | ||
|
||
const connection = require('./knexfile')[process.env.NODE_ENV || 'development'] | ||
module.exports = require('knex')(connection); |
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
exports.insertImages = (sequenceId, userId sequences) => { | ||
const sequence = sequences[sequenceId]; | ||
|
||
Promise.map(sequence, image => { | ||
return Object | ||
.values(image) | ||
.concat([sequenceId, userId]) | ||
.join(','); | ||
}) | ||
.then((values) => `the insert`) | ||
.catch((error) => { throw error }); | ||
|
||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
|
||
const Boom = require('boom'); | ||
const db = require('../../connection'); | ||
const uuidv4 = require('uuid/v4'); | ||
|
||
module.exports = async (r, h) => { | ||
try { | ||
} catch (error) { | ||
return Boom.badImplementation(error.message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = [ | ||
require('./sequence').post | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
post: require('./post') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
const sequencesSchema = require('../../schema/sequences.js'); | ||
|
||
module.exports = { | ||
method: 'POST', | ||
path: '/sequence', | ||
config: { | ||
handler: require('../../handlers/sequence').get, | ||
validate: { | ||
payload: sequencesSchema, | ||
failAction: async (r, h, err) => err | ||
} | ||
} | ||
} |