day 11
This commit is contained in:
Executable
+67
@@ -0,0 +1,67 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const sanitizeHtml = require('sanitize-html')
|
||||
|
||||
module.exports = {
|
||||
filterEmptyFields(object) {
|
||||
Object.keys(object).forEach((key) => {
|
||||
if (this.empty(object[key])) {
|
||||
delete object[key]
|
||||
}
|
||||
})
|
||||
return object
|
||||
},
|
||||
empty(value) {
|
||||
return value === ''
|
||||
},
|
||||
getMappingKey(mappingFunction, value) {
|
||||
return Object.keys(mappingFunction()).find(
|
||||
(key) => mappingFunction()[key].toLowerCase() === value.toLowerCase()
|
||||
)
|
||||
},
|
||||
checkFor(requiredFields) {
|
||||
for (const [key, value] of Object.entries(requiredFields)) {
|
||||
if (!value) {
|
||||
throw new Error(`Must provide ${key}`)
|
||||
}
|
||||
}
|
||||
return true
|
||||
},
|
||||
convertToCents(amount) {
|
||||
return parseFloat(amount) * 100
|
||||
},
|
||||
convertFromCents(amount) {
|
||||
return parseFloat(amount) / 100
|
||||
},
|
||||
inject_substitute(text, normalKey, value) {
|
||||
text = text.replace(new RegExp('{{{' + normalKey + '}}}', 'g'), value)
|
||||
return text
|
||||
},
|
||||
createDirectoriesRecursive(filePath) {
|
||||
let fileDirectoryPath = path.dirname(filePath)
|
||||
if (!fs.existsSync(fileDirectoryPath)) {
|
||||
fs.mkdirSync(fileDirectoryPath, { recursive: true })
|
||||
}
|
||||
},
|
||||
sanitizeInputs(body) {
|
||||
if (Array.isArray(body)) {
|
||||
body.forEach((item) => {
|
||||
item = sanitizeHtml(item)
|
||||
})
|
||||
return body
|
||||
}
|
||||
if (this.isObject(body)) {
|
||||
Object.keys(body).forEach((key) => {
|
||||
body[key] = sanitizeHtml(body[key])
|
||||
})
|
||||
return body
|
||||
}
|
||||
return sanitizeHtml(body)
|
||||
},
|
||||
isObject(obj) {
|
||||
return obj === Object(obj)
|
||||
},
|
||||
ucFirst(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1)
|
||||
},
|
||||
}
|
||||
Executable
+259
@@ -0,0 +1,259 @@
|
||||
const { isInteger } = require('lodash');
|
||||
|
||||
module.exports = async function (Table) {
|
||||
Table._primaryKey = function () {
|
||||
return 'id';
|
||||
};
|
||||
Table.getLast = async function (parameters) {
|
||||
let where = parameters;
|
||||
if (!where) {
|
||||
where = {};
|
||||
}
|
||||
for (const key in where) {
|
||||
const element = where[key];
|
||||
if (element == undefined || element == null) {
|
||||
delete where.key;
|
||||
}
|
||||
}
|
||||
result = await Table.findAll({
|
||||
limit: 1,
|
||||
where: where,
|
||||
order: [['id', 'DESC']],
|
||||
});
|
||||
return result[0];
|
||||
};
|
||||
Table.getAll = function (parameters) {
|
||||
let where = parameters;
|
||||
if (!where) {
|
||||
where = {};
|
||||
}
|
||||
for (const key in where) {
|
||||
const element = where[key];
|
||||
if (element == undefined || element == null) {
|
||||
delete where.key;
|
||||
}
|
||||
}
|
||||
|
||||
return Table.findAll({
|
||||
where: where,
|
||||
});
|
||||
};
|
||||
Table._count = function (parameters, include = []) {
|
||||
let where = parameters;
|
||||
if (!where) {
|
||||
where = {};
|
||||
}
|
||||
for (const key in where) {
|
||||
const element = where[key];
|
||||
if (element == undefined || element == null) {
|
||||
delete where.key;
|
||||
}
|
||||
}
|
||||
|
||||
Table._customCountingConditions(where);
|
||||
|
||||
return Table.count({
|
||||
where: where,
|
||||
include: include,
|
||||
});
|
||||
};
|
||||
|
||||
Table.getPaginated = function (page, limit, parameters, orderBy, direction, include = []) {
|
||||
let where = parameters;
|
||||
|
||||
// for (const key in where) {
|
||||
// if (where.hasOwnProperty.call(where, key)) {
|
||||
// const element = where[key];
|
||||
// if (element.length || isInteger(element)) {
|
||||
// where[key] = element;
|
||||
// } else {
|
||||
// delete where[key];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!page) {
|
||||
page = 0;
|
||||
}
|
||||
if (!limit) {
|
||||
limit = 10;
|
||||
}
|
||||
if (!where) {
|
||||
where = {};
|
||||
}
|
||||
if (!orderBy) {
|
||||
orderBy = Table._primaryKey();
|
||||
}
|
||||
if (!direction) {
|
||||
direction = 'ASC';
|
||||
}
|
||||
|
||||
for (const key in where) {
|
||||
const element = where[key];
|
||||
if (element == undefined || element == null) {
|
||||
delete where.key;
|
||||
}
|
||||
}
|
||||
console.log('Where down', where);
|
||||
|
||||
console.log('[[[[[[[', {
|
||||
where: where,
|
||||
offset: page * limit,
|
||||
limit: limit,
|
||||
order: [[orderBy, direction]],
|
||||
include: include,
|
||||
});
|
||||
|
||||
return Table.findAll({
|
||||
where: where,
|
||||
offset: page * limit,
|
||||
limit: limit,
|
||||
order: [[orderBy, direction]],
|
||||
include: include,
|
||||
});
|
||||
};
|
||||
|
||||
Table.getAllByStatus = function (status) {
|
||||
return Table.findAll({
|
||||
where: {
|
||||
status: status,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Table.getByField = function (field, value) {
|
||||
return Table.findOne({
|
||||
where: {
|
||||
[field]: value,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Table.getByPK = async function (id, options) {
|
||||
return await Table.findByPk(id, options);
|
||||
};
|
||||
|
||||
Table.getByFields = function (parameters) {
|
||||
let where = parameters;
|
||||
if (!where) {
|
||||
where = {};
|
||||
}
|
||||
for (const key in where) {
|
||||
const element = where[key];
|
||||
if (element == undefined || element == null) {
|
||||
delete where.key;
|
||||
}
|
||||
}
|
||||
|
||||
return Table.findOne({
|
||||
where: where,
|
||||
});
|
||||
};
|
||||
|
||||
Table.getAllByKeyValue = async function (field, parameters) {
|
||||
let where = parameters;
|
||||
if (!where) {
|
||||
where = {};
|
||||
}
|
||||
let data = [];
|
||||
const results = await Table.findAll({
|
||||
where: where,
|
||||
});
|
||||
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
const element = results[i];
|
||||
let singleField = element[field];
|
||||
data.push({ [element.id]: singleField });
|
||||
}
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
Table.insert = async function (data, { returnAllFields = false } = {}) {
|
||||
data = Table._preCreateProcessing(data);
|
||||
const insertedRow = await Table.create(Table._filterAllowKeys(data));
|
||||
if (returnAllFields === true) {
|
||||
return insertedRow;
|
||||
}
|
||||
if (insertedRow) {
|
||||
return insertedRow.id;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
Table.batchInsert = async function (data) {
|
||||
const insertedRow = await Table.bulkCreate(data, { returning: true });
|
||||
|
||||
if (insertedRow) {
|
||||
return insertedRow;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
Table.edit = async function (data, id) {
|
||||
data = Table._postCreateProcessing(data);
|
||||
const updateRow = await Table.update(Table._filterAllowKeys(data), {
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
}).catch((error) => {
|
||||
throw new Error(error);
|
||||
});
|
||||
|
||||
return updateRow;
|
||||
};
|
||||
|
||||
Table.editByField = async function (data, where) {
|
||||
data = Table._postCreateProcessing(data);
|
||||
|
||||
const updateRow = await Table.update(Table._filterAllowKeys(data), {
|
||||
where,
|
||||
});
|
||||
|
||||
return updateRow;
|
||||
};
|
||||
|
||||
Table.delete = async function (id) {
|
||||
const updateRow = await Table.update(
|
||||
{
|
||||
status: 0,
|
||||
},
|
||||
{
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
},
|
||||
);
|
||||
return updateRow;
|
||||
};
|
||||
|
||||
Table.realDelete = async function (id) {
|
||||
return Table.destroy({
|
||||
where: {
|
||||
id: id,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Table.realDeleteByFields = async function (parameters, id) {
|
||||
let where = parameters;
|
||||
if (!where) {
|
||||
where = {
|
||||
id: id,
|
||||
};
|
||||
} else {
|
||||
where['id'] = id;
|
||||
}
|
||||
return Table.destroy({
|
||||
where: where,
|
||||
});
|
||||
};
|
||||
Table.realDeleteByUniqueField = async function (field, value) {
|
||||
let where = {};
|
||||
where[field] = value;
|
||||
return Table.destroy({
|
||||
where: where,
|
||||
});
|
||||
};
|
||||
};
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
const translation = require('./translation.json')
|
||||
|
||||
exports.errors = {
|
||||
EMAIL_ADDRESS_NOT_FOUND: translation.xyzAccountDoesntExists,
|
||||
EMAIL_ADDRESS_ALREADY_EXIST: translation.xyzAccount_Already_Exists,
|
||||
PASSWORD_NOT_MATCH: translation.xyzPasswordsDoNotMatch,
|
||||
INVALID_EMAIL_CONFIRMATION_CODE: translation.xyzInvalidEmailConfirmationCode,
|
||||
INVALID_EMAIL_OR_PASSWORD: translation.xyzWrongEmailOrPassword,
|
||||
ACCOUNT_IS_REGISTERED_WITH_GOOGLE:
|
||||
translation.xyzAccountIsRegisteredUsingGoogle,
|
||||
ACCOUNT_IS_REGISTERED_WITH_FACEBOOK:
|
||||
translation.xyzAccountIsRegisteredUsingFacebook,
|
||||
ACCOUNT_IS_REGISTERED_WITH_EMAIL_AND_PASSWORD:
|
||||
translation.xyzAccountIsRegisteredUsingEmailAndPassword,
|
||||
ACCOUNT_DOES_NOT_EXISTS: translation.xyzAccountDoesntExists,
|
||||
CODE_DOES_NOT_EXIST: translation.xyzCodeInvalidOrExpired,
|
||||
}
|
||||
|
||||
exports.errorCodes = {
|
||||
token: {
|
||||
INVALID_TOKEN: 'INVALID_TOKEN',
|
||||
},
|
||||
account: {
|
||||
ACCOUNT_DOES_NOT_EXISTS: 'ACCOUNT_DOES_NOT_EXISTS',
|
||||
ACCOUNT_NOT_VERIFIED: 'ACCOUNT_NOT_VERIFIED',
|
||||
ACCOUNT_ALREADY_VERIFIED: 'ACCOUNT_ALREADY_VERIFIED',
|
||||
UNAUTHORIZED: 'UNAUTHORIZED',
|
||||
},
|
||||
calendar: {
|
||||
CALENDAR_EVENT_DOES_NOT_EXISTS: 'CALENDAR_EVENT_DOES_NOT_EXISTS',
|
||||
},
|
||||
note: {
|
||||
NOTE_DOES_NOT_EXISTS: 'NOTE_DOES_NOT_EXISTS',
|
||||
},
|
||||
extra: {
|
||||
CUSTOM_IMAGE_OR_VIDEO_ALREADY_EXISTS:
|
||||
'CUSTOM_IMAGE_OR_VIDEO_ALREADY_EXISTS',
|
||||
CUSTOM_IMAGE_OR_VIDEO_DOES_NOT_EXISTS:
|
||||
'CUSTOM_IMAGE_OR_VIDEO_DOES_NOT_EXISTS',
|
||||
INVALID_SYNC_CODE: 'INVALID_SYNC_CODE',
|
||||
IFRAME_BLOCKED: 'IFRAME_BLOCKED',
|
||||
INVALID_URL: 'INVALID_URL',
|
||||
SYNC_CODE_ALREADY_EXISTS: 'SYNC_CODE_ALREADY_EXISTS',
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,384 @@
|
||||
{
|
||||
"xyzTitle": "Title",
|
||||
"xyzDate": "Date",
|
||||
"xyzIs Used": "Is Used",
|
||||
"xyzVersion #": "Version #",
|
||||
"xyzTime zone": "Time zone",
|
||||
"xyzTime format": "Time format",
|
||||
"xyzClock format": "Clock format",
|
||||
"xyzDate format": "Date format",
|
||||
"xyzEmails": "Emails",
|
||||
"xyzTimes": "Times",
|
||||
"xyzConfiguration": "Configuration",
|
||||
"xyzEmail": "Email",
|
||||
"xyzFirst Name": "First Name",
|
||||
"xyzLast Name": "Last Name",
|
||||
"xyzPassword": "Password",
|
||||
"xyzEdit": "Edit",
|
||||
"xyzDates": "Date",
|
||||
"xyzFullDates": "Full Date",
|
||||
"xyzAdd": "Add",
|
||||
"xyzCode": "Code",
|
||||
"xyzLink": "Link",
|
||||
"xyzTitles": "Title",
|
||||
"xyzReferree User": "Referree User",
|
||||
"xyzReferrer User": "Referrer User",
|
||||
"xyxType": "Type",
|
||||
"xyzPhone": "Phone",
|
||||
"xyzProfile Type": "Profile Type",
|
||||
"xyzPaid": "Paid",
|
||||
"xyzImage": "Image",
|
||||
"xyzImage ID": "Image ID",
|
||||
"xyzRefer Code": "Refer Code",
|
||||
"xyzProfile": "Profile",
|
||||
"xyzVerified": "Verified",
|
||||
"xyzRole": "Role",
|
||||
"xyzConfirmed": "Confirmed",
|
||||
"xyzDashboard": "Dashboard",
|
||||
"xyzPending": "Pending",
|
||||
"xyzResult": "Result",
|
||||
"xyzTokken": "Tokken",
|
||||
"xyzData": "Data",
|
||||
"xyzTime To Live": "Time To Live",
|
||||
"xyzFullDate": "Full Date",
|
||||
"xyzIssue at": "Issue at",
|
||||
"xyzExpire at": "Expire at",
|
||||
"xyzToken Type": "Token Type",
|
||||
"xyzUser": "xUser",
|
||||
"xyzFilter": "Filter",
|
||||
"xyzSearch": "Search",
|
||||
"xyzStripe Id": "Stripe Id",
|
||||
"xyzAdmin": "Admin",
|
||||
"xyzSystem": "Systems",
|
||||
"xyzMedia Gallery": "Media Gallery",
|
||||
"xyzSaved": "Saved",
|
||||
"xyzLoad More": "Load More",
|
||||
"xyzUpload": "Upload",
|
||||
"xyzClose": "Close",
|
||||
"xyzChoose": "Choose",
|
||||
"xyzCrop & Upload": "Crop & Upload",
|
||||
"xyzDetails": "Details",
|
||||
"xyzView": "View",
|
||||
"xyzSubmit": "Submit",
|
||||
"xyzError": "Error",
|
||||
"xyzBack": "Back",
|
||||
"xyzAction": "Action",
|
||||
"xyzStatus": "Status",
|
||||
"xyzName": "Name",
|
||||
"xyzMessage": "Message",
|
||||
"xyzOR": "OR",
|
||||
"xyzURL": "URL",
|
||||
"xyzCaption": "Caption",
|
||||
"xyzWidth": "Width",
|
||||
"xyzHeight": "Height",
|
||||
"xyzSMS Type": "SMS Type",
|
||||
"xyzImage Type": "Image Type",
|
||||
"xyzReplacement Tags": "Replacement Tags",
|
||||
"xyzSMS Body": "SMS Body",
|
||||
"xyzEmail Type": "Email Type",
|
||||
"xyzSubject": "xyzSubject",
|
||||
"xyzForgot_token": "Forgot_token",
|
||||
"xyzAccess_token": "Access token",
|
||||
"xyzEmail Body": "Email Body",
|
||||
"xyzEdit Profile": "Edit Profile",
|
||||
"xyzRefresh_token": "Refresh_token",
|
||||
"xyzOther": "Other",
|
||||
"xyzApi_key": "Api Key",
|
||||
"xyzApi_secret": "Api Secret",
|
||||
"xyzVerify": "Verify",
|
||||
"xyzSign Up": "Sign Up",
|
||||
"xyzRepeat Password": "Repeat Password",
|
||||
"xyzRegister": "Register",
|
||||
"xyzSign in with Google+": "Sign in with Google+",
|
||||
"xyzSign in with Facebook": "Sign in with Facebook",
|
||||
"xyzSign up New Account": "Sign up New Account",
|
||||
"xyzForgot password?": "Forgot password?",
|
||||
"xyzSign in": "Sign in",
|
||||
"xyzReset Password": "Reset Password",
|
||||
"xyzEmail address": "Email address",
|
||||
"xyzForgot Password": "Forgot Password",
|
||||
"xyzUpload a file": "Upload a file",
|
||||
"xyzChoose Image": "Choose Image",
|
||||
"xyzID": "ID",
|
||||
"xyzPhoto": "Photo",
|
||||
"xyzYes": "Yes",
|
||||
"xyzNo": "No",
|
||||
"xyzPersonal Information": "Personal Information",
|
||||
"xyzUpload file size too big": "Upload file size too big",
|
||||
"xyzUpload to S3 Failed": "xyzUpload to S3 Failed",
|
||||
"xyzWrong email or password.": "Wrong email or password.",
|
||||
"xyzUpload file missing": "xyzUpload file missing",
|
||||
"xyzUpload file failed": "xyzUpload file failed",
|
||||
"xyzSorry, your email is not a google email in our system.": "Sorry, your email is not a google email in our system.",
|
||||
"xyzSorry, google cannot find your email.": "Sorry, google cannot find your email.",
|
||||
"xyzSorry, facebook cannot find your email.": "Sorry, facebook cannot find your email.",
|
||||
"xyzSorry, your email is not a facebook email in our system.": "Sorry, your email is not a facebook email in our system.",
|
||||
"xyzThere was a problem creating your new account. Please try again.": "There was a problem creating your new account. Please try again.",
|
||||
"xyzUser creation failed. Please try again.": "User creation failed. Please try again.",
|
||||
"xyzYour Reset email was sent. Check your email.": "Your Reset email was sent. Check your email.",
|
||||
"xyzEmail does not exist in our system.": "Email does not exist in our system.",
|
||||
"xyzYour password was reset. Try to login now": "Your password was reset. Try to login now",
|
||||
"xyzInvalid reset token to reset password.": "Invalid reset token to reset password.",
|
||||
"xyzinvalid credentials": "invalid credentials",
|
||||
"xyzUpload CSV File missing": "Upload CSV File missing",
|
||||
"xyzNot CSV File": "Not CSV File",
|
||||
"xyzGenerating SQL worked but insert error to the database": "Generating SQL worked but insert error to the database",
|
||||
"xyzImport": "Import",
|
||||
"xyzExport": "Export",
|
||||
"xyzActive": "Active",
|
||||
"xyzInactive": "Inactive",
|
||||
"xyzAll": "All",
|
||||
"xyzSuspend": "Suspend",
|
||||
"xyzMember": "Member",
|
||||
"xyzRemove": "Remove",
|
||||
"xyzCreated At": "Created At",
|
||||
"xyzUpdated At": "Updated At",
|
||||
"xyzNot verified": "Not verified",
|
||||
"xyzType": "Type",
|
||||
"xyzis_required": "is required",
|
||||
"xyzInvalid_email": "Invalid email",
|
||||
"xyzshould_contain_at_least": "should contain at least",
|
||||
"xyzcharacters": "characters",
|
||||
"xyzshould_not_exceed": "should not exceed",
|
||||
"xyzshould_be_unique": "should be unique",
|
||||
"xyzvalue_cannot_be_less_than": "value cannot be less than",
|
||||
"xyzvalue_cannot_be_greater_than": "value cannot be greater than",
|
||||
"xyzSomething_went_wrong": "Something went wrong",
|
||||
"xyzNew": "New",
|
||||
"xyzcreated_successfully": "created successfully",
|
||||
"xyzedited_successFully": "edited successfully",
|
||||
"xyznot_found": "not found",
|
||||
"xyzdeleted_successfully": "deleted successfully",
|
||||
"xyzEmailIsRequired": "Email is required",
|
||||
"xyzPasswordShouldBeAtLeastSixCharacters": "Password should be at least 6 characters long.",
|
||||
"xyzInvalidEmailOrPassword": "Invalid email or password",
|
||||
"xyzWrongEmailOrPassword": "Wrong email or password",
|
||||
"xyzLogin": "Login",
|
||||
"xyzForgot_password": "Forgot Password",
|
||||
"xyzAccount_Already_Exists": "Account already exists",
|
||||
"xyzLogin_with_Google": "Login with Google",
|
||||
"xyzSignup_with_Google": "Login with Google",
|
||||
"xyzLogin_with_Facebook": "Login with Facebook",
|
||||
"xyzSignup_with_Facebook": "Login with Facebook",
|
||||
"xyzPasswordIsRequired": "Password is required.",
|
||||
"xyzPasswordsDoNotMatch": "Passwords do not match",
|
||||
"xyzDontHaveAnAccount": "Don't have an account yet?",
|
||||
"xyzAlreadyHaveAnAccount": "Already have an account?",
|
||||
"xyzAccountDoesntExists": "Account doesn't exists.",
|
||||
"xyzInvalid_token": "Invalid token",
|
||||
"xyzBackToLogin": "Back to Login",
|
||||
"xyzResetPassword": "Reset Password",
|
||||
"xyzPasswordResetSuccessful": "Password reset successful",
|
||||
"xyzlisted_successfully": "listed successfully",
|
||||
"xyzFirstNameIsRequired": "First name is required",
|
||||
"xyzLastNameIsRequired": "Last name is required",
|
||||
"xyzVerificationCodeIsRequired": "Verification Code is re required.",
|
||||
"xyzPasswordResetLinkIsSentToYourInbox": "A password reset link is sent to your inbox.",
|
||||
"xyzReset": "Reset",
|
||||
"xyzshould_be_equal_to": "should be equal to",
|
||||
"xyzshould_be_greater_than_or_equal_to": "should be greater than or equal to",
|
||||
"xyzshould_be_greater_than": "should be greater than",
|
||||
"xyzshould_be_less_than_or_equal_to": "should be less than or equal to",
|
||||
"xyzshould_be_less_than_to": "should be less than to",
|
||||
"xyzshould_be_exist_in_the_list": "should be exist in the list",
|
||||
"xyzshould_only_contain_alphabetic_characters": "should only contain alphabetic characters",
|
||||
"xyzshould_only_contain_contains_letters_and_numbers": "should only contain contains letters and numbers",
|
||||
"xyzshould_have_have_alpha-numeric_characters,_as_well_as_dashes_and_underscores": "should have have alpha-numeric characters, as well as dashes and underscores",
|
||||
"xyzmust_be_numeric": "must be numeric",
|
||||
"xyzmust_be_integer": "must be integer",
|
||||
"xyzmust_be_decimal": "must be decimal",
|
||||
"xyzmust_be_is_natural": "must be is natural",
|
||||
"xyzmust_be_is_natural_no_zero": "must be is natural without zero",
|
||||
"xyzmust_be_valid_url": "must be valid url",
|
||||
"xyzmust_be_valid_ip": "must be valid ip",
|
||||
"xyzmust_be_valid_base64_string": "must be valid base64 string",
|
||||
"xyzshould_be_between": "should be between",
|
||||
"xyzshould_be_digits_between": "should be digits between",
|
||||
"xyzshould_be_date": "should be date",
|
||||
"xyzshould_be_datetime": "should be datetime",
|
||||
"xyzshould_be_contains": "should be contains",
|
||||
"xyzshould_be": "should be",
|
||||
"xyzshould_be_equals": "should be equals",
|
||||
"xyzBulk_Delete": "Bulk Delete",
|
||||
"xyzBulk_Edit": "Bulk Edit",
|
||||
"xyzBulkDeleteSuccessful": "Bulk Delete Successful",
|
||||
"xyzItemsWereDeleted": "item(s) were deleted.",
|
||||
"xyzThankYouForContacting": "Thank your for contacting",
|
||||
"xyzContact": "Contact",
|
||||
"xyzMessageIsRequired": "Message is required",
|
||||
"xyzFullNameIsRequired": "Full name is required",
|
||||
"xyzFullName": "Full Name",
|
||||
"xyzContactNotFound": "Contact not found",
|
||||
"xyzContactDeletedSuccessfully": "Contact deleted successfully",
|
||||
"xyzContactDetails": "Contact Details",
|
||||
"xyzInvalidEmail": "Invalid email",
|
||||
"xyzContactCreatedSuccessfully": "Contact created successfully",
|
||||
"xyzRewriteURL": "Rewrite URL",
|
||||
"xyzTwoFactorAuthentication": "Two factor authentication",
|
||||
"xyzfor": "for",
|
||||
"xyzis": "is",
|
||||
"xyzcode": "code",
|
||||
"xyzYourVerificationCodeIs": "Your verification code is",
|
||||
"xyzAccountVerification": "Account Verification",
|
||||
"xyzInvalidVerificationCode": "Invalid Verification Code",
|
||||
"xyzNewVerificationCodeSent": "New verification code sent",
|
||||
"xyzResendTheCode": "Resent the code",
|
||||
"xyzVerificationCode": "Verification code",
|
||||
"xyzUserID": "User ID",
|
||||
"xyzOrganizationID": "Organization ID",
|
||||
"xyzPermission": "Permission",
|
||||
"xyzOrganizationName": "Organization name",
|
||||
"xyzOrganizationStatus": "Organization status",
|
||||
"xyzUserPermissions": "User permissions",
|
||||
"xyzOrganizationPermissions": "Organization permissions",
|
||||
"xyxRoute": "Route",
|
||||
"xyzSave Data": "Save Data",
|
||||
"xyzAllRightsReserved": "All Rights Reserved.",
|
||||
"xyzInvalidEmailConfirmationCode": "Invalid email confirmation code",
|
||||
"xyzImageId": "Image Id",
|
||||
"xyzInvalidRefreshToken": "Invalid refresh token",
|
||||
"xyzTokenIDIsRequired": "Token ID is required",
|
||||
"xyzRefreshTokenIsRequired": "Refresh token is required",
|
||||
"xyzGoogleTokenIDIsRequired": "Google token ID token is required",
|
||||
"xyzGoogleAccessTokenIsRequired": "Google access token is required",
|
||||
"xyzFacebookAccessTokenIsRequired": "Facebook access token is required",
|
||||
"xyzAccountIsRegisteredUsingGoogle": "Account is registered using Google. Use that instead.",
|
||||
"xyzAccountIsRegisteredUsingFacebook": "Account is registered using Facebook. Use that instead.",
|
||||
"xyzAccountIsRegisteredUsingEmailAndPassword": "Account is registered using Facebook. Use that instead.",
|
||||
"xyzEmailAssociatedWithFacebookCouldntBeFound": "Email associated with facebook couldn't be found",
|
||||
"xyzConfirm_Password": "Confirm Password",
|
||||
"xyzPage Title": "Page Title",
|
||||
"xyzPage slug": "Page slug",
|
||||
"xyzPage Link": "Page Link",
|
||||
"xyzLayout": "Layout",
|
||||
"xyzContent Template Path": "Content Template Path",
|
||||
"xyzHeader Template Path": "Header Template Path",
|
||||
"xyzFooter Template Path": "Footer Template Path",
|
||||
"xyzPage Content": "Page Content",
|
||||
"xyzMarketing Title": "Marketing Title",
|
||||
"xyzMarketing Slug": "Marketing Slug",
|
||||
"xyzExpire At": "Expire At",
|
||||
"xyzPassword Protected": "Password Protected",
|
||||
"xyzStripe Cards": "Stripe Cards",
|
||||
"xyzStripe Checkout": "Stripe Checkout",
|
||||
"xyzPayPal Subscriptions": "PayPal Subscriptions",
|
||||
"xyzPayPal Plans": "PayPal Plans",
|
||||
"xyzPayPal Services": "PayPal Services",
|
||||
"xyzPayPal Products": "PayPal Products",
|
||||
"xyzStripe Disputes": "Stripe Disputes",
|
||||
"xyzStripe Invoices": "Stripe Invoices",
|
||||
"xyzStripe Payments": "Stripe Payments",
|
||||
"xyzStripe Coupons": "Stripe Coupons",
|
||||
"xyzStripe Subscriptions": "Stripe Subscriptions",
|
||||
"xyzStripe Plans": "Stripe Plans",
|
||||
"xyzStripe Services": "Stripe Services",
|
||||
"xyzStripe Products": "Stripe Products",
|
||||
"xyzSchedule": "Schedule",
|
||||
"xyzStripe Checkout Sessions": "Stripe Checkout Sessions",
|
||||
"xyzService Stripe ID": "Service Stripe ID",
|
||||
"xyzCategory": "Category",
|
||||
"xyzCredential ID": "Credential ID",
|
||||
"xyzPlan Interval": "Plan Interval",
|
||||
"xyzBilling Info": "Billing Info",
|
||||
"xyzPayPal ID": "PayPal ID",
|
||||
"xyzPaypal ID": "Paypal ID",
|
||||
"xyzPayment Plans": "Payment Plans",
|
||||
"xyzPayment Services": "Payment Services",
|
||||
"xyzPayer ID": "Payer ID",
|
||||
"xyzPayment Product ID": "Payment Product ID",
|
||||
"xyzPayment": "Payment",
|
||||
"xyzService ID": "Service ID",
|
||||
"xyzService": "Service",
|
||||
"xyzPaypal Product ID": "Paypal Product ID",
|
||||
"xyzPayPal Product ID": "PayPal Product ID",
|
||||
"xyzCustomer Stripe ID": "Customer Stripe ID",
|
||||
"xyzCustomer Paypal ID": "Customer Paypal ID",
|
||||
"xyzStripe": "Stripe",
|
||||
"xyzPayPal": "PayPal",
|
||||
"xyzRegular": "Regular",
|
||||
"xyzUser Details": "User Details",
|
||||
"xyzLife Time Paid": "Life Time Paid",
|
||||
"xyzLife Time Free": "Life Time Free",
|
||||
"xyzTrial Paid": "Trial Paid",
|
||||
"xyzTrial Free": "Trial Free",
|
||||
"xyzInterval": "Interval",
|
||||
"xyzCoupon Stripe ID": "Coupon Stripe ID",
|
||||
"xyzProduct Name": "Product Name",
|
||||
"xyzDescription": "Description",
|
||||
"xyzStatement descriptor": "Statement descriptor",
|
||||
"xyzUnit Label": "Unit Label",
|
||||
"xyzShippable": "Shippable",
|
||||
"xyzPricing": "Pricing",
|
||||
"xyzAmount": "Amount",
|
||||
"xyzDisplay Name": "Display Name",
|
||||
"xyzincomplete": "incomplete",
|
||||
"xyzincomplete_expired": "incomplete_expired",
|
||||
"xyztrialing": "trialing",
|
||||
"xyzpast_due": "past_due",
|
||||
"xyzactive": "active",
|
||||
"xyzcanceled": "canceled",
|
||||
"xyzunpaid": "unpaid",
|
||||
"xyzrefunded": "refunded",
|
||||
"xyzday": "day",
|
||||
"xyzweek": "week",
|
||||
"xyzmonth": "month",
|
||||
"xyzyear": "year",
|
||||
"xyzStripe Customer ID": "Stripe Customer ID",
|
||||
"xyzCurrent Period Start": "Current Period Start",
|
||||
"xyzCurrent Period End": "Current Period End",
|
||||
"xyzCurrent Period Start Date": "Current Period Start Date",
|
||||
"xyzCurrent Period End Date": "Current Period End Date",
|
||||
"xyzCancel At Period End": "Cancel At Period End",
|
||||
"xyzPlan Object": "Plan Object",
|
||||
"xyzOrder ID": "Order ID",
|
||||
"xyzStripe ID": "Stripe ID",
|
||||
"xyzCoupon ID": "Coupon ID",
|
||||
"xyzSubscription Interval": "Subscription Interval",
|
||||
"xyzInterval Count": "Interval Count",
|
||||
"xyzTrial Period Days": "Trial Period Days",
|
||||
"xyzTrial Start": "Trial Start",
|
||||
"xyzTrial End": "Trial End",
|
||||
"xyzCollection Method": "Collection Method",
|
||||
"xyzUser ID": "User ID",
|
||||
"xyzRole ID": "Role ID",
|
||||
"xyzPlan ID": "Plan ID",
|
||||
"xyzSettings": "Settings",
|
||||
"xyzdetails": "details",
|
||||
"xyzedited_successfully": "edited successfully",
|
||||
"xyzname": "name",
|
||||
"xyz": "",
|
||||
"xyzbadge": "Badge",
|
||||
"xyzbadge_id": "Badge ID",
|
||||
"xyzuser": "User",
|
||||
"xyzmessage": "Message",
|
||||
"xyzstatus": "Status",
|
||||
"xyztitle": "Title",
|
||||
"xyzdate": "Date",
|
||||
"xyztime": "Time",
|
||||
"xyztimezone": "Timezone",
|
||||
"xyzdashboard_code": "Dashboard Code",
|
||||
"xyzlink": "link",
|
||||
"xyzPost": "Post",
|
||||
"xyzUserDoesNotExists": "User does not exists.",
|
||||
"xyzSyncCode": "Sync Code",
|
||||
"xyzFontColor": "Font Color",
|
||||
"xyzTimezone": "Timezone",
|
||||
"xyzPacific": "Pacific",
|
||||
"xyzEastern": "Eastern",
|
||||
"xyzTimeFormat": "Time Format",
|
||||
"xyzAM/PM": "AM/PM",
|
||||
"xyz24Hours": "24 hours",
|
||||
"xyzClockFormat": "Clock Format",
|
||||
"xyzDigital": "Digital",
|
||||
"xyzAnalog": "Analog",
|
||||
"xyzDateFormat": "Date Format",
|
||||
"xyzStandard": "Standard",
|
||||
"xyzLocale": "Locale",
|
||||
"xyzLocation": "Location",
|
||||
"xyzCodeInvalidOrExpired": "Code invalid or already expired",
|
||||
"xyzLatitude": "Latitude",
|
||||
"xyzLongitude": "Longitude",
|
||||
"xyzStartDate": "Start Date",
|
||||
"xyzEndDate": "End Date",
|
||||
"xyzEventId": "Event Id"
|
||||
}
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
exports.validateEmail = (email) => {
|
||||
const re =
|
||||
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
|
||||
const reStartAndEnd = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}/g
|
||||
|
||||
if (re.test(email) && reStartAndEnd.test(email)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user