From 34c04e647cfff043a88be43140227be3eec12544 Mon Sep 17 00:00:00 2001 From: Kaleeswari Date: Wed, 2 Feb 2022 19:09:41 +0530 Subject: [PATCH] online code --- .../20220123075611-create-business.js | 75 +++++++++++++++++++ api/models/business.js | 39 ++++++++++ api/opencloseapp.in.conf | 13 ++++ api/opencloseapp.in.conf.bak | 41 ++++++++++ api/opencloseapp.in.conf.copy | 18 +++++ api/routes/api.js | 4 +- 6 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 api/migrations/20220123075611-create-business.js create mode 100644 api/models/business.js create mode 100644 api/opencloseapp.in.conf create mode 100644 api/opencloseapp.in.conf.bak create mode 100644 api/opencloseapp.in.conf.copy diff --git a/api/migrations/20220123075611-create-business.js b/api/migrations/20220123075611-create-business.js new file mode 100644 index 0000000..2f4b0e8 --- /dev/null +++ b/api/migrations/20220123075611-create-business.js @@ -0,0 +1,75 @@ +'use strict'; +module.exports = { + async up(queryInterface, Sequelize) { + await queryInterface.createTable('businesses', { + id: { + allowNull: false, + autoIncrement: true, + primaryKey: true, + type: Sequelize.INTEGER + }, + categoryId: { + type: Sequelize.INTEGER + }, + subcategoryId: { + type: Sequelize.INTEGER + }, + name: { + type: Sequelize.STRING + }, + latitude: { + type: Sequelize.STRING + }, + longitute: { + type: Sequelize.STRING + }, + pincode: { + type: Sequelize.INTEGER + }, + mobileNumber: { + type: Sequelize.STRING + }, + logo: { + type: Sequelize.STRING + }, + galleryId: { + type: Sequelize.INTEGER + }, + about: { + type: Sequelize.TEXT + }, + startTime: { + type: Sequelize.TIME + }, + endTime: { + type: Sequelize.TIME + }, + website: { + type: Sequelize.STRING + }, + openClose: { + type: Sequelize.INTEGER + }, + status: { + type: Sequelize.INTEGER + }, + createdBy: { + type: Sequelize.INTEGER + }, + updateBy: { + type: Sequelize.INTEGER + }, + createdAt: { + allowNull: false, + type: Sequelize.DATE + }, + updatedAt: { + allowNull: false, + type: Sequelize.DATE + } + }); + }, + async down(queryInterface, Sequelize) { + await queryInterface.dropTable('businesses'); + } +}; \ No newline at end of file diff --git a/api/models/business.js b/api/models/business.js new file mode 100644 index 0000000..46bd83d --- /dev/null +++ b/api/models/business.js @@ -0,0 +1,39 @@ +'use strict'; +const { + Model +} = require('sequelize'); +module.exports = (sequelize, DataTypes) => { + class business extends Model { + /** + * Helper method for defining associations. + * This method is not a part of Sequelize lifecycle. + * The `models/index` file will call this method automatically. + */ + static associate(models) { + // define association here + } + } + business.init({ + categoryId: DataTypes.INTEGER, + subcategoryId: DataTypes.INTEGER, + name: DataTypes.STRING, + latitude: DataTypes.STRING, + longitute: DataTypes.STRING, + pincode: DataTypes.INTEGER, + mobileNumber: DataTypes.STRING, + logo: DataTypes.STRING, + galleryId: DataTypes.INTEGER, + about: DataTypes.TEXT, + startTime: DataTypes.TIME, + endTime: DataTypes.TIME, + website: DataTypes.STRING, + openClose: DataTypes.INTEGER, + status: DataTypes.INTEGER, + createdBy: DataTypes.INTEGER, + updateBy: DataTypes.INTEGER + }, { + sequelize, + modelName: 'business', + }); + return business; +}; \ No newline at end of file diff --git a/api/opencloseapp.in.conf b/api/opencloseapp.in.conf new file mode 100644 index 0000000..2980683 --- /dev/null +++ b/api/opencloseapp.in.conf @@ -0,0 +1,13 @@ +server { + listen 80; + listen [::]:80; + + root /var/www/html/opencloseapp.in; + index index.js index.html index.htm ; + + server_name opencloseapp.in www.opencloseapp.in; + + location / { + try_files $uri $uri/ =404; + } +} diff --git a/api/opencloseapp.in.conf.bak b/api/opencloseapp.in.conf.bak new file mode 100644 index 0000000..dbdac2b --- /dev/null +++ b/api/opencloseapp.in.conf.bak @@ -0,0 +1,41 @@ +server { + + root /var/www/html/coconutmarketapp.in; + index index.html index.js index.htm index.nginx-debian.html; + + server_name coconutmarketapp.in www.coconutmarketapp.in; + + location / { + try_files $uri $uri/ =404; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $http_host; + proxy_pass http://coconutmarketapp.in:3030; + } + + + access_log /var/log/nginx/coconutmarketapp.in.access.log; + error_log /var/log/nginx/coconutmarketapp.in.error.log; + + + listen [::]:443 ssl ipv6only=on; # managed by Certbot + listen 443 ssl; # managed by Certbot + ssl_certificate /etc/letsencrypt/live/coconutmarketapp.in/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/coconutmarketapp.in/privkey.pem; # managed by Certbot + include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot + +} +server { + if ($host = coconutmarketapp.in) { + return 301 https://$host$request_uri; + } # managed by Certbot + + + listen 80; + listen [::]:80; + + server_name coconutmarketapp.in www.coconutmarketapp.in; + return 404; # managed by Certbot + + +} \ No newline at end of file diff --git a/api/opencloseapp.in.conf.copy b/api/opencloseapp.in.conf.copy new file mode 100644 index 0000000..e55036a --- /dev/null +++ b/api/opencloseapp.in.conf.copy @@ -0,0 +1,18 @@ +server { + listen 80; + listen [::]:80; + + root /var/www/html/coconutmarketapp.in; + index index.html index.js index.htm index.nginx-debian.html; + + server_name coconutmarketapp.in www.coconutmarketapp.in; + + location / { + try_files $uri $uri/ =404; + } + + + access_log /var/log/nginx/coconutmarketapp.in.access.log; + error_log /var/log/nginx/coconutmarketapp.in.error.log; + +} \ No newline at end of file diff --git a/api/routes/api.js b/api/routes/api.js index 9bec860..5fb824d 100644 --- a/api/routes/api.js +++ b/api/routes/api.js @@ -212,7 +212,9 @@ app.get('/service',async(req,res)=>{ //GET SERVICE VIEW app.get('/viewService/(:serviceId)',async(req,res)=>{ - await models.service.findByPk(req.params.serviceId).then(result=>{ + await models.service.findAll( + {where:[{status:1},{ id:req.params.serviceId}]} + ).then(result=>{ res.status(201).json({ Code:"1", Message:"Success",