Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
katemat committed Jul 15, 2020
0 parents commit d15cfe8
Show file tree
Hide file tree
Showing 28 changed files with 3,469 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Trashure App, v. 1.0.0
## Team Project

### [Try it now](https://heroku.... need to update)

### Overview

🏘 Are you moving out soon?
🚚 Still have some stuff you love but not able to take with you?
🎫 Have spare tickets fot tonight?
Give it to someone for free! Share your Trashure!

---
### Featutes

* User can see on the map 🌏 any Trashure Items available in nearby area (user-geolocation feature is implemented)
* User can sign up and login
* Registered User can Reserve any available item
* Registered User can Post Items
* Registered User can see a list of Items (posted and reserved)

---

### Technical Requirements

🛠 To build the App the following technologies and tools were used:

- HTML, CSS, JavaScript
- PostgreSQL
- Node.js
- Express
- middleware: pg, bcrypt, passport, express-session, method-overide, ejs
- Heroku for deployment
- version control system: Git
- Whimsical for creating storyboards
- Trello for keeping track of development

---
## Trashure DB - ERD

![ERD](/public/images/TrashureERD.jpg "Trashure ERD")

---

## Challenges and next release Features

One of the main challenges the Team faced with the project is being able to obtain information from a 3d party API, manipulatianig with geodata, storing these data in DB

For Future releases some extra features can be added:

- Search option so User can sort all available in DB items by certain criteria
- Email notifications with details of reservation can be sent to the User who posted the Item and to the User who reserved the Item
- Integrate third party API to improve UX uploading images (e.g. use Cloudinary)

23 changes: 23 additions & 0 deletions models/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const pg = require('pg');

let pool;

if (process.env.PRODUCTION) {
pool = new pg.Pool({
connectionString: process.env.DATABASE_URL,
})
} else {
pool = new pg.Pool({
database: 'trashure',
user: 'debbiepaterson',
password: 'hello'
})
}

module.exports = {
query: (sql, params, callback) => {
return pool.query(sql, params, callback)
}
}


19 changes: 19 additions & 0 deletions models/convert-date.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
convertDate: function convertDate(date) {
var d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();

if (month.length < 2)
month = '0' + month;
if (day.length < 2)
day = '0' + day;

return [year, month, day].join('-');
}
}

// module.exports = {
// convertDate: convertDate
// }
22 changes: 22 additions & 0 deletions models/users.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// substitute records array with the trashure db
// var records = [
// { id: 1, username: 'jack', password: 'secret', displayName: 'Jack', emails: [ { value: '[email protected]' } ] }
// , { id: 2, username: 'jill', password: 'birthday', displayName: 'Jill', emails: [ { value: '[email protected]' } ] }
// ];

const db = require('./config')

module.exports = {
findByUsername: (username, cb) => {
const records = db.query('select * from users;')
process.nextTick(function() {
for (var i = 0, len = records.length; i < len; i++) {
var record = records[i];
if (record.username === username) {
return cb(null, record);
}
}
return cb(null, null);
});
}
}
Loading

0 comments on commit d15cfe8

Please sign in to comment.