37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
const ContactUs = require('../models/ContactUs');
|
|
const database = require('../database');
|
|
|
|
module.exports.createAdmins = () => {
|
|
database.once('open', async cb => {
|
|
try {
|
|
const contactUs = await ContactUs.find();
|
|
if (!contactUs.length) {
|
|
const data = {
|
|
description : "توضیحات صفحه تماس با ما",
|
|
showInMenu : true,
|
|
main : true,
|
|
email : 'test@gmail.com',
|
|
phone : '08632222222',
|
|
address : 'میدان فاطمیه',
|
|
catId : null,
|
|
_creator : null,
|
|
_updatedBy : null,
|
|
location : {
|
|
type : 'Point',
|
|
coordinates : [-118.2870407961309,33.93508571994455]
|
|
},
|
|
siteMap : true,
|
|
showInFooter : true
|
|
};
|
|
const newContactUs = new ContactUs(data);
|
|
newContactUs.save(err => {
|
|
if (err) console.log(err)
|
|
})
|
|
}
|
|
} catch
|
|
(e) {
|
|
console.log('defualt contact us creation has error -- ', e)
|
|
}
|
|
})
|
|
}
|