website(II)

website (II) with documentation
This commit is contained in:
Preeti Rawat
2020-07-29 22:29:04 +04:00
parent 9e358e1c24
commit e4cffc7282
2 changed files with 228 additions and 66 deletions

View File

@@ -21,6 +21,12 @@ module.exports.onCreate = (id, companyName) => {
/**
* A help function
* @param {void} nothing
* @return {help_signal} details on how to use the website
*/
module.exports.help = () => module.exports.help = () =>
{ {
let help_signal = [ let help_signal = [
@@ -45,7 +51,11 @@ module.exports.help = () =>
return help_signal; return help_signal;
} }
/**
* wg create
* @param {string} input of the company name
* @return {void} gives information on how to add details to website
*/
module.exports.comp = (input) => module.exports.comp = (input) =>
{ {
let create_company = [ let create_company = [
@@ -70,13 +80,17 @@ module.exports.comp = (input) =>
} }
/**
module.exports.fn = (fdata) => * wg website firstname
* @param {string} input of the firstname for website
* @return {void} informs you that first name has been added
*/
module.exports.firstName = (fdata) =>
{ {
let info = [`your first name is:` + fdata let info = [`your first name is:` + fdata
]; ];
@@ -95,13 +109,17 @@ module.exports.fn = (fdata) =>
return info; return info;
} }
/**
module.exports.ln = (ldata) => * wg website lastname
* @param {string} input of the last name for website
* @return {void} informs you that last name has been added
*/
module.exports.lastName = (ldata) =>
{ {
let info = let info =
[`your last name is: ` + ldata [`your last name is: ` + ldata
]; ];
if(Website.companyName == null) if(Website.companyName == null)
@@ -121,11 +139,16 @@ module.exports.ln = (ldata) =>
return info; return info;
} }
module.exports.cn = (cdata) => /**
* wg website companyname
* @param {string} input of the companyname for website. In case you want to change the company name, you can do so here.
* @return {void} informs you that company name has been updated
*/
module.exports.CompanyName_website = (cdata) =>
{ {
let info = [`your company name is: ` + cdata let info = [`your company name is: ` + cdata
]; ];
if(Website.firstname == null) if(Website.firstname == null)
@@ -139,18 +162,23 @@ module.exports.cn = (cdata) =>
else(Website.companyName != cdata) else(Website.companyName != cdata)
{ {
Website.companyName = cdata; Website.companyName = cdata;
info = [`your company name has been changed to` +cdata]; info = [`your company name has been changed to ` +cdata];
console.log('this is data ' +Website.companyName); console.log('this is data ' +Website.companyName);
} }
return info; return info;
} }
/**
* wg website logo
* @param {string} input of the logo URL for website
* @return {void} informs you that logo URL has been added
*/
module.exports.logourl = (ldata) => module.exports.logourl = (ldata) =>
{ {
let info = [`the data that you added are as follow:`, let info = [`your logo is: ` + ldata
`company Name: ` + ldata
]; ];
if(Website.companyName == null) if(Website.companyName == null)
{ {
@@ -169,4 +197,124 @@ module.exports.logourl = (ldata) =>
Website.logoUrl = ldata Website.logoUrl = ldata
} }
return info; return info;
}
/**
* wg website banner
* @param {string} input of the banner URL for website
* @return {void} informs you that banner URL has been added
*/
module.exports.bannerurl = (bannerdata) =>
{
let info = [`your banner is: ` + bannerdata
];
if(Website.companyName == null)
{
info = [`you have not input your company name. Please try again.`]
}
else if(Website.firstname == null)
{
info = [`you have not insert first name.`];
}
else if(Website.lastname == null)
{
info = [`you have not insert last name.`];
}
else if(Website.logoUrl == null)
{
info = [`you have not insert logo url`];
}
else
{
Website.bannerUrl = bannerdata
}
return info;
}
/**
* wg website description
* @param {string} input of the company description for website
* @return {void} informs you that description has been added
*/
module.exports.company_description = (descriptiondata) =>
{
let info = [`your company description is: ` + descriptiondata
];
if(Website.companyName == null)
{
info = [`you have not input your company name. Please try again.`]
}
else if(Website.firstname == null)
{
info = [`you have not insert first name.`];
}
else if(Website.lastname == null)
{
info = [`you have not insert last name.`];
}
else if(Website.logoUrl == null)
{
info = [`you have not insert logo url`];
}
else if(Website.bannerUrl == null)
{
info = [`you have not insert banner url`];
}
else
{
Website.desc = descriptiondata
}
return info;
}
/**
* wg website email
* @param {string} input of the email for website
* @return {void} informs you that email has been added
*
*/
module.exports.email = (email_data) =>
{
let info = [`your email is: `+ email_data
];
if(Website.companyName == null)
{
info = [`you have not input your company name. Please try again.`]
}
else if(Website.firstname == null)
{
info = [`you have not insert first name.`];
}
else if(Website.lastname == null)
{
info = [`you have not insert last name.`];
}
else if(Website.logoUrl == null)
{
info = [`you have not insert logo url`];
}
else if(Website.bannerUrl == null)
{
info = [`you have not insert banner url`];
}
else if(Website.desc == null)
{
info = [`you have not insert the description`];
}
else
{
Website.email = email_data
}
return info;
} }

View File

@@ -5,6 +5,8 @@ const logic = require("../businessLogic/logic");
/////////// ///////////
//add the commands here //add the commands here
/////////// ///////////
const commands = [ const commands = [
new Command({ new Command({
//User command //User command
@@ -25,8 +27,10 @@ const commands = [
}), }),
//gives user information on how to create website
new Command({ new Command({
//User command //User command
command: 'wg help', command: 'wg help',
//function to be executed //function to be executed
@@ -41,6 +45,7 @@ const commands = [
} }
}), }),
//helps user to create a website. The first step.
new Command({ new Command({
//User command //User command
@@ -60,6 +65,7 @@ const commands = [
} }
}), }),
//Inputs user's first name for website
new Command({ new Command({
//User command //User command
@@ -75,28 +81,14 @@ const commands = [
fdata = input['firstName']; fdata = input['firstName'];
info = logic.fn(fdata); info = logic.firstName(fdata);
return info; return info;
} }
}), }),
// new Command({
// //User command
// command: 'wg website firstname <f_name>',
// //function to be executed //inputs user last name in website
// callback : (input) =>
// {
// logic.onWG();
// inputting = input['f_name'];
// fname = logic.fn(input);
// return fname;
// }
// }),
new Command({ new Command({
//User command //User command
@@ -112,12 +104,14 @@ const commands = [
ldata = input['lastname']; ldata = input['lastname'];
info = logic.ln(ldata); info = logic.lastName(ldata);
return info; return info;
} }
}), }),
//inputs user companyname;in case they want to update the name
new Command({ new Command({
//User command //User command
@@ -133,12 +127,13 @@ const commands = [
cdata = input['cname']; cdata = input['cname'];
info = logic.cn(cdata); info = logic.CompanyName_website(cdata);
return info; return info;
} }
}), }),
//inputs the logo of the company to website using url of logo
new Command({ new Command({
//User command //User command
@@ -160,50 +155,69 @@ const commands = [
} }
}), }),
// new Command({
// //User command
// command: 'wg website logo <logo_name>',
//inputs the banner for the company to website using url of banner
new Command({
//User command
// //function to be executed command: 'wg website banner <bannerURL>',
// callback : (input) =>
// {
// logic.onWG();
// inputting = input['logo_name'];
// logoURL = logic.logo(input);
// return logoURL;
// }
// }),
// new Command({ //function to be executed
// //User command callback : (input) =>
{
// command: 'wg website <firstName> <lastname> <Cname>',
// //function to be executed
// callback : (input) =>
// {
// logic.onWG(); logic.onWG();
// //cdata = input['company']; bannerU = input['bannerURL'];
// fdata = input['firstName'];
// ldata = input['lastname'];
// cdata = input['Cname'];
// info = logic.comdetails(fdata, ldata, cdata); info = logic.bannerurl(bannerU);
// return info; return info;
// } }
// }), }),
//inputs the description of the company to be seen in the website
new Command({
//User command
command: 'wg website description <descript>',
//function to be executed
callback : (input) =>
{
logic.onWG();
websiteDescription = input['descript'];
info = logic.company_description(websiteDescription);
return info;
}
}),
//inputs the email of the company for contacting.
new Command({
//User command
command: 'wg website email <Email>',
//function to be executed
callback : (input) =>
{
logic.onWG();
mail = input['Email'];
info = logic.email(mail);
return info;
}
}),
]; ];