Compare commits

...

2 Commits
main ... merge

Author SHA1 Message Date
34c04e647c online code 2022-02-02 19:09:41 +05:30
ac75a7da1d merge branch 2022-02-02 11:10:11 +05:30
6 changed files with 193 additions and 1 deletions

View File

@ -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');
}
};

39
api/models/business.js Normal file
View File

@ -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;
};

13
api/opencloseapp.in.conf Normal file
View File

@ -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;
}
}

View File

@ -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
}

View File

@ -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;
}

View File

@ -6,6 +6,10 @@ const models=require('../models');
var app = express();
app.use(bodyparser.json());
app.get('/',async(req,res)=>{
res.send("Welcome to Open Close API");
});
//ROLE START
//POST ROLE ADD
@ -208,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",