Skip to content

Commit

Permalink
search log
Browse files Browse the repository at this point in the history
  • Loading branch information
yukukotani committed Sep 12, 2020
1 parent bec3515 commit 36759c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions isuumo/webapp/mysql/db/0_Schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,12 @@ CREATE TABLE isuumo.chair
popularity INTEGER NOT NULL,
stock INTEGER NOT NULL
);

CREATE TABLE isuumo.estate_search_log
(
id INTEGER NOT NULL,
door_height BOOLEAN NOT NULL,
door_width BOOLEAN NOT NULL,
rent BOOLEAN NOT NULL,
features BOOLEAN NOT NULL
);
6 changes: 6 additions & 0 deletions isuumo/webapp/nodejs/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use strict";

require("newrelic");

const express = require("express");
const morgan = require("morgan");
const multer = require("multer");
Expand Down Expand Up @@ -438,6 +440,10 @@ app.get("/api/estate/search", async (req, res, next) => {
`${sqlprefix}${searchCondition}${limitOffset}`,
queryParams
);
await query(
"INSERT INTO estate_search_log(id, door_height, door_width, rent, features) VALUES(?,?,?,?,?)",
[1, !!doorHeightRangeId, !!doorWidthRangeId, !!rentRangeId, !!features]
);
res.json({
count,
estates: camelcaseKeys(estates),
Expand Down

0 comments on commit 36759c2

Please sign in to comment.