Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .env-example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ TIMEZONE=America/Recife
JWT_SECRET=
JWT_EXPIRES_IN=9999999999999s

### EMAIL #################################################
SENDGRID_API_KEY=
EMAIL_FROM=

### GRAPHQL #################################################
GRAPHQL_DEBUG=true

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# MyApi


### Includes

SendGrid library to send emails

> Add your sendgrid key on .env and choose the sendgrip controller

# Testing

## OpenApi
Expand Down
3 changes: 3 additions & 0 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@ module.exports = {
database: process.env.DB_NAME,
host: process.env.DB_HOST,
dialect: 'mysql',
migrationStorageTableName: 'sequelize_meta',
},
test: {
username: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
host: process.env.DB_HOST,
dialect: 'mysql',
migrationStorageTableName: 'sequelize_meta',
},
production: {
username: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
host: process.env.DB_HOST,
dialect: 'mysql',
migrationStorageTableName: 'sequelize_meta',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable('people', {
await queryInterface.createTable('users', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
Expand Down Expand Up @@ -36,6 +36,19 @@ module.exports = {
type: Sequelize.STRING,
allowNull: false,
},
login: {
type: Sequelize.STRING,
unique: true,
allowNull: false,
},
password: {
type: Sequelize.STRING,
allowNull: false,
},
remember_token: {
type: Sequelize.STRING,
allowNull: true,
},
created_at: {
type: Sequelize.DATE,
allowNull: false,
Expand All @@ -48,6 +61,6 @@ module.exports = {
},

down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable('people');
await queryInterface.dropTable('users');
},
};
4 changes: 2 additions & 2 deletions database/migrations/20210422223838-create-schema-addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ module.exports = {
unique: true,
primaryKey: true,
},
person_id: {
user_id: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: 'people',
model: 'users',
key: 'id',
},
onDelete: 'cascade',
Expand Down
4 changes: 2 additions & 2 deletions database/migrations/20210422223847-create-schema-contacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ module.exports = {
unique: true,
primaryKey: true,
},
person_id: {
user_id: {
type: Sequelize.INTEGER,
allowNull: false,
references: {
model: 'people',
model: 'users',
key: 'id',
},
onDelete: 'cascade',
Expand Down
50 changes: 0 additions & 50 deletions database/migrations/20210423124742-create-schema-users.js

This file was deleted.

4 changes: 4 additions & 0 deletions database/migrations/20210423130156-create-schema-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ module.exports = {
type: Sequelize.STRING,
allowNull: false,
},
submenus: {
type: Sequelize.JSON,
allowNull: true,
},
created_at: {
type: Sequelize.DATE,
allowNull: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

module.exports = {
up: async (queryInterface) => {
up: async (queryInterface, Sequelize) => {
const transaction = await queryInterface.sequelize.transaction();
try {
await queryInterface.bulkInsert(
'people',
'users',
[
{
name: 'Admin 1',
Expand All @@ -15,28 +15,39 @@ module.exports = {
gender: 'MALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'admin@admin.com',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
{
id: 2,
name: 'Manager',
cpf: '817.535.687-14',
email: 'manager@manager.com',
birthday: '1942-04-05',
gender: 'MALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'manager@manager.com',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
{
id: 3,
name: 'Manager 2',
cpf: '642.045.143-40',
email: 'manager1@manager.com',
birthday: '1982-11-14',
gender: 'FEMALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'manager1@manager.com',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -48,6 +59,9 @@ module.exports = {
gender: 'FEMALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'betinacamiladacruz_@utbr.com.br',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -59,6 +73,9 @@ module.exports = {
gender: 'MALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'fernandopietronelsonassis-91@atiara.com.br',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -70,6 +87,9 @@ module.exports = {
gender: 'MALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'levilorenzoramos-81@gruposandino.com.br',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -81,6 +101,9 @@ module.exports = {
gender: 'FEMALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'hadass.hadassarebecaalicecortereal@leoshehtman.com.br',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -92,6 +115,9 @@ module.exports = {
gender: 'FEMALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'isabelaadrianacarvalho_@elimco.com',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -103,6 +129,9 @@ module.exports = {
gender: 'FEMALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'jjessicaluziateixeira@reconciliare.com.br',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -114,6 +143,9 @@ module.exports = {
gender: 'MALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'marcosviniciuskaiquegaelfernandes@callan.com.br',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -125,6 +157,9 @@ module.exports = {
gender: 'MALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'jorgemarcosmartins__jorgemarcosmartins@etec.sp.gov.br',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -136,6 +171,9 @@ module.exports = {
gender: 'FEMALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'vitoriabeatrizdanielapires_@lnaa.com.br',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -147,6 +185,9 @@ module.exports = {
gender: 'MALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'eedsonmarcoskaiquelopes@acesse.net',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -159,6 +200,10 @@ module.exports = {
gender: 'MALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login:
'enzojoaquimerickdrumond__enzojoaquimerickdrumond@zipmail.com.br',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
Expand All @@ -170,11 +215,13 @@ module.exports = {
gender: 'MALE',
avatar:
'https://thumbs.dreamstime.com/b/opte-pelo-avatar-placeholder-da-foto-%C3%ADcone-do-perfil-124557887.jpg',
login: 'alexandreosvaldomanuelcarvalho_@tursi.com.br',
password:
'$2b$10$z5V38BrCOClpwf.x7jm2uezhWq3icCS8lR6sKgebDSaEA5.KY6YEq',
created_at: new Date(),
updated_at: new Date(),
},
],

{
transaction,
},
Expand All @@ -187,7 +234,7 @@ module.exports = {
}
},

down: async (queryInterface) => {
await queryInterface.bulkDelete('people', null, {});
down: async (queryInterface, Sequelize) => {
await queryInterface.bulkDelete('users', null, {});
},
};
Loading