Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
f95482e
profile model - post and get and tests
Oct 7, 2016
9bc0529
remove package.json
Oct 7, 2016
2135285
profile route : test GET and POST hast invalid token error
Oct 7, 2016
adcad23
no body post auth route test
piper88 Oct 7, 2016
698fbfe
create clean-up-mock-module to modularize tests
piper88 Oct 7, 2016
02f8032
removed comments
piper88 Oct 7, 2016
af1369a
Working profile router and tests
adamstelle Oct 7, 2016
e6d320f
Merge two branches
adamstelle Oct 7, 2016
b5fb026
Merged Sarahs auth route tests
adamstelle Oct 8, 2016
a109682
added lint script to travs
adamstelle Oct 8, 2016
cae8d84
required test env in all test files
adamstelle Oct 8, 2016
9d469f2
Merge pull request #16 from adamstelle/profile-route-test-fix
adamstelle Oct 8, 2016
5e2a4a9
add routes.md file and added routes, but needs to be review by team :)
Oct 8, 2016
91d545a
add routes.md file and added routes, but needs to be review by team :)
Oct 8, 2016
55215e4
Merge pull request #17 from adamstelle/profile-route-test
adamstelle Oct 8, 2016
aca790c
add 409 test for auth-route
piper88 Oct 8, 2016
f3d2f3f
add more auth-route tests for 409 and more 400 errors
piper88 Oct 8, 2016
5e8979b
add bedroom model and scaffolding for bedroom-router and bedroom-rout…
piper88 Oct 8, 2016
00e54db
Merge pull request #18 from adamstelle/finish-auth-tests-sarah
adamstelle Oct 9, 2016
84fc506
Merge branch 'staging' of https://github.com/adamstelle/abba into bed…
piper88 Oct 9, 2016
26b1db1
slight rafactor & fix of auth test
adamstelle Oct 9, 2016
97e1916
Merge pull request #19 from adamstelle/small-refactor-adam
loganlsr Oct 9, 2016
2900bf8
Merge branch 'staging' of https://github.com/adamstelle/abba into bed…
piper88 Oct 9, 2016
e6a73cf
still working on residence tests, residence mock made
loganlsr Oct 9, 2016
dfdecdb
Merge pull request #20 from adamstelle/residence-test-logan
piper88 Oct 9, 2016
145f9f7
Merge branch 'staging' of https://github.com/adamstelle/abba into bed…
piper88 Oct 9, 2016
1008d0f
post tests for bedroom route
piper88 Oct 9, 2016
3c1230a
scaffolding for bedroom router
piper88 Oct 9, 2016
0271e2b
residence model written, residence POST tests written, working on GET…
loganlsr Oct 10, 2016
bf4d37f
Merge pull request #21 from adamstelle/bedroom-tests
loganlsr Oct 10, 2016
ae36942
Merge pull request #22 from adamstelle/residence-test-logan
adamstelle Oct 10, 2016
1a5745c
GET and DELETE tests written for residence, residence model updated
loganlsr Oct 10, 2016
0ae49e3
photo middleware in progress
adamstelle Oct 10, 2016
9db8a7b
profile-route-testing -in progress
Oct 10, 2016
13c7a7e
working on photo route test - adam profile/photo route
Oct 10, 2016
7e41b8a
Tests finished for Residence-tests
loganlsr Oct 10, 2016
8bea196
profile route testing: PUT and GET finished
Oct 10, 2016
feaa359
Tests finished for Residence-tests forgot to comment out code
loganlsr Oct 10, 2016
e5910aa
Profile route tests PUT,POSH and GEt tests
Oct 10, 2016
d1247a9
Merge pull request #24 from adamstelle/residence-test-logan
piper88 Oct 10, 2016
5fc94d7
get and post residenceRouter
piper88 Oct 10, 2016
285a70b
photo tests working
adamstelle Oct 10, 2016
2b73985
merge profile router conflicts
adamstelle Oct 10, 2016
9dacc77
Passing POST /photo test
adamstelle Oct 10, 2016
11bb13b
added DEL module to package.json
adamstelle Oct 10, 2016
f352c5e
add AWS-SDK npm module
adamstelle Oct 10, 2016
693126d
Merge pull request #26 from adamstelle/photo-middleware-adam
Raziyehbazargan Oct 10, 2016
c38d07f
Bedroom-route-test: in progress but Working
Oct 11, 2016
03db0aa
10 tests passing
piper88 Oct 11, 2016
6b14706
12 tests passing
piper88 Oct 11, 2016
69ebb5b
13 tests passing
piper88 Oct 11, 2016
1b0242e
14 tests passing
piper88 Oct 11, 2016
211fcb8
15 tests passing
piper88 Oct 11, 2016
30b4bcb
17 tests passing
piper88 Oct 11, 2016
f8ca0d2
17 residence router tests passing, delete tests not working
piper88 Oct 11, 2016
7844d2a
Bedroom-route-test: in progress but Working
Oct 11, 2016
7667f07
Delete photo test in hitting mongoose duplicate key error
adamstelle Oct 11, 2016
aaa97ea
Merged Sarah branch: residence router 50% tests working
adamstelle Oct 11, 2016
4fc704e
Merge razi branch - 25% bedroom tests
adamstelle Oct 11, 2016
f26558f
Merged all branches
adamstelle Oct 11, 2016
aa2276e
Fixed all failing residence / profile tests, slight refactor
adamstelle Oct 11, 2016
9b1da2e
Refactor photo tests; all working
adamstelle Oct 11, 2016
c4b6628
Working bedroom Mock and Router. First test passing
adamstelle Oct 11, 2016
1836aaf
small bug fixes
adamstelle Oct 11, 2016
b170fe3
Merge pull request #29 from adamstelle/test-refactor-adam
piper88 Oct 11, 2016
d7139af
fixed delete tests for residence-router 46 tests passing
piper88 Oct 11, 2016
b3f4b81
Merge pull request #30 from adamstelle/residence-delete-sarah-logan
loganlsr Oct 11, 2016
42bfccd
add estimate model
piper88 Oct 11, 2016
826a572
Merge pull request #31 from adamstelle/estimate-model
loganlsr Oct 11, 2016
c1cc841
Merged residence router tests from staging
adamstelle Oct 11, 2016
833a6cc
adds estimate-mock
piper88 Oct 11, 2016
9f4ab5c
Merge pull request #32 from adamstelle/estimate-mock
loganlsr Oct 11, 2016
ea5f2c8
bedroom-route-tests: POST is almost finished
Oct 11, 2016
7c4d8c8
bedroom-route-tests: POS and GET almost finished
Oct 11, 2016
2748ece
bedroom-route-tests: POS and GET almost finished
Oct 11, 2016
7bd7919
estimate tests finished, updated router, updated Standups.md
loganlsr Oct 11, 2016
8db4ed6
Merge pull request #33 from adamstelle/bedroom-route-test
adamstelle Oct 11, 2016
b637e17
Merge pull request #34 from adamstelle/estimate-router
adamstelle Oct 11, 2016
a778590
Photo routes 75% done
adamstelle Oct 11, 2016
3bfaea4
working on delete route for bedroom
Oct 11, 2016
83e679a
Merge branch 'staging' of https://github.com/adamstelle/abba into bed…
Oct 11, 2016
71b09f4
fixed profile failing profile test
loganlsr Oct 11, 2016
74852bd
Merge pull request #35 from adamstelle/fixing-tests
piper88 Oct 11, 2016
8f7cf9c
bedroom: add function in residence (parent model) for removing the be…
Oct 11, 2016
ba33480
bedtoom-route-tests: POST,GET and DELETE + tests
Oct 11, 2016
3710f01
bedroom-route-test : add PUT route and tests
Oct 12, 2016
5de562c
Merge pull request #36 from adamstelle/bedroom-route-test
loganlsr Oct 12, 2016
02128ae
Debugging photo
adamstelle Oct 12, 2016
297359f
add test for adding bedroom_id in residence.bedrooms array
Oct 12, 2016
a6867c4
photo routes 100% done. test 50% done
adamstelle Oct 12, 2016
c890337
Merge branch 'staging' of https://github.com/adamstelle/abba into pho…
adamstelle Oct 12, 2016
7fc3b19
Merge pull request #37 from adamstelle/photo-router-deletes-adam
piper88 Oct 12, 2016
7504c9b
add test for adding bedroom_id in residence.bedrooms array
Oct 12, 2016
35332c1
setup coverage and coveralls
adamstelle Oct 12, 2016
6c94473
add test for unauthorized and standup file
Oct 12, 2016
b623a7e
Merge branch 'bedroom-route-test' of https://github.com/adamstelle/ab…
adamstelle Oct 12, 2016
079bac7
Updated residence and profile tests
adamstelle Oct 12, 2016
e57a773
working on remove residence with dependencies and bedroom with depen…
Oct 12, 2016
a79fb3e
Refactored and added all bedroom route tests
adamstelle Oct 12, 2016
aae48a5
Refactored estimate tests
adamstelle Oct 12, 2016
8a7f5b5
Merge pull request #40 from adamstelle/test-refactoring-adam
piper88 Oct 12, 2016
159fc6c
remove residence and bedroom with all dependencies + tests
Oct 12, 2016
ecf926e
remove residence and bedroom with all dependencies + tests
Oct 12, 2016
8fcb9f0
merged recursive deletion branch and resolve 5 failing tests
adamstelle Oct 13, 2016
62b6cb9
Merge pull request #42 from adamstelle/test-refactoring-adam
Raziyehbazargan Oct 13, 2016
30e9752
Finished photo tests
adamstelle Oct 13, 2016
a82d0b8
Added tests to increase coverage for photos
adamstelle Oct 13, 2016
bee0d4f
Further coverage refactoring
adamstelle Oct 13, 2016
408491f
Coverage refactoring on photo middleware
adamstelle Oct 13, 2016
5b06d94
Coverage refactoring on photo middleware
adamstelle Oct 13, 2016
7d4612c
Merge pull request #43 from adamstelle/coverage-refactor
adamstelle Oct 13, 2016
180a26b
adds code of conduct markdown and blank contributing markdown
piper88 Oct 13, 2016
16ffe5e
Merge pull request #44 from adamstelle/documentation
piper88 Oct 13, 2016
eae982e
updates to README and CONTRIBUTING markdown files
loganlsr Oct 13, 2016
8bdab89
removing bedroom photo from AWS and change delete test
Oct 13, 2016
90d34de
fixed readme
loganlsr Oct 13, 2016
de0e706
Merge pull request #45 from adamstelle/documentation-logan
loganlsr Oct 13, 2016
60e322a
add bedroom remove AWS - install nyan for mocha
Oct 13, 2016
b33cef4
Merge pull request #46 from adamstelle/bedroom-route-test-AWS
loganlsr Oct 13, 2016
5f92472
Readme v2
adamstelle Oct 13, 2016
58e2e91
readme done
adamstelle Oct 13, 2016
293129f
readme done
adamstelle Oct 13, 2016
0405e03
Merge pull request #48 from adamstelle/coverage-refactor
loganlsr Oct 14, 2016
d8ad601
testing travis
piper88 Oct 24, 2016
58ee18f
testing travis build
piper88 Oct 24, 2016
903d4a7
Merge pull request #50 from adamstelle/testing-travis
piper88 Oct 24, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
service_name: travis-ci
repo_token: MACdJgxPruysr5F3qYQTHCKXsctMUziEj
6 changes: 0 additions & 6 deletions .envtest

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ db
logs
*.log
npm-debug.log*
coverage
html-report

# Runtime data
pids
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ env:
- CXX=g++-4.8
sudo: required
before_script: npm i
after_success: npm run coveralls
script:
- npm test
- npm run lint
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [atom@github.com](mailto:atom@github.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Guidline to Contributing

##Code of Conduct

This project adheres to the Contributor Covenant [code of conduct](https://github.com/atom/atom/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to Adam @ [https://github.com/adamstelle](https://github.com/adamstelle).

## Issues

###When submitting an issue for a bug, please adhere to the following guidelines:

- Use a clear and descriptive title for the issue.
- Describe the steps you took when encountering the bug and whether you are able to reproduce the bug.
- Please include screenshots showing the steps you take to reproduce the bug.

## Contacting Admins

###If there are any questions, comments or concerns, please message us at the following:

- [https://github.com/adamstelle](https://github.com/adamstelle)
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
[![Coverage Status](https://coveralls.io/repos/github/adamstelle/abba/badge.svg?branch=staging)](https://coveralls.io/github/adamstelle/abba?branch=staging)

# Abba
An app to predict short-term rental income for homeowners and renters.
Abba is a simple REST API helps homeowners or prospective owners predict potential AirBnB rental income for one or more spare bedrooms.

## Description
Abba is a a RESTful API that uses full CRUD operations to allow clients to perform a http requests on a variety of routes. *For more route information check out the* **[wiki](https://github.com/adamstelle/abba/wiki)**.

### Why this should exist
With home prices constantly on the rise, home ownership is a huge financial burden on most first-time homeowners. Even for people making good wages, the prospect of adding huge monthly mortgage payments to the all-too-common student loan or consumer debt is daunting. However, the rise of short-term rental sites like AirBnB now allow for homeowners to rent out one or more spare bedrooms and use the income to lessen their debt burden. The problem is that, until now, the income potential for AirBnBing small bedrooms has been hard to quantify.

## Project description
Created to fulfill the backend project requirement for 401 Full-Stack JavaScript.
That's why we created this tool: using historical data we can predict the monthly rental income potential for homeowners or prospective buyers based on a given address and some basic facts about the property.

### Instructions
To run, fork & clone into a local repository and run 'npm install'. Run 'npm start' to start the server (with nodemon and debug on by default), and 'npm test' to run tests with mocha.
1. Fork & clone into a local repository
2. Run 'npm install'
3. Run 'npm start' to start the server (with nodemon and debug on by default)
4. To test, 'npm test' - uses [Mocha](https://github.com/mochajs/mocha) and [Chai](https://github.com/chaijs/chai) for testing, [Istanbul](https://github.com/gotwarlost/istanbul) and [Coveralls.io](https://coveralls.io/) for code coverage..

### Team Members

Logan
Adam
Raziyeh
Sarah
[Logan](https://github.com/loganlsr),
[Adam](https://github.com/adamstelle),
[Raziyeh](https://github.com/Raziyehbazargan),
and [Sarah](https://github.com/prungy88).

This project was created as part of a [Codefellows](codefellows.com) 401 Javascript course. Special thanks to our awesome instructors.

*License: [MIT](https://opensource.org/licenses/MIT)*.
33 changes: 33 additions & 0 deletions lib/aws-mocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';

const AWSMock = require('aws-sdk-mock');

module.exports = exports = {};

// Example response data from AWS
exports.uploadMock = {
ETag: '"075c4d4656b2ef6c04145ae560c73e5a"',
Location: 'https://cf401demo.s3.amazonaws.com/cb2d73360c93555fb407a2108e812bb9',
key: 'cb2d73360c93555fb407a2108e812bb9',
Key: 'cb2d73360c93555fb407a2108e812bb9',
Bucket: 'cf401demo',
};

AWSMock.mock('S3', 'upload', function(params, callback){
if(params.ACL !== 'public-read') return callback(new Error('ACL must be "public-read"'));
if(params.Bucket !== 'cf401demo') return callback(new Error('Bucket must be "cf401demo"'));
if(!params.Key) return callback(new Error('requires Key'));
if(!params.Body) return callback(new Error('requires body'));
callback(null, exports.uploadMock);
});

exports.deleteMock = {
DeleteMarker: true,
Bucket: 'cf401demo',
};

AWSMock.mock('S3', 'deleteObject', function(params, callback){
if(params.Bucket !== 'cf401demo') return callback(new Error('Bucket must be "cf401demo"'));
if(!params.Key) return callback(new Error('requires Key'));
callback(null, exports.uploadMock);
});
8 changes: 6 additions & 2 deletions lib/bearer-auth-middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ module.exports = function(req, res, next){
debug();
let authHeader = req.headers.authorization;
if (!authHeader) return next(createError(401, 'requires auth header'));
let token = authHeader.split('Bearer')[1];
if (authHeader.split(' ')[0] !== 'Bearer') return next(createError(400, 'bad header (not bearer auth)'));
let token = authHeader.split('Bearer ')[1];
if (!token) return next(createError(401, 'requires token'));
jwt.verify(token, process.env.APP_SECRET, (err, decoded) => {
if(err) return next(err); // 500 error
if (err) {
if (err.name === 'JsonWebTokenError') return next(createError(401, 'Bad permissions'));
else return next(err); // 500 error
}
User.findOne({findHash: decoded.token})
.then( user => {
req.user = user;
Expand Down
20 changes: 18 additions & 2 deletions lib/error-middleware.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict';

const createError = require('http-errors');

const debug = require('debug')('abba:error-middleware');

module.exports = function(err, req, res, next){
debug('error middleware');
console.error(err.message);
console.error('name', err.name);
console.error('err message is ', err.message);

if (err.status){
res.status(err.status).send(err.name);
Expand All @@ -20,6 +20,22 @@ module.exports = function(err, req, res, next){
next();
return;
}

if (err.message === 'Unexpected field'){
err = createError(400, err.message);
res.status(err.status).send(err.name);
next();
return;
}

if (err.name === 'MongoError' && err.message.startsWith('E11000 duplicate')){
// 409 means conflict im using it for duplicate errors
err = createError(409, err.message);
res.status(err.status).send(err.name);
next();
return;
}

err = createError(500, err.message);
res.status(err.status).send(err.name);
next();
Expand Down
131 changes: 131 additions & 0 deletions lib/photo-aws-middleware.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
'use strict';

const fs = require('fs');
const path = require('path');

const del = require('del');
const AWS = require('aws-sdk');
const createError = require('http-errors');
const debug = require('debug')('abba:photo-aws-middleware');

const Photo = require('../model/photo.js');
const dataDir = `${__dirname}/../data`;
const Profile = require('../model/profile.js');
const Bedroom = require('../model/bedroom.js');
const s3UploadPromise = require('../lib/promisify-upload.js');

// module config
AWS.config.setPromisesDependency(require('bluebird'));

// module constants
const s3 = new AWS.S3();

module.exports = exports = {};

exports.profilePhotoUpload = function(req, res, next){
debug('profilePhotoUpload helper');
if(!req.file) return next(createError(400, 'no file found'));
if(!req.file.path) return next(createError(500, 'no file was saved'));
let ext = path.extname(req.file.originalname);
let params = {
ACL: 'public-read',
Bucket: 'cf401demo',
Key: `${req.file.filename}${ext}`,
Body: fs.createReadStream(req.file.path),
};
let s3data;
Profile.findById(req.params.profID)
.catch(err => Promise.reject(createError(404, err.message)))
.then(() => s3UploadPromise(params))
.catch(err => Promise.reject(createError(500, err)))
.then(data => {
s3data = data;
return del([`${dataDir}/*`]);
})
.then(() => {
let photoData = {
name: req.body.name,
caption: req.body.caption,
objectKey: s3data.Key,
imageURI: s3data.Location,
userID: req.user._id,
};
return new Photo(photoData).save();
})
.then(photo => {
res.photo = photo;
next();
})
.catch(err => {
return err.status ? next(err) : next(createError(500, err.message));
});
};

exports.photoDelete = function(req, res, next){
debug('profilephotoDelete helper');
Photo.findById(req.params.id)
.then(photo => {
req.photo = photo;
if(photo.userID.toString() !== req.user._id.toString())
return next(createError(401, 'User not permitted to delete this photo.'));
let params = {
Bucket: 'cf401demo',
Key: photo.objectKey,
};
return s3.deleteObject(params).promise();
})
.then(() => {
Photo.findById(req.photo._id).remove();
})
.then(() => next())
.catch(err => {
return err.status ? next(err) : next(createError(500, err.message));
});
};

exports.bedroomPhotoUpload = function(req, res, next){
debug('bedroomPhotoUpload helper');

if(!req.files) return next(createError(400, 'no file found'));
if(!req.files[0].path) return next(createError(500, 'no file was saved'));
let numFiles = req.files.length;
let i = 0;
let photoDataArray = [];
function uploadFiles() {
let ext = path.extname(req.files[i].originalname);
let params = {
ACL: 'public-read',
Bucket: 'cf401demo',
Key: `${req.files[i].filename}${ext}`,
Body: fs.createReadStream(req.files[i].path),
};
let s3data;
Bedroom.findById(req.params.bedroomID)
.catch(err => next(createError(404, err.message)))
.then(() => s3UploadPromise(params))
.catch(err => Promise.reject(createError(500, err)))
.then(data => {
s3data = data;
let photoData = {
name: req.body.name,
caption: req.body.caption,
objectKey: s3data.Key,
imageURI: s3data.Location,
userID: req.user._id,
};
new Photo(photoData).save()
.then(photo => {
photoDataArray.push(photo);
i++;
if (i < numFiles) return uploadFiles();
req.photos = photoDataArray;
return del([`${dataDir}/*`])
.then(next());
});
})
.catch(err => {
return err.status ? next(err) : next(createError(500, err.message));
});
}
uploadFiles();
};
13 changes: 13 additions & 0 deletions lib/promisify-upload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

const AWS = require('aws-sdk');
const s3 = new AWS.S3();

module.exports = function s3UploadPromise(params) {
return new Promise((resolve, reject) => {
s3.upload(params, (err, s3data) => {
if (err) return reject(err);
resolve(s3data);
});
});
};
Empty file removed model/address.js
Empty file.
Loading