use single ENUMS; change old realEstateType enums
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
const { currentSearchRequest } = require("../helpers/url");
|
||||
const { createSearchRequest } = require("../helpers/db/searchRequest");
|
||||
|
||||
const { realEstateTypes, getRealEstateTypeEnum } = require("../helpers/enums");
|
||||
const { AD_CATEGORY } = require("../common/enums");
|
||||
|
||||
const getRealEstateTypes = (req, res) => {
|
||||
const title = "Koju nekretninu tražite?";
|
||||
const realEstateTypes = Object.keys(AD_CATEGORY).map(
|
||||
category => AD_CATEGORY[category]
|
||||
);
|
||||
res.render("realEstateType", { realEstateTypes, title });
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
up: (queryInterface, Sequelize) => {
|
||||
return Promise.all([
|
||||
queryInterface.sequelize.query(
|
||||
`UPDATE "SearchRequests" SET "realEstateType" = 'HOUSE' WHERE "realEstateType" = 'kuca';`
|
||||
),
|
||||
queryInterface.sequelize.query(
|
||||
`UPDATE "SearchRequests" SET "realEstateType" = 'FLAT' WHERE "realEstateType" = 'stan';`
|
||||
),
|
||||
queryInterface.sequelize.query(
|
||||
`UPDATE "SearchRequests" SET "realEstateType" = 'COTTAGE' WHERE "realEstateType" = 'vikendica';`
|
||||
)
|
||||
]);
|
||||
},
|
||||
|
||||
down: (queryInterface, Sequelize) => {
|
||||
return Promise.all([
|
||||
queryInterface.sequelize.query(
|
||||
`UPDATE "SearchRequests" SET "realEstateType" = 'kuca' WHERE "realEstateType" = 'HOUSE';`
|
||||
),
|
||||
queryInterface.sequelize.query(
|
||||
`UPDATE "SearchRequests" SET "realEstateType" = 'stan' WHERE "realEstateType" = 'FLAT';`
|
||||
),
|
||||
queryInterface.sequelize.query(
|
||||
`UPDATE "SearchRequests" SET "realEstateType" = 'vikendica' WHERE "realEstateType" = 'COTTAGE';`
|
||||
)
|
||||
]);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user