GithubHelp home page GithubHelp logo

projetoweb3's Introduction

Instalar as dependências

npm i

Rodar a aplicação

Criar um arquivo .env na raiz do projeto passando

DB_DIALECT=qual o banco que está conectando
DB_NAME=nome do banco
DB_USER=nome do usuario
DB_PASSWORD=senha do usuario
DB_HOST=host do banco
JWT_SECRET="Alguma string aqui"

npm run dev

Gerar as migrations e as models

npx sequelize-cli db:migrate

Criar as tabelas manualmente

Para iniciar o sequelize

User o comando abaixo na raís do projeto

npx sequelize-cli init

npx sequelize-cli model:generate --name Admin --attributes email:string,senha:string

npx sequelize-cli model:generate --name User --attributes nome:string,email:string,senha:string,telefone:string,cpf:string,curriculo:string,role:string

npx sequelize-cli model:generate --name Company --attributes nomeDono:string,razaoSocial:string,nomeFantasia:string,segmento:string,site:string,cnpj:string,telefone:string,email:string

npx sequelize-cli model:generate --name Address --attributes logradouro:string,bairro:string,cidade:string,estado:string,pais:string

npx sequelize-cli model:generate --name Review --attributes avaliação:integer,comentario:integer

npx sequelize-cli model:generate --name Job --attributes titulo:string,descricao:string,salario:double

Criar um usuário ADMIN

npx sequelize migration:create --name add-admin-user

'use strict';
const bcrypt = require('bcrypt');

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    const hashedPassword = await bcrypt.hash('admin', 10)
    await queryInterface.bulkInsert('Admins', [{
      nome: 'Admin',
      email: '[email protected]',
      senha: hashedPassword,
      tipo: 'Admin',
      createdAt: new Date(),
      updatedAt: new Date()
    }], {})
  },
  async down(queryInterface, Sequelize) {
    await queryInterface.bulkDelete('Admins', { email: '[email protected]' }, {});
  }
};

npx sequelize db:migrate

projetoweb3's People

Contributors

thiagojorgelins avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.