-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(documentation): fix merge conflict
[Finishes #167891569]
- Loading branch information
Showing
14 changed files
with
270 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Set the default behavior, in case people don't have core.autocrlf set. | ||
* text=auto | ||
* text eol=lf | ||
|
||
# Explicitly declare text files you want to always be normalized and converted | ||
# to native line endings on checkout. e.g *.c text, *.h text | ||
|
||
# Declare files that will always have CRLF line endings on checkout. | ||
*.sln text eol=lf | ||
|
||
# Denote all files that are truly binary and should not be modified. | ||
*.png binary | ||
*.jpg binary |
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 |
---|---|---|
|
@@ -95,6 +95,7 @@ typings/ | |
|
||
# End of https://www.gitignore.io/api/node | ||
|
||
application port | ||
notes.md | ||
package-lock.json | ||
.editorconfig |
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,10 @@ | ||
require('@babel/register') | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
'config': path.resolve('./src/database/config', 'config.js'), | ||
'models-path': path.resolve('./src/database/models'), | ||
'seeders-path': path.resolve('./src/database/seeders'), | ||
'migrations-path': path.resolve('./src/database/migrations') | ||
} | ||
|
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 was deleted.
Oops, something went wrong.
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,35 @@ | ||
import dotenv from 'dotenv'; | ||
|
||
dotenv.config(); | ||
|
||
const { DB_DEV_NAME, DB_USER_NAME, DB_PASSWORD } = process.env; | ||
|
||
const dialect = 'postgres'; | ||
|
||
module.exports = { | ||
development: { | ||
username: DB_USER_NAME, | ||
password: DB_PASSWORD, | ||
database: DB_DEV_NAME, | ||
host: '127.0.0.1', | ||
port: process.env.DB_PORT, | ||
dialect | ||
}, | ||
test: { | ||
username: DB_USER_NAME, | ||
password: DB_PASSWORD, | ||
database: process.env.DB_TEST_NAME, | ||
host: process.env.DB_HOST, | ||
port: process.env.DB_PORT, | ||
dialect | ||
}, | ||
production: { | ||
username: process.env.PRODUCTION_USERNAME, | ||
password: process.env.PRODUCTION_PASSWORD, | ||
database: process.env.PRODUCTION_DATABASE, | ||
host: process.env.PRODUCTION_HOST, | ||
port: process.env.PRODUCTION_PORT, | ||
dialect, | ||
ssl: true | ||
} | ||
}; |
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,39 @@ | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => queryInterface.createTable('Users', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
first_name: { | ||
type: Sequelize.STRING | ||
}, | ||
last_name: { | ||
type: Sequelize.STRING | ||
}, | ||
email: { | ||
type: Sequelize.STRING | ||
}, | ||
password: { | ||
type: Sequelize.STRING | ||
}, | ||
role: { | ||
type: Sequelize.STRING | ||
}, | ||
gender: { | ||
type: Sequelize.STRING | ||
}, | ||
createdAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
defaultValue: Sequelize.fn('now') | ||
}, | ||
updatedAt: { | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
defaultValue: Sequelize.fn('now') | ||
} | ||
}), | ||
down: queryInterface => queryInterface.dropTable('Users') | ||
}; |
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,40 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import Sequelize from 'sequelize'; | ||
import configSetup from '../config/config'; | ||
|
||
const basename = path.basename(__filename); | ||
const env = process.env.NODE_ENV || 'development'; | ||
const config = configSetup[env]; | ||
const db = {}; | ||
|
||
let sequelize; | ||
if (config.use_env_variable) { | ||
sequelize = new Sequelize(process.env[config.use_env_variable], config); | ||
} else { | ||
sequelize = new Sequelize( | ||
config.database, | ||
config.username, | ||
config.password, | ||
config | ||
); | ||
} | ||
|
||
fs.readdirSync(__dirname) | ||
.filter(file => (file | ||
.indexOf('.') !== 0 && file !== basename && file.slice(-3) === '.js')) | ||
.forEach((file) => { | ||
const model = sequelize.import(path.join(__dirname, file)); | ||
db[model.name] = model; | ||
}); | ||
|
||
Object.keys(db).forEach((modelName) => { | ||
if (db[modelName].associate) { | ||
db[modelName].associate(db); | ||
} | ||
}); | ||
|
||
db.sequelize = sequelize; | ||
db.Sequelize = Sequelize; | ||
|
||
export default db; |
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,18 @@ | ||
module.exports = (sequelize, DataTypes) => { | ||
const Users = sequelize.define( | ||
'Users', | ||
{ | ||
first_name: DataTypes.STRING, | ||
last_name: DataTypes.STRING, | ||
email: DataTypes.STRING, | ||
password: DataTypes.STRING, | ||
role: DataTypes.STRING, | ||
gender: DataTypes.STRING | ||
}, | ||
{} | ||
); | ||
Users.associate = () => { | ||
// associations can be defined here | ||
}; | ||
return Users; | ||
}; |
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,52 @@ | ||
module.exports = { | ||
up: queryInterface => queryInterface.bulkInsert('Users', [ | ||
{ | ||
first_name: 'Femi', | ||
last_name: 'Tijani', | ||
email: 'tjhakeemus@gmail.com', | ||
password: '12345678', | ||
role: 'Software Engineer', | ||
gender: 'male' | ||
}, | ||
{ | ||
first_name: 'Desmond', | ||
last_name: 'Edem', | ||
email: 'kukiito@gmail.com', | ||
password: '12345678', | ||
role: 'Software Engineer', | ||
gender: 'male' | ||
}, | ||
{ | ||
first_name: 'Maxwell', | ||
last_name: 'Eke', | ||
email: 'muximusekeh@gmail.com', | ||
password: '12345678', | ||
role: 'Software Engineer', | ||
gender: 'male' | ||
}, | ||
{ | ||
first_name: 'Muheed', | ||
last_name: 'Olakunle', | ||
email: 'olakunlemuheeb@gmail.com', | ||
password: '12345678', | ||
role: 'Software Engineer', | ||
gender: 'male' | ||
}, | ||
{ | ||
first_name: 'Peter', | ||
last_name: 'Tyonum', | ||
email: 'kukiito@gmail.com', | ||
password: '12345678', | ||
role: 'Software Engineer', | ||
gender: 'male' | ||
}, | ||
{ | ||
first_name: 'Babatunde', | ||
last_name: 'Ogedengbe', | ||
email: 'kukiito@gmail.com', | ||
password: '12345678', | ||
role: 'Software Engineer', | ||
gender: 'male' | ||
} | ||
]) | ||
}; |
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 was deleted.
Oops, something went wrong.
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,48 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "Barefoot Nomad API", | ||
"description": "Barefoot Nomad makes company global travel and accommodation easy and convenient for the strong workforce of savvy members of staff, by leveraging the modern web.", | ||
"contact": { | ||
"email": "team-banshee@barefoot-nomad.com" | ||
}, | ||
"version": "1.0.0" | ||
}, | ||
"externalDocs": { | ||
"description": "The Github Repository", | ||
"url": "https://github.com/andela/banshee-bn-backend" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "/api/v1" | ||
}, | ||
{ | ||
"url": "/" | ||
} | ||
], | ||
"tags": [ | ||
{ | ||
"name": "Welcome", | ||
"description": "The root endpoint" | ||
}, | ||
{ | ||
"name": "Users", | ||
"description": "Operations related to Users authentication" | ||
} | ||
], | ||
"paths": { | ||
"/": { | ||
"get": { | ||
"tags": [ | ||
"Welcome" | ||
], | ||
"summary": "The root endpoint", | ||
"responses": { | ||
"200": { | ||
"description": "Success" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |