Skip to content

Commit

Permalink
mejorads
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorJJF committed Jan 3, 2021
1 parent ae9518d commit 96b91fd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion helpers/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function renameKey(object, key, newKey) {
*/
const listInitOptions = async (req) =>
new Promise((resolve) => {
const order = parseInt(req.query.order, 10) || 1;
const order = req.query.order || 'asc';
const sort = req.query.sort || 'createdAt';
const sortBy = buildSort(sort, order);
const page = parseInt(req.query.page, 10) || 1;
Expand Down
8 changes: 4 additions & 4 deletions models/Brands.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const brandSchema = new Schema(
required: [true, 'El nombre de la marca es requerido'],
},
description: String,
status: {
type: Boolean,
default: true,
},
userId: {
type: Schema.Types.ObjectId,
ref: 'Users',
},
status: {
type: Boolean,
default: true,
},
},
{
versionKey: false,
Expand Down
34 changes: 26 additions & 8 deletions seeder/1.Users.seeder.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,32 @@ const json = [];

// Data
// for (let i = 0; i < 2; i++) {
json.push({
role: 'ADMIN',
status: true,
first_name: 'Victor Juan',
last_name: 'Jimenez Flores',
password: '$2b$05$ESBSlw8CwQMv.gcns.dDUuuV7TLsoLyZkoKg6R5VmwAPP7kF3ryH.',
email: '[email protected]',
});
json.push(
{
role: 'SUPERADMIN',
status: true,
first_name: 'Victor Juan',
last_name: 'Jimenez Flores',
password: '$2b$05$ESBSlw8CwQMv.gcns.dDUuuV7TLsoLyZkoKg6R5VmwAPP7kF3ryH.',
email: '[email protected]',
},
{
role: 'ADMIN',
status: true,
first_name: 'Victor Juan',
last_name: 'Jimenez Flores',
password: '$2b$05$ESBSlw8CwQMv.gcns.dDUuuV7TLsoLyZkoKg6R5VmwAPP7kF3ryH.',
email: '[email protected]',
},
{
role: 'ADMIN',
status: true,
first_name: 'Victor Juan',
last_name: 'Jimenez Flores',
password: '$2b$05$ESBSlw8CwQMv.gcns.dDUuuV7TLsoLyZkoKg6R5VmwAPP7kF3ryH.',
email: '[email protected]',
},
);
// }
// END DATA

Expand Down
2 changes: 1 addition & 1 deletion seeder/3.Brands.seeder.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = new Promise(async (resolve) => {
const User = require('../models/Users');
const users = await User.find();
// GET DATA
for (let i = 0; i < 21; i++) {
for (let i = 0; i < 4200; i++) {
json.push({
name: faker.company.companyName(),
createdAt: faker.date.past(),
Expand Down

0 comments on commit 96b91fd

Please sign in to comment.