feat: Record search queries (#1554)

* Record search queries

* feat: add totalCount to the search response

* feat: add comments to explain why we use setTimeout
This commit is contained in:
Renan Filipe
2020-09-22 03:05:42 -03:00
committed by GitHub
parent 0fa8a6ed2e
commit 98626ebbaf
9 changed files with 330 additions and 54 deletions

View File

@@ -0,0 +1,43 @@
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable("search_queries", {
id: {
allowNull: false,
primaryKey: true,
type: Sequelize.UUID,
},
userId: {
type: Sequelize.UUID,
references: {
model: "users",
},
},
teamId: {
type: Sequelize.UUID,
references: {
model: "teams",
},
},
source: {
type: Sequelize.ENUM("slack", "app"),
allowNull: false,
},
query: {
type: Sequelize.STRING,
allowNull: false,
},
results: {
type: Sequelize.INTEGER,
allowNull: false,
},
createdAt: {
allowNull: false,
type: Sequelize.DATE,
},
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable("search_queries");
},
};