base_project

This commit is contained in:
risadmin_prod 2024-09-16 05:00:58 +00:00
commit 5c29d65754
738 changed files with 66125 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,21 @@
LOCAL_HOST1=43.205.154.152
FRONTEND_PORT_9191=30165
# **** BACKPORT ****
PORT=9292
# **** MY SQL DATABASE CONNECTION ****
DATABASE_HOST=realnet.cdas4e08uugj.us-east-1.rds.amazonaws.com
DATABASE_NAME=realnet_CNSBENEW
DATABASE_USERNAME=cnsdev
DATABASE_PASSWORD=cnsdev2407
DATABASE_PORT=3306
# **** MAIL SENDER
NODEMAILER_HOST=smtp.gmail.com
NODEMAILER_USER=realitmailsender@gmail.com
NODEMAILER_PASSWORD=epnmhzsccotnyozf
NODEMAILER_PORT=587
# **** BASEPATH ****
BASE_PATH=/baseurl

View File

@ -0,0 +1,59 @@
const db = require("../config/database")
async function executeQuery(sql, values) {
const connection = await db.getConnection()
try {
const [rows] = await connection.execute(sql, values)
return rows
} finally {
connection.release()
}
}
async function buildExtensionByFormCode(acc_id, formId) {
const sql = `SELECT * FROM rn_ext_field_t WHERE account_id='${acc_id}' AND id='${formId}'`
const extension = await executeQuery(sql)
// console.log(extension)
let extension_entry_form = []
let extension_grid_form = []
if (!extension || extension.length === 0) {
return { message: "Extension Fields Not Found" }
} else {
// for (const extension of extensions) {
const data_type = extension[0].data_type
const mapping = extension[0].mapping
const f_code = extension[0].form_code
// console.log(mapping)
const field_name = extension[0].field_name
const ext = `,\"extValue\":\"${mapping}\"`
let fieldInfo = {}
if (data_type === "textfield") {
fieldInfo = `{\"fieldName\":\"" + ${field_name} + "\",\"fieldType\":\"text\",\"fieldValue\":\"\",\"formCode\":\"" + ${f_code} + "\"" + ${ext} + "},`
} else if (data_type === "date") {
fieldInfo = `{\"fieldName\":\"" + ${field_name} + "\",\"fieldType\":\"date\",\"fieldValue\":\"\",\"formCode\":\"" + ${f_code} + "\"" + ${ext} + "},`
} else if (data_type === "l_textfield") {
fieldInfo = `{\"fieldName\":\"" + ${field_name} + "\",\"fieldType\":\"textarea\",\"fieldValue\":\"\",\"formCode\":\"" + ${f_code} + "\"" + ${ext} + "},`
} else if (data_type === "checkbox") {
fieldInfo = `{\"fieldName\":\"" + ${field_name} + "\",\"fieldType\":\"checkbox\",\"fieldValue\":\"\",\"formCode\":\"" + ${f_code} + "\"" + ${ext} + "},`
} else if (data_type === "autocomplete") {
fieldInfo = `{\"fieldName\":\"" + ${field_name} + "\",\"fieldType\":\"text\",\"fieldValue\":\"\",\"formCode\":\"" + ${f_code} + "\"" + ${ext} + "},`
} else if (data_type === "text") {
fieldInfo = `{\"fieldName\":\"" + ${field_name} + "\",\"fieldType\":\"text\",\"fieldValue\":\"\",\"formCode\":\"" + ${f_code} + "\"" + ${ext} + "},`
}
extension_entry_form.push(fieldInfo)
// Extension grid-view code
extension_grid_form.push(
`{prop: \"" + ${mapping} + "\", name: \"" + ${field_name} + "\", width: 200},\n`
)
// }
}
return extension_entry_form
}
module.exports = { buildExtensionByFormCode }

View File

@ -0,0 +1,13 @@
const crypto = require("crypto")
function generateRandomHash(length = 32) {
// Generate random bytes
const randomBytes = crypto.randomBytes(length)
// Convert bytes to hexadecimal representation
const hash = randomBytes.toString("hex")
return hash
}
module.exports = generateRandomHash

View File

@ -0,0 +1 @@
"# rajeevrepo"

View File

@ -0,0 +1,449 @@
const { pool, db } = require("../config/database")
// Insert menu
const customSecMenuAdd = async (tablename, menuId) => {
try {
// Replace "_" with " " in the tablename
const origTableName = tablename.replace(/_/g, " ");
// Construct the new MenuDet object
const menuDet = {
menuId: menuId,
itemSeq: 8001,
main_menu_icon_name: tablename,
menuItemDesc: origTableName,
moduleName: tablename,
main_menu_action_name: tablename,
status: "Enable"
};
// Insert the new record into the sec_menu_det table
const insertQuery = `
INSERT INTO sec_menu_det
(menu_id, item_seq, main_menu_icon_name, menu_item_desc, module_name, main_menu_action_name, status)
VALUES (?, ?, ?, ?, ?, ?, ?)
`;
const result = await executeQuery(insertQuery, [
menuDet.menuId,
menuDet.itemSeq,
menuDet.main_menu_icon_name,
menuDet.menuItemDesc,
menuDet.moduleName,
menuDet.main_menu_action_name,
menuDet.status
]);
// Call the sync function (implement this based on your requirement)
await sync(menuId, { /* pass necessary params if needed */ });
// Return the inserted record or some indication of success
return result;
} catch (error) {
console.error("Error in customSecMenuAdd:", error);
throw error;
}
};
// Insert dashboard
const createDashboard = (req, res) => {
const body = req.body;
// Get current date and time in the format YYYY-MM-DD HH:MM:SS
const today = new Date();
const date =
today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate();
const time =
today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
const dateTime = date + " " + time;
// Step 1: Check if the entity already exists in builder_entity_t table
const existingEntityQuery = `SELECT * FROM builder_entity_t WHERE job_name = ? AND job_type = ?`;
pool.query(
existingEntityQuery,
[body.dashboard_name, "Dashboard"],
(err, existingEntity) => {
if (err) {
console.error("Error checking existing entity:", err);
return res.status(500).json({
success: 0,
message: "Error checking existing entity",
});
}
if (existingEntity.length > 0) {
console.log(`${body.dashboard_name} dashboard already exists`);
return res.status(409).json({
success: 0,
message: "Dashboard already exists",
});
}
// Step 2: Insert into dashbord_header
const insertHeaderQuery = `
INSERT INTO dashbord_header SET
created_at = ?,
updated_at = ?,
is_build = ?,
dashboard_name = ?,
description = ?,
menu_name = ?,
module_id = ?,
secuirity_profile = ?,
tech_stack = ?,
is_updated = ?,
object_type = ?,
sub_object_type = ?,
testing = ?
`;
const headerValues = [
dateTime,
dateTime,
body.is_build || null,
body.dashboard_name || null,
body.description || null,
body.menu_name || null,
body.module_id || 0, // Provide a default value for module_id
body.secuirity_profile || null,
body.tech_stack || null,
body.is_updated || null,
body.object_type || null,
body.sub_object_type || null,
body.testing || false,
];
pool.query(insertHeaderQuery, headerValues, (headerError, headerResults) => {
if (headerError) {
console.error("Error inserting dashboard header:", headerError);
return res.status(500).json({
success: 0,
message: "Failed to create dashboard",
});
}
if (!headerResults.insertId) {
return res.status(500).json({
success: 0,
message: "Failed to create dashboard",
});
}
const dashboardId = headerResults.insertId;
// Step 3: Insert into dashbord1_line
const insertLineQuery = `
INSERT INTO dashbord1_line SET
created_at = ?,
updated_at = ?,
model = ?,
header_id = ?,
dashbord_header_id = ?
`;
const lineValues = [
dateTime,
dateTime,
body.model || null, // Assuming 'model' is in the request body
body.header_id || null, // Assuming 'header_id' is in the request body
dashboardId,
];
pool.query(insertLineQuery, lineValues, (lineError, lineResults) => {
if (lineError) {
console.error("Error inserting dashboard line:", lineError);
// Optionally, rollback the previous dashboard_header insertion
return res.status(500).json({
success: 0,
message: "Failed to create dashboard and line",
});
}
// Return success response
return res.status(201).json({
success: 1,
message: "Dashboard and line created successfully",
});
});
});
}
);
};
// save report
const saveReport = (req, res) => {
const body = req.body;
// Get the current date and time
const today = new Date();
const date =
today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate();
const time =
today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
const dateTime = date + " " + time;
// Step 1: Check if the report with the given name already exists in builder_entity_t
const existingEntityQuery = `SELECT * FROM builder_entity_t WHERE job_name = ? AND job_type = ?`;
pool.query(
existingEntityQuery,
[body.reportName, "Report"],
(err, existingEntity) => {
if (err) {
console.error("Error checking existing report:", err);
return res.status(500).json({
success: 0,
message: "Error checking existing report",
});
}
if (existingEntity.length > 0) {
console.log(`${body.reportName} report already exists`);
return res.status(409).json({
success: 0,
message: "Report already exists",
});
}
// Step 2: Insert into rpt_builder2_t table
const insertReportQuery = `
INSERT INTO rpt_builder2_t SET
created_at = ?,
updated_at = ?,
report_name = ?,
description = ?,
is_sql = ?
`;
const reportValues = [
dateTime,
dateTime,
body.reportName || null,
body.description || null,
body.isSql || false, // Boolean field
];
pool.query(insertReportQuery, reportValues, (reportError, reportResults) => {
if (reportError) {
console.error("Error inserting report:", reportError);
return res.status(500).json({
success: 0,
message: "Failed to create report",
});
}
if (!reportResults.insertId) {
return res.status(500).json({
success: 0,
message: "Failed to create report",
});
}
const reportId = reportResults.insertId;
// Step 3: Insert into rpt_builder2_lines_t table
const insertLineQuery = `
INSERT INTO rpt_builder2_lines_t SET
created_at = ?,
updated_at = ?,
model = ?,
header_id = ?
`;
const lineValues = [
dateTime,
dateTime,
body.model || null, // Assuming 'model' is part of the request body
reportId,
];
pool.query(insertLineQuery, lineValues, (lineError, lineResults) => {
if (lineError) {
console.error("Error inserting report line:", lineError);
return res.status(500).json({
success: 0,
message: "Failed to create report and line",
});
}
// Step 4: Save the builder entity into builder_entity_t table
const saveEntityQuery = `
INSERT INTO builder_entity_t SET
job_name = ?,
job_type = ?
`;
pool.query(
saveEntityQuery,
[body.reportName, "Report"],
(entityError, entityResults) => {
if (entityError) {
console.error("Error saving builder entity:", entityError);
return res.status(500).json({
success: 0,
message: "Failed to save builder entity",
});
}
// Return success response after all operations
return res.status(201).json({
success: 1,
message: "Report and line created successfully",
});
}
);
});
});
}
);
};
// Sync
const sync = async (gmenuid, gr) => {
const list = [];
try {
// Step 1: Find MenuDet by gmenuid
const formenuQuery = `SELECT * FROM sec_menu_det WHERE menu_item_id = ?`;
const [formenu] = await executeQuery(formenuQuery, [gmenuid]);
if (!formenu) {
throw new Error(`MenuDet with id ${gmenuid} not found.`);
}
// Step 2: Get all GrpMenuAccess records for the found MenuDet
const grpMenuAccessQuery = `SELECT * FROM sec_grp_menu_access WHERE menu_item_id = ?`;
const all = await executeQuery(grpMenuAccessQuery, [formenu.menu_item_id]);
// Step 3: Update GrpMenuAccess records with data from MenuDet
for (let a of all) {
const updateQuery = `
UPDATE sec_grp_menu_access
SET item_seq = ?, menu_item_desc = ?, module_name = ?, status = ?, main_menu_action_name = ?, main_menu_icon_name = ?, menu_id = ?
WHERE id = ?
`;
await executeQuery(updateQuery, [
formenu.item_seq,
formenu.menu_item_desc,
formenu.module_name,
formenu.status,
formenu.main_menu_action_name,
formenu.main_menu_icon_name,
formenu.menu_id,
a.id
]);
// Add updated record to the list
list.push(a);
}
// Step 4: Find all submenus related to the given menu
const submenuQuery = `SELECT * FROM sec_menu_det WHERE menu_id = ?`;
const submenu = await executeQuery(submenuQuery, [gmenuid]);
// Step 5: Iterate through submenus and update or insert GrpMenuAccess records
for (let i = 0; i < submenu.length; i++) {
const m = submenu[i];
// Step 6: Find GrpMenuAccess for this submenu
const findAccessQuery = `SELECT * FROM sec_grp_menu_access WHERE menu_item_id = ?`;
const li = await executeQuery(findAccessQuery, [m.menu_item_id]);
if (li.length === 0) {
// Step 7: If no access found, insert new GrpMenuAccess records
const findGroupQuery = `SELECT * FROM sec_grp_menu_access WHERE menu_item_id = ?`;
const grp = await executeQuery(findGroupQuery, [gmenuid]);
for (let a of grp) {
const findRoleQuery = `SELECT * FROM sec_user_group WHERE usr_grp = ?`;
const app = await executeQuery(findRoleQuery, [a.usr_grp]);
// Set the fields in the GrpMenuAccess object
gr.usr_grp = app[0].usr_grp;
gr.menu_item_id = m.menu_item_id;
gr.item_seq = m.item_seq;
gr.menu_item_desc = m.menu_item_desc;
gr.module_name = m.module_name;
gr.status = m.status;
gr.main_menu_action_name = m.main_menu_action_name;
gr.main_menu_icon_name = m.main_menu_icon_name;
gr.menu_id = m.menu_id;
gr.m_create = "true";
gr.m_delete = "true";
gr.m_edit = "true";
gr.m_query = "true";
gr.m_visible = "true";
gr.is_disable = "true";
gr.m_export = "true";
gr.created_at = new Date();
gr.updated_at = new Date();
// Insert new GrpMenuAccess
const insertAccessQuery = `
INSERT INTO sec_grp_menu_access
(usr_grp, menu_item_id, item_seq, menu_item_desc, module_name, status, main_menu_action_name, main_menu_icon_name, menu_id, m_create, m_delete, m_edit, m_query, m_visible, is_disable, m_export, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`;
await executeQuery(insertAccessQuery, [
gr.usr_grp,
gr.menu_item_id,
gr.item_seq,
gr.menu_item_desc,
gr.module_name,
gr.status,
gr.main_menu_action_name,
gr.main_menu_icon_name,
gr.menu_id,
gr.m_create,
gr.m_delete,
gr.m_edit,
gr.m_query,
gr.m_visible,
gr.is_disable,
gr.m_export,
gr.created_at,
gr.updated_at,
]);
list.push(gr);
}
} else {
// Step 8: If access exists, update the records
for (let g of li) {
const updateAccessQuery = `
UPDATE sec_grp_menu_access
SET item_seq = ?, menu_item_desc = ?, module_name = ?, status = ?, main_menu_action_name = ?, main_menu_icon_name = ?, menu_id = ?
WHERE id = ?
`;
await executeQuery(updateAccessQuery, [
m.item_seq,
m.menu_item_desc,
m.module_name,
m.status,
m.main_menu_action_name,
m.main_menu_icon_name,
m.menu_id,
g.id
]);
list.push(g);
}
}
}
return list;
} catch (error) {
console.error("Error in sync:", error);
throw error;
}
};
module.exports = {
customSecMenuAdd,
createDashboard,
saveReport
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,389 @@
const { pool, db } = require("../config/database")
async function executeQuery(sql, values) {
const connection = await db.getConnection()
try {
const [rows] = await connection.execute(sql, values)
return rows
} finally {
connection.release()
}
}
// Create a new record
const createDataInTable = async (req, res) => {
const { tableName } = req.params
const { data } = req.body
const sql = `INSERT INTO ${tableName} SET ?`
try {
const result = await executeQuery(sql, data)
res.json({
message: "Record added successfully",
insertId: result.insertId,
})
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error adding record" })
}
}
// Get all records from a table
const getTable = async (req, res) => {
const { tableName } = req.params
const sql = `SELECT * FROM ${tableName}`
try {
const records = await executeQuery(sql)
res.json(records)
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error fetching records" })
}
}
// Get a record by ID
const getTableById = async (req, res) => {
const { tableName, id } = req.params
const sql = `SELECT * FROM ${tableName} WHERE id = ?`
const values = [id]
try {
const [record] = await executeQuery(sql, values)
if (!record) {
return res.status(404).json({ message: "Record not found" })
}
res.json(record)
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error fetching record" })
}
}
// Update a record by ID
const updateDataInTable = async (req, res) => {
const { tableName, id } = req.params
const body = req.body
const sql = `UPDATE ${tableName} SET ? WHERE id = ?`
const values = [
body.first_name,
body.last_name,
body.role,
body.email,
body.password,
body.number,
id,
]
try {
await executeQuery(sql, values)
res.json({ message: "Record updated successfully" })
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error updating record" })
}
}
// Delete a record by ID
const deleteDataInTable = async (req, res) => {
const { tableName, id } = req.params
const sql = `DELETE FROM ${tableName} WHERE id = ?`
const values = [id]
try {
await executeQuery(sql, values)
res.json({ message: "Record deleted successfully" })
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error deleting record" })
}
}
// Controllers for sec_menu_det and sec_grp_menu_access
const getTableByIdSec_Menu_Det = async (req, res) => {
const { id } = req.params
const sql = `SELECT * FROM sec_menu_det WHERE menu_item_id = ?`
const values = [id]
try {
const [record] = await executeQuery(sql, values)
if (!record) {
return res.status(404).json({ message: "Record not found" })
}
res.json(record)
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error fetching record" })
}
}
const addMenu = async (req, res) => {
const { id } = req.params
const sql = `SELECT * FROM sec_menu_det WHERE menu_item_id = ?`
const values = [id]
try {
const [record] = await executeQuery(sql, values)
if (!record) {
return res.status(404).json({ message: "Record not found" })
}
var today = new Date()
var date =
today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate()
var time =
today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds()
var dateTime = date + " " + time
const sqlIn = `INSERT INTO sec_grp_menu_access SET menu_item_id = ?, usr_grp = 41, created_at = ?, main_menu_action_name = ?, main_menu_icon_name = ?, menu_id = ?, menu_item_desc = ?, module_name = ?, status = ?, item_seq = ?, updated_at = ?, isdisable = 'true', m_create = 'true', m_delete = 'true', m_edit = 'true' , m_query = 'true', m_visible = 'true'`
const valuesIn = [
record.menu_item_id,
record.created_at,
record.main_menu_action_name,
record.main_menu_icon_name,
record.menu_id,
record.menu_item_desc,
record.module_name,
record.status,
record.item_seq,
dateTime,
]
try {
const [recordIn] = await executeQuery(sqlIn, valuesIn)
} catch (errorIn) {
console.error("inside", errorIn)
}
res.json(record)
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error fetching record Outside" })
}
}
const deleteMenu = async (req, res) => {
const { id } = req.params
const sql = `DELETE FROM sec_grp_menu_access WHERE menu_item_id = ?`
const values = [id]
try {
await executeQuery(sql, values)
res.json({ message: "Record deleted successfully" })
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error deleting record" })
}
}
const updateMenu = async (req, res) => {
const { id } = req.params
const data = req.body
var today = new Date()
var date =
today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate()
var time =
today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds()
var dateTime = date + " " + time
const sql = `UPDATE sec_grp_menu_access SET usr_grp = 41, main_menu_action_name = ?, main_menu_icon_name = ?, menu_id = ?, menu_item_desc = ?, module_name = ?, status = ?, updated_at = ? WHERE menu_item_id = ?, isdisable = ?, item_seq= = ?, m_create= = ?, m_delete= = ?, m_edit= = ? , m_query= = ?, m_visible= = ?,`
const values = [
data.main_menu_action_name,
data.main_menu_icon_name,
data.menu_id,
data.menu_item_desc,
data.module_name,
data.status,
dateTime,
id,
data.isdisable,
data.m_create,
data.m_delete,
data.m_edit,
data.m_query,
data.m_visible,
]
try {
await executeQuery(sql, values)
res.json({ message: "Record updated successfully" })
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error updating record" })
}
}
// Controller for Role table get and get id works from default one
const createDataInTableRole = async (req, res) => {
const data = req.body
const sql = `INSERT INTO role SET description = ?, name = ?`
const values = [data.description, data.name]
try {
const result = await executeQuery(sql, values)
res.json({
message: "Record added successfully",
insertId: result.insertId,
})
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error adding record" })
}
}
// Update a record by ID
const updateDataInTableRole = async (req, res) => {
const { id } = req.params
const body = req.body
const sql = `UPDATE role SET description = ?, name = ? WHERE id = ?`
const values = [body.description, body.name, id]
try {
await executeQuery(sql, values)
res.json({ message: "Record updated successfully" })
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error updating record" })
}
}
// Delete a record by ID
const deleteDataInTableRole = async (req, res) => {
const { id } = req.params
const sql = `DELETE FROM role WHERE id = ?`
const values = [id]
try {
await executeQuery(sql, values)
res.json({ message: "Record deleted successfully" })
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error deleting record" })
}
}
// CRUD for student table
// Create a new record
const createDataInStudentTable = async (req, res) => {
const data = req.body
const sql = `INSERT INTO student SET username = ?, password = ?, email = ?, full_name = ?, date_of_birth = ?, gender = ?, address = ?, department = ?`
const values = [
data.username,
data.password,
data.email,
data.full_name,
data.date_of_birth,
data.gender,
data.address,
data.department,
]
try {
const result = await executeQuery(sql, values)
res.json({
message: "Record added successfully",
insertId: result.insertId,
})
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error adding record" })
}
}
// Get all records from a table
const getStudentTable = async (req, res) => {
const sql = `SELECT * FROM student`
try {
const records = await executeQuery(sql)
res.json(records)
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error fetching records" })
}
}
// Get a record by ID
const getStudentTableById = async (req, res) => {
const { id } = req.params
const sql = `SELECT * FROM student WHERE id = ?`
const values = [id]
try {
const [record] = await executeQuery(sql, values)
if (!record) {
return res.status(404).json({ message: "Record not found" })
}
res.json(record)
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error fetching record" })
}
}
// Update a record by ID
const updateDataInStudentTable = async (req, res) => {
const { id } = req.params
const data = req.body
const sql = `UPDATE student SET username = ?, password = ?, email = ?, full_name = ?, date_of_birth = ?, gender = ?, address = ?, department = ? WHERE id = ?`
const values = [
data.username,
data.password,
data.email,
data.full_name,
data.date_of_birth,
data.gender,
data.address,
data.department,
id,
]
try {
await executeQuery(sql, values)
res.json({ message: "Record updated successfully" })
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error updating record" })
}
}
// Delete a record by ID
const deleteDataInStudentTable = async (req, res) => {
const sql = `DELETE FROM student WHERE id = ?`
const values = [id]
try {
await executeQuery(sql, values)
res.json({ message: "Record deleted successfully" })
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error deleting record" })
}
}
module.exports = {
getTable,
getTableById,
createDataInTable,
updateDataInTable,
deleteDataInTable,
addMenu,
deleteMenu,
updateMenu,
getTableByIdSec_Menu_Det,
createDataInTableRole,
updateDataInTableRole,
deleteDataInTableRole,
createDataInStudentTable,
getStudentTable,
getStudentTableById,
updateDataInStudentTable,
deleteDataInStudentTable,
}

View File

@ -0,0 +1,68 @@
[
{
"menu_item_id": 1527,
"usr_grp": 1,
"createby": null,
"created_at": "2023-02-10T04:37:57.000Z",
"isdisable": "true",
"item_seq": 1000,
"m_create": "true",
"m_delete": "true",
"m_edit": "true",
"m_query": "true",
"m_visible": "true",
"main_menu_action_name": "incidents",
"main_menu_icon_name": "incident",
"menu_id": 0,
"menu_item_desc": "Incidents",
"mexport": "true",
"module_name": "I1000",
"status": "Enable",
"updateby": null,
"updated_at": "2023-02-10T04:37:57.000Z"
},
{
"menu_item_id": 1116,
"usr_grp": 1,
"createby": null,
"created_at": "2023-02-04T12:02:03.000Z",
"isdisable": "true",
"item_seq": 3000,
"m_create": "true",
"m_delete": "true",
"m_edit": "true",
"m_query": "true",
"m_visible": "true",
"main_menu_action_name": "security",
"main_menu_icon_name": "lock",
"menu_id": 0,
"menu_item_desc": "Security",
"mexport": "true",
"module_name": "sec3000",
"status": "Enable",
"updateby": null,
"updated_at": "2023-02-04T12:02:03.000Z"
},
{
"menu_item_id": 1542,
"usr_grp": 1,
"createby": null,
"created_at": "2023-02-16T05:31:03.000Z",
"isdisable": "true",
"item_seq": 4000,
"m_create": "true",
"m_delete": "true",
"m_edit": "true",
"m_query": "true",
"m_visible": "true",
"main_menu_action_name": "admin",
"main_menu_icon_name": "user",
"menu_id": 0,
"menu_item_desc": "Admin",
"mexport": "true",
"module_name": "se4000",
"status": "Enable",
"updateby": null,
"updated_at": "2023-02-16T05:31:03.000Z"
}
]

View File

@ -0,0 +1,176 @@
const { pool, db } = require("../config/database")
const { genSaltSync, hashSync, compareSync } = require("bcrypt")
const { sign } = require("jsonwebtoken")
const bcrypt = require("bcrypt")
const otpGenerator = require("otp-generator")
const nodemailer = require("nodemailer")
const transporter = nodemailer.createTransport({
service: "gmail", // e.g., 'Gmail'
host: process.env.NODEMAILER_HOST,
port: process.env.NODEMAILER_PORT,
secure: false,
auth: {
user: process.env.NODEMAILER_USER,
pass: process.env.NODEMAILER_PASSWORD,
},
})
async function executeQuery(sql, values) {
const connection = await pool.getConnection()
try {
const [rows] = await connection.execute(sql, values)
return rows
} finally {
connection.release()
}
}
// path = /addOneAppUser
// const registerOld = async (req, res) => {
// const { email } = req.body
// try {
// const rows = await pool.execute("SELECT * FROM sec_users WHERE email = ?", [
// email,
// ])
// if (rows.length > 0) {
// return res.status(400).json({ message: "Email already exists" })
// }
// // Generate and save OTP
// const otp = Math.floor(1000 + Math.random() * 9000).toString()
// const result = await pool.execute(
// "INSERT INTO sec_users (email, password1) VALUES (?, ?)",
// [email, otp]
// )
// if (result) {
// // Send OTP via email
// const mailOptions = {
// from: "example.com",
// to: email,
// subject: "OTP for registration",
// text: `Your OTP is: ${otp}`,
// }
// transporter.sendMail(mailOptions, (error) => {
// if (error) {
// console.log(error)
// return res.status(500).json({ message: "Error sending OTP" })
// }
// return res.status(200).json({ message: "OTP sent successfully" })
// })
// } else {
// return res.status(500).json({ message: "Failed to create user" })
// }
// } catch (error) {
// console.error(error)
// res.status(400).json({ message: "Some error occured" })
// }
// }
var count = 0
const register = async (req, res) => {
const body = req.body
// console.log(email)
try {
let sql = `SELECT * FROM sec_users WHERE email = ?`
const rows = await executeQuery(sql, [body.email])
if (rows.length > 0) {
return res.status(400).json({ message: "Email already exists" })
}
count++
// Generate and save OTP
const otp = Math.floor(1000 + Math.random() * 9000).toString()
let user_id = 10007589 + count
const password = bcrypt.hashSync(body.user_passw, 10)
let sql2 = `INSERT INTO sec_users (email, random_no, user_id, user_name, full_name, user_passw, change_passw, first_name, country, is_blocked, is_complete, active) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
const result = await executeQuery(sql2, [
body.email,
otp,
user_id,
body.user_name,
body.full_name,
password,
body.change_passw,
body.first_name,
body.country,
false,
true,
true,
])
if (result) {
// Send OTP via email
const mailOptions = {
from: "example.com",
to: body.email,
subject: "OTP for registration",
text: `Your OTP is: ${otp}`,
}
transporter.sendMail(mailOptions, (error) => {
if (error) {
console.log(error)
return res.status(500).json({ message: "Error sending OTP" })
}
return res.status(200).json({ message: "OTP sent successfully" })
})
} else {
return res.status(500).json({ message: "Failed to create user" })
}
} catch (error) {
console.error(error)
res.status(400).json({ message: "Some error occured" })
}
}
const verifyOTP = async (req, res) => {
const { email, otp } = req.body
try {
let sql = `SELECT * FROM sec_users WHERE email = ?`
const rows = await executeQuery(sql, [email])
if (rows.length === 0) {
return res.status(400).json({ message: "User not found" })
}
const user = rows[0]
if (user.random_no === otp) {
// OTP is valid, you can update the user's status to verified or perform any necessary actions.
// For example: Update the 'is_complete' field to true.
let updateSql = `UPDATE sec_users SET status = ? WHERE email = ?`
await executeQuery(updateSql, [true, email])
return res.status(200).json({ message: "OTP verified successfully" })
} else {
return res.status(400).json({ message: "Invalid OTP" })
}
} catch (error) {
console.error(error)
res.status(500).json({ message: "Error verifying OTP" })
}
}
const deleteUser = async (req, res) => {
const email = req.body.email
const sql = `SELECT * FROM sec_users WHERE email = ?`
const rows = await executeQuery(sql, [email])
if (rows.length === 0) {
return res.status(400).json({ message: "User not found" })
} else {
const sql2 = `DELETE FROM sec_users WHERE email = ?`
const result = await executeQuery(sql2, [email])
res
.status(200)
.json({ message: `User with ${email} deleted successfully...!!! ` })
}
}
module.exports = {
register,
verifyOTP,
deleteUser,
}

View File

@ -0,0 +1,52 @@
global.__rootdir = __dirname
require("dotenv").config()
const express = require("express")
const app = express()
const bodyParser = require("body-parser")
const router = require("./routes/cns.router")
const userRouter = require("./routes/user.routes")
const cors = require("cors")
app.use(express.json())
// Set the base path from the .env file
const basePath = process.env.BASE_PATH || "/"
app.base = basePath
// app.use("/api/tables/v1", router)
// app.use("/api/users/v1", userRouter)
// app.use("", router)
// app.use("", userRouter)
app.use(
cors({
origin: "*",
})
)
router.use(function (req, res, next) {
console.log("%s %s %s", req.method, req.url, req.path)
next()
})
app.use(`${basePath}`, router)
app.use(`${basePath}`, userRouter)
app.use(bodyParser.json())
// buildercomponents
const port = process.env.PORT || 9292
app.get(`${basePath}/test`, (req, res) => {
res.json({
success: 1,
message: "This is hello from auth backend",
})
})
app.listen(port, () => {
console.log(`Server is up and running on port ${port}`)
})

View File

@ -0,0 +1,28 @@
const { verify } = require("jsonwebtoken")
const checkToken = async (req, res, next) => {
let token = req.get("authorization")
if (token) {
token = token.slice(7)
verify(token, "secret", (err, decoded) => {
if (err) {
console.log(err)
res.json({
success: 0,
message: "Invalid token",
})
} else {
next()
}
})
} else {
res.json({
success: 0,
message: "Access denied unauthorized user",
})
}
}
module.exports = {
checkToken,
}

View File

@ -0,0 +1,25 @@
const mysql = require("mysql2")
const mysqlProm = require("mysql2/promise")
const pool = mysql.createConnection({
host: process.env.DATABASE_HOST,
port: process.env.DATABASE_PORT,
database: process.env.DATABASE_NAME,
user: process.env.DATABASE_USERNAME,
password: process.env.DATABASE_PASSWORD,
})
const db = mysqlProm.createPool({
host: process.env.DATABASE_HOST,
port: process.env.DATABASE_PORT,
database: process.env.DATABASE_NAME,
user: process.env.DATABASE_USERNAME,
password: process.env.DATABASE_PASSWORD,
})
pool.connect(function (err) {
if (err) throw err
console.log("Connected!")
})
module.exports = { pool, db }

View File

@ -0,0 +1,32 @@
#!/bin/bash
sudo yum -y install node
sudo yum -y install git
sudo yum -y install docker
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $USER
newgrp docker
git clone https://github.com/rajeev-007-glitch/Task-Manager-API.git
cd Task-Manager-API
echo "MONGO_URI=mongodb+srv://RajeevSinghJadon:MongoDb@nodeandexpressprojects.ocu9ube.mongodb.net/TASK-MANAGER?retryWrites=true&w=majority" >> .env
echo "FROM node:18
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm ci --omit=dev
# Bundle app source
COPY . .
EXPOSE 3000
CMD [ "node", "app.js" ]" >> Dockerfile
echo "node_modules
npm-debug.log" >> .dockerignore
docker build . -t rajeev/node-web-app
docker run -p 49160:8080 -d rajeev/node-web-app

View File

@ -0,0 +1,109 @@
const { genSaltSync, hashSync, compareSync } = require("bcrypt")
const { sign } = require("jsonwebtoken")
const otpGenerator = require("otp-generator")
const nodemailer = require("nodemailer")
const bcrypt = require("bcrypt")
const { pool, db } = require("../config/database")
const fs = require("fs")
const path = require("path")
const { execArgv } = require("process")
const {
buildExtensionByFormCode,
} = require("../Functions/buildExtensionByFormCode")
const { exec } = require("child_process")
// const transporter = nodemailer.createTransport({
// host: "smtp.ethereal.email",
// port: 587,
// auth: {
// user: "maynard.skiles@ethereal.email",
// pass: "E36dmz2ceNJV5eFvC4",
// },
// })
const transporter = nodemailer.createTransport({
service: "gmail", // e.g., 'Gmail'
host: "smtp.gmail.com",
port: 587,
secure: false,
auth: {
user: "randomaff8@gmail.com",
pass: "fnnq tisa alvh uyre",
},
})
async function executeQuery(sql, values) {
const connection = await db.getConnection()
try {
const [rows] = await connection.execute(sql, values)
return rows
} finally {
connection.release()
}
}
const getAllUserNode = async (req, res) => {
try {
const sql = "SELECT name, email FROM users_node"
const result = await executeQuery(sql)
// Check if any data is fetched
if (result.length > 0) {
res.status(200).json({ users: result })
} else {
res.status(404).json({ message: "No users found" })
}
} catch (error) {
console.error("Error fetching users:", error)
res.status(500).json({ error: "Internal server error" })
}
}
const getByNameUserNode = async (req, res) => {
try {
const name = req.params.name
const sql = "SELECT name, email FROM users_node WHERE name = ?"
const result = await executeQuery(sql, [name])
// Check if any data is fetched
if (result.length > 0) {
res.status(200).json({ users: result })
} else {
res.status(404).json({ message: "No users found" })
}
} catch (error) {
console.error("Error fetching users:", error)
res.status(500).json({ error: "Internal server error" })
}
}
const addUserUserNode = async (req, res) => {
const body = req.body
const email = body.email
const password = body.password
const name = body.name
try {
const sql =
"INSERT INTO users_node (name, password, email) VALUES (?, ?, ?)"
const values = [name, password, email]
const result = await executeQuery(sql, values)
// Check if the user was successfully added
if (result.affectedRows > 0) {
res.status(200).json({ message: "User added successfully" })
} else {
res.status(400).json({ message: "Failed to add user" })
}
} catch (error) {
console.error("Error adding user:", error)
res.status(500).json({ error: "Internal server error" })
}
}
module.exports = {
getAllUserNode,
addUserUserNode,
getByNameUserNode,
}

View File

@ -0,0 +1,3 @@
[Sat Jul 27 2024 16:12:53 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Jul 27 2024 16:12:53 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Sat Jul 27 2024 16:12:53 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser

View File

@ -0,0 +1,54 @@
[Tue Sep 03 2024 15:30:28 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Tue Sep 03 2024 15:30:28 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 03 2024 15:30:28 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 17:27:02 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 18:41:28 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 03 2024 18:41:29 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Tue Sep 03 2024 18:41:29 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 18:41:29 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 18:43:38 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 18:53:11 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 18:56:02 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 18:58:51 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 18:59:16 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:00:18 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:01:17 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:01:59 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:07:22 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:07:43 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 03 2024 19:07:43 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:07:43 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Tue Sep 03 2024 19:07:43 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 19:08:56 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:09:07 GMT+0530 (India Standard Time)] GET /baseurl/token/logout
[Tue Sep 03 2024 19:09:22 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 03 2024 19:09:22 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Tue Sep 03 2024 19:09:22 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:10:48 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:12:21 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:15:32 GMT+0530 (India Standard Time)] GET /baseurl/token/logout
[Tue Sep 03 2024 19:15:41 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 03 2024 19:15:41 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Tue Sep 03 2024 19:15:41 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:18:43 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 19:18:47 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 03 2024 19:18:50 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 19:19:00 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 19:19:04 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 19:19:09 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 03 2024 19:19:11 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 19:19:18 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 03 2024 19:19:18 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 03 2024 19:19:27 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 19:19:45 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 03 2024 19:19:55 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 19:20:54 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 19:29:19 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 19:29:25 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 03 2024 19:31:04 GMT+0530 (India Standard Time)] GET /baseurl/api/user-profile
[Tue Sep 03 2024 19:31:04 GMT+0530 (India Standard Time)] GET /baseurl/api/retrieve-image
[Tue Sep 03 2024 19:31:42 GMT+0530 (India Standard Time)] POST /baseurl/api/reset_password
[Tue Sep 03 2024 19:32:17 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 03 2024 19:32:17 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 03 2024 19:32:17 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Tue Sep 03 2024 19:32:35 GMT+0530 (India Standard Time)] POST /baseurl/api/reset_password

View File

@ -0,0 +1,46 @@
[Wed Sep 04 2024 12:34:32 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Wed Sep 04 2024 12:36:35 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Wed Sep 04 2024 12:36:51 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Wed Sep 04 2024 12:36:51 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 12:36:51 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Wed Sep 04 2024 12:37:06 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Wed Sep 04 2024 12:38:37 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllAppUser
[Wed Sep 04 2024 12:38:43 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Wed Sep 04 2024 12:38:44 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Wed Sep 04 2024 12:38:51 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Wed Sep 04 2024 12:38:53 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1
[Wed Sep 04 2024 12:39:50 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Wed Sep 04 2024 12:39:51 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Wed Sep 04 2024 15:29:36 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Wed Sep 04 2024 15:29:47 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Wed Sep 04 2024 15:29:48 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Wed Sep 04 2024 15:29:48 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 15:29:53 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Wed Sep 04 2024 15:33:21 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 15:33:39 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Wed Sep 04 2024 15:33:39 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 15:33:39 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Wed Sep 04 2024 15:33:40 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Wed Sep 04 2024 15:38:05 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 15:38:19 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Wed Sep 04 2024 15:38:19 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Wed Sep 04 2024 15:38:19 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 15:38:20 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Wed Sep 04 2024 15:47:03 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 15:47:36 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 15:47:51 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Wed Sep 04 2024 15:47:51 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Wed Sep 04 2024 15:47:51 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 15:47:51 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Wed Sep 04 2024 15:49:08 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 15:49:30 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 15:50:49 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 15:51:02 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Wed Sep 04 2024 15:51:03 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Wed Sep 04 2024 15:51:03 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 17:32:27 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Wed Sep 04 2024 17:32:27 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Wed Sep 04 2024 17:32:27 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 17:32:54 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Wed Sep 04 2024 17:32:54 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Wed Sep 04 2024 17:32:54 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu

View File

@ -0,0 +1,58 @@
[Sat Sep 07 2024 18:48:36 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 18:48:36 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Sat Sep 07 2024 18:48:36 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Sat Sep 07 2024 18:49:06 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Sat Sep 07 2024 18:49:12 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 18:49:12 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 18:49:21 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 18:49:34 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 18:57:11 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 18:57:46 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2/1
[Sat Sep 07 2024 19:02:56 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2/1
[Sat Sep 07 2024 19:03:03 GMT+0530 (India Standard Time)] POST /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:04:02 GMT+0530 (India Standard Time)] POST /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:04:27 GMT+0530 (India Standard Time)] POST /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:04:28 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:04:45 GMT+0530 (India Standard Time)] POST /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:04:46 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:05:04 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:05:19 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:05:41 GMT+0530 (India Standard Time)] POST /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:05:41 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:05:48 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:06:22 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:06:34 GMT+0530 (India Standard Time)] POST /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:06:35 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:09:49 GMT+0530 (India Standard Time)] POST /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:09:50 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:12:08 GMT+0530 (India Standard Time)] POST /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:12:09 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:12:35 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:15:53 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:16:01 GMT+0530 (India Standard Time)] POST /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:16:01 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:17:38 GMT+0530 (India Standard Time)] POST /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:17:39 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:18:02 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:18:22 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:18:30 GMT+0530 (India Standard Time)] POST /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:18:31 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:18:45 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:18:54 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:19:16 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:25:45 GMT+0530 (India Standard Time)] GET /baseurl/get_Dashboard_header
[Sat Sep 07 2024 19:25:59 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:25:59 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Sat Sep 07 2024 19:26:01 GMT+0530 (India Standard Time)] GET /baseurl/get_Dashboard_header
[Sat Sep 07 2024 19:26:07 GMT+0530 (India Standard Time)] GET /baseurl/get_Dashboard_header
[Sat Sep 07 2024 19:26:22 GMT+0530 (India Standard Time)] POST /baseurl/Savedata
[Sat Sep 07 2024 19:26:23 GMT+0530 (India Standard Time)] GET /baseurl/get_Dashboard_header
[Sat Sep 07 2024 19:26:42 GMT+0530 (India Standard Time)] GET /baseurl/get_Dashboard_header
[Sat Sep 07 2024 19:26:46 GMT+0530 (India Standard Time)] GET /baseurl/get_Dashboard_header
[Sat Sep 07 2024 19:26:48 GMT+0530 (India Standard Time)] GET /baseurl/get_Dashboard_header
[Sat Sep 07 2024 19:27:22 GMT+0530 (India Standard Time)] POST /baseurl/Savedata
[Sat Sep 07 2024 19:27:22 GMT+0530 (India Standard Time)] GET /baseurl/get_Dashboard_header
[Sat Sep 07 2024 19:30:07 GMT+0530 (India Standard Time)] POST /baseurl/Savedata
[Sat Sep 07 2024 19:30:08 GMT+0530 (India Standard Time)] GET /baseurl/get_Dashboard_header
[Sat Sep 07 2024 19:30:37 GMT+0530 (India Standard Time)] POST /baseurl/Savedata
[Sat Sep 07 2024 19:30:38 GMT+0530 (India Standard Time)] GET /baseurl/get_Dashboard_header

View File

@ -0,0 +1,54 @@
[Tue Sep 10 2024 12:40:10 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 10 2024 12:40:10 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 10 2024 12:40:10 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Tue Sep 10 2024 12:40:10 GMT+0530 (India Standard Time)] GET /baseurl/get_Dashboard_header
[Tue Sep 10 2024 12:40:16 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 10 2024 12:40:20 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/1
[Tue Sep 10 2024 12:40:20 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 12:40:23 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 10 2024 12:40:27 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1
[Tue Sep 10 2024 12:40:33 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 10 2024 12:40:35 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 12:40:35 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/1
[Tue Sep 10 2024 12:40:50 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 10 2024 12:40:55 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 12:40:55 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/1
[Tue Sep 10 2024 12:41:45 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 10 2024 12:41:45 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Tue Sep 10 2024 12:41:45 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 10 2024 12:41:45 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 12:41:45 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/1
[Tue Sep 10 2024 12:42:07 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 10 2024 12:42:15 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 12:42:15 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/1
[Tue Sep 10 2024 12:44:26 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 12:55:23 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 12:55:28 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 12:56:18 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 12:57:56 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 13:00:11 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 13:00:26 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 13:03:43 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 13:04:44 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 13:08:44 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 13:08:53 GMT+0530 (India Standard Time)] GET /baseurl/api1/submenu1/1116
[Tue Sep 10 2024 13:08:55 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/1
[Tue Sep 10 2024 13:08:55 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 13:09:04 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/41
[Tue Sep 10 2024 13:09:30 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/41
[Tue Sep 10 2024 13:26:15 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/41
[Tue Sep 10 2024 13:26:37 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/41
[Tue Sep 10 2024 13:29:51 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/41
[Tue Sep 10 2024 13:30:04 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/41
[Tue Sep 10 2024 13:33:38 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/41
[Tue Sep 10 2024 13:33:46 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/41
[Tue Sep 10 2024 13:38:17 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/41
[Tue Sep 10 2024 13:39:23 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/41
[Tue Sep 10 2024 13:39:30 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/41
[Tue Sep 10 2024 13:39:48 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/61
[Tue Sep 10 2024 13:40:04 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/1
[Tue Sep 10 2024 13:40:13 GMT+0530 (India Standard Time)] GET /baseurl/Rpt_builder2/Rpt_builder2
[Tue Sep 10 2024 13:40:13 GMT+0530 (India Standard Time)] GET /baseurl/api/realnet-menu/user-menu
[Tue Sep 10 2024 13:40:13 GMT+0530 (India Standard Time)] GET /baseurl/fndMenu/menuloadbyuser
[Tue Sep 10 2024 13:40:13 GMT+0530 (India Standard Time)] GET /baseurl/api/getAllUsrGrp
[Tue Sep 10 2024 13:40:13 GMT+0530 (India Standard Time)] GET /baseurl/api1/getusracces1/1

View File

@ -0,0 +1,38 @@
const { verify } = require("jsonwebtoken")
// Middleware for verifying JWT and extracting user information
function authenticateJWT(req, res, next) {
let token = req.headers.authorization
// console.log("Authorization header:", req.headers.authorization)
// console.log("token is..",token);
console.log("Database Host:", process.env.DATABASE_HOST);
console.log("Database User:", process.env.DATABASE_USERNAME);
console.log("Database Port:", process.env.DATABASE_PORT);
if (!token || !token.startsWith("Bearer ")) {
return res.sendStatus(403)
}
// console.log("Original token:", token)
// Remove the "Bearer " prefix
token = token.slice(7)
// console.log("Modified token:", token)
const secret = "secret" // Use the same secret key as in the login controller
verify(token, secret, (err, user) => {
if (err) {
console.log(err)
return res.sendStatus(403)
}
req.user = user // Attach user information to the request object
next()
})
}
module.exports = { authenticateJWT }

View File

@ -0,0 +1,7 @@
// uploadMiddleware.js
const multer = require("multer")
const storage = multer.memoryStorage()
const upload = multer({ storage: storage })
module.exports = upload.single("imageFile")

View File

@ -0,0 +1,31 @@
const fs = require("fs")
const path = require("path")
function userLogger(req, res, next) {
const { user_id, user_name, email } = req.user
// Create a directory for the user if it doesn't exist
const userDir = path.join(__dirname, "../logs", user_name)
if (!fs.existsSync(userDir)) {
fs.mkdirSync(userDir, { recursive: true })
}
// Create a log file with the current date
const currentDate = new Date().toISOString().slice(0, 10) // Get YYYY-MM-DD format
const logFile = path.join(userDir, `${currentDate}.log`)
// Log data to the console
console.log(`[${user_name}] Request to ${req.originalUrl}`)
// Log data to the user-specific log file
const logMessage = `[${new Date()}] ${req.method} ${req.originalUrl}\n`
fs.appendFile(logFile, logMessage, (err) => {
if (err) {
console.error(`Failed to log data to ${logFile}: ${err}`)
}
})
next()
}
module.exports = userLogger

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
{
"name": "expressjs",
"version": "1.0.0",
"description": "CRUD for fetching two fields",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon --ext js,env --watch .env --watch . app.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.1.1",
"body-parser": "^1.20.2",
"cors": "^2.8.5",
"crypto": "^1.0.1",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"jsonwebtoken": "^9.0.2",
"multer": "^1.4.5-lts.1",
"mysql2": "^3.6.1",
"nodemailer": "^6.9.5",
"nodemon": "^3.0.1",
"otp-generator": "^4.0.1",
"util": "^0.12.5",
"uuid": "^9.0.1"
}
}

View File

@ -0,0 +1,365 @@
const {
login,
getUsersUserGrpMaintenance,
getUsersByUserIdUserGrpMaintenance,
updateUsersUserGrpMaintenance,
createUsersUserGrpMaintenance,
deleteUsersUserGrpMaintenance,
getUsersMenuMaintainence,
getUsersByUserIdMenuMaintainence,
createUsersMenuMaintainence,
updateUsersMenuMaintainence,
deleteUsersMenuMaintainence,
getUsersByIdSubMenuMaintainence,
createUsersMenuAccessControl,
getUsersMenuAccessControl,
getUserMaintainence,
getByIdUserMaintainence,
createUserMaintainence,
updateUserMaintainence,
loadMenuByUser,
userMenu,
createReport,
getAllReportBuilder,
getAllReportBuilderById,
getAllReportBuilderByQuery,
updateReportBuilder,
deleteReportBuilder,
getReportLine,
getReportLineById,
updateReportLine,
getAllDashboard,
getDashboardByModuleId,
getAllDashboardHeaderById,
createDashboard,
updateDashboard,
deleteDashboard,
getDashboardLine,
getDashboardLineById,
updateDashboardLineById,
getSystemParameterById,
getSystemParameter,
createSystemParameter,
updateSystemParameter,
deleteSystemParameter,
getLogs,
getAllFormExtension,
getByIdFormExtension,
createFormExtension,
updateFormExtension,
deleteFormExtension,
buildExtension,
logout,
sendEmailForResetPassword,
resetPassword,
savePassword,
getLoggedInUser,
uploadProfilePhoto,
retrieveProfilePhoto,
test,
} = require("../api/cns.controller")
const {
getAllUserNode,
addUserUserNode,
getByNameUserNode,
} = require("../listBuilder/controller")
// const { checkToken } = require("../auth/token_validation")
const { authenticateJWT } = require("../middleware/authenticateJWT")
const userLogger = require("../middleware/userLogger")
const uploadMiddleware = require("../middleware/uploadMiddleware")
const router = require("express").Router()
router.get("/test/:id", test)
router.post("/token/session", login)
router.post("/api/resources/forgotpassword", sendEmailForResetPassword)
router.post("/api/resources/savePassword/:token", savePassword)
router.post("/api/reset_password", authenticateJWT, userLogger, resetPassword)
router.get("/api/user-profile", authenticateJWT, userLogger, getLoggedInUser)
router.put(
"/api/user-profile",
authenticateJWT,
userLogger,
updateUserMaintainence
)
// profile photo upload and retrieve
router
.post(
"/api/upload",
authenticateJWT,
userLogger,
uploadMiddleware,
uploadProfilePhoto
)
.get("/api/retrieve-image", authenticateJWT, userLogger, retrieveProfilePhoto)
router.get("/token/logout", authenticateJWT, userLogger, logout)
// Api for sec user group
router
.get(
"/api/getAllUsrGrp",
authenticateJWT,
userLogger,
getUsersUserGrpMaintenance
)
// .get(
// "/api1/getusracces1/:id",
// authenticateJWT,
// userLogger,
// getUsersByUserIdUserGrpMaintenance
// )
.put(
"/api/updateOneUsrGrp/:id",
authenticateJWT,
userLogger,
updateUsersUserGrpMaintenance
)
.post(
"/api/addOneUsrGrp",
authenticateJWT,
userLogger,
createUsersUserGrpMaintenance
)
.delete(
"/api/delete_usrgrp/:id",
authenticateJWT,
userLogger,
deleteUsersUserGrpMaintenance
)
router
.get("/api1/submenu1", authenticateJWT, userLogger, getUsersMenuMaintainence)
.get(
"/api1/getusracces1/:id",
authenticateJWT,
userLogger,
getUsersByUserIdMenuMaintainence
)
.post(
"/api1/Sec_menuDet",
authenticateJWT,
userLogger,
createUsersMenuMaintainence
)
.put(
"/api1/submenu1/:id",
authenticateJWT,
userLogger,
updateUsersMenuMaintainence
)
.delete(
"/api1/menu/:id",
authenticateJWT,
userLogger,
deleteUsersMenuMaintainence
)
// // Report Builder Controller
router
.post(
"/Rpt_builder2/Rpt_builder2",
authenticateJWT,
userLogger,
createReport
)
router
.get(
"/Rpt_builder2/Rpt_builder2",
authenticateJWT,
userLogger,
getAllReportBuilder
)
.get(
"/Rpt_builder2/Rpt_builder2/:id",
authenticateJWT,
userLogger,
getAllReportBuilderById
)
.get(
"/api/master-query-data/:query",
authenticateJWT,
userLogger,
getAllReportBuilderByQuery
)
.put(
"/Rpt_builder2/Rpt_builder2/:id",
authenticateJWT,
userLogger,
updateReportBuilder
)
.delete(
"/Rpt_builder2/Rpt_builder2/:id",
authenticateJWT,
userLogger,
deleteReportBuilder
)
// // Report Line Controller
router
.get(
"/Rpt_builder2_lines/Rpt_builder2_lines",
authenticateJWT,
userLogger,
getReportLine
)
.get(
"/Rpt_builder2_lines/Rpt_builder2_lines/:id",
authenticateJWT,
userLogger,
getReportLineById
)
.put(
"/Rpt_builder2_lines/update/:id",
authenticateJWT,
userLogger,
updateReportLine
)
// // Dashboard Controller
router
.get("/get_Dashboard_header", authenticateJWT, userLogger, getAllDashboard)
.get("/get_module_id", authenticateJWT, userLogger, getDashboardByModuleId)
.get(
"/get_dashboard_headerbyid/:id",
authenticateJWT,
userLogger,
getAllDashboardHeaderById
)
.post("/Savedata", authenticateJWT, userLogger, createDashboard)
.put(
"/update_dashboard_header/:id",
authenticateJWT,
userLogger,
updateDashboard
)
.delete(
"/delete_by_header_id/:id",
authenticateJWT,
userLogger,
deleteDashboard
)
// // Dashboard Line Controller
router
.get("/get_Dashboard1_line", authenticateJWT, userLogger, getDashboardLine)
.get(
"/get_dashboard_headerbyid/:id",
authenticateJWT,
userLogger,
getDashboardLineById
)
.put(
"/update_Dashbord1_Lineby_id/:id",
authenticateJWT,
userLogger,
updateDashboardLineById
)
// // System Parameter router
router
.get(
"/sysparam/getSysParams",
authenticateJWT,
userLogger,
getSystemParameter
)
.get(
"/sysparam/getSysParams/:id",
authenticateJWT,
userLogger,
getSystemParameterById
)
.post(
"/sysparam/addSysParams",
authenticateJWT,
userLogger,
createSystemParameter
)
.put(
"/sysparam/updateSysParams/:id",
authenticateJWT,
userLogger,
updateSystemParameter
)
.delete(
"/sysparam/deleteSysParams/:id",
authenticateJWT,
userLogger,
deleteSystemParameter
)
// // Form extension router
router
.get("/api/extension", authenticateJWT, userLogger, getAllFormExtension)
.get("/api/extension/:id", authenticateJWT, userLogger, getByIdFormExtension)
.get("/extension_build/:formId", authenticateJWT, userLogger, buildExtension)
.post("/api/extension/", authenticateJWT, userLogger, createFormExtension)
.put("/api/extension/:id", authenticateJWT, userLogger, updateFormExtension)
.delete(
"/api/extension/:id",
authenticateJWT,
userLogger,
deleteFormExtension
)
//// User Node Table router
router
.get("/user/node", authenticateJWT, userLogger, getAllUserNode)
.get("/user/node/:name", authenticateJWT, userLogger, getByNameUserNode)
.post("/user/node", authenticateJWT, userLogger, addUserUserNode)
router.get(
"/api1/submenu1/:id",
authenticateJWT,
userLogger,
getUsersByIdSubMenuMaintainence
)
// api for sec group menu access
router
.get(
"/api/getAllUsrGrp",
authenticateJWT,
userLogger,
getUsersMenuAccessControl
)
.post(
"/api1/addgrpwithsubmenu/:id",
authenticateJWT,
userLogger,
createUsersMenuAccessControl
)
router
.get("/api/getAllAppUser", authenticateJWT, userLogger, getUserMaintainence)
.get(
"/api/getOneAppUser/:id",
authenticateJWT,
userLogger,
getByIdUserMaintainence
)
.post("/api/addOneAppUser", createUserMaintainence)
router.get(
"/fndMenu/menuloadbyuser",
authenticateJWT,
userLogger,
loadMenuByUser
)
router.get("/api/realnet-menu/user-menu", authenticateJWT, userLogger, userMenu)
router.get("/getLogs/:userName", authenticateJWT, userLogger, getLogs)
module.exports = router

View File

@ -0,0 +1,46 @@
const {
getTable,
getTableById,
getTableByIdSec_Menu_Det,
createDataInTable,
updateDataInTable,
deleteDataInTable,
addMenu,
deleteMenu,
updateMenu,
createDataInTableRole,
updateDataInTableRole,
deleteDataInTableRole,
createDataInStudentTable,
getStudentTable,
getStudentTableById,
updateDataInStudentTable,
deleteDataInStudentTable,
} = require("../api/controller")
const { checkToken } = require("../auth/token_validation")
const router = require("express").Router()
router
.get("/student", checkToken, getStudentTable)
.get("/student/:id", checkToken, getStudentTableById)
.post("/student", checkToken, createDataInStudentTable)
.patch("/student/:id", checkToken, updateDataInStudentTable)
.delete("/student:id", checkToken, deleteDataInStudentTable)
.post("/role", checkToken, createDataInTableRole)
.patch("/role/:id", checkToken, updateDataInTableRole)
.delete("/role/:id", checkToken, deleteDataInTableRole)
.post("/:id", checkToken, addMenu)
.delete("/:id", checkToken, deleteMenu)
.patch("/:id", checkToken, updateMenu)
router
.get("/sec_menu_det/:id", checkToken, getTableByIdSec_Menu_Det)
.get("/sec_grp_menu_access/:id", checkToken, getTableByIdSec_Menu_Det)
.get("/:tableName/:id", checkToken, getTableById)
.patch("/:tableName/:id", checkToken, updateDataInTable)
.delete("/:tableName/:id", checkToken, deleteDataInTable)
router
.get("/:tableName", checkToken, getTable)
.post("/:tableName", checkToken, createDataInTable)
module.exports = router

View File

@ -0,0 +1,31 @@
const {
getUsers,
getUsersByUserId,
updateUsers,
deleteUsers,
login,
registerUser,
verifyOTP,
} = require("../api/user.controller")
const { checkToken } = require("../auth/token_validation")
const router = require("express").Router()
// router.get("/", checkToken, getUsers)
// router
// .get("/:id", checkToken, getUsersByUserId)
// .patch("/:id", checkToken, updateUsers)
// .delete("/:id", checkToken, deleteUsers)
// router.post("/login", login)
// router.post("/register", registerUser).post("/verify", verifyOTP)
router.get("/", checkToken, getUsers)
router
.get("/:id", checkToken, getUsersByUserId)
.patch("/:id", checkToken, updateUsers)
.delete("/:id", checkToken, deleteUsers)
router.post("/token/session", login)
// router.post("/login", login)
router.post("/register", registerUser).post("/verify", verifyOTP)
module.exports = router

View File

@ -0,0 +1,11 @@
const { register, verifyOTP, deleteUser } = require("../api/user.controller")
const { checkToken } = require("../auth/token_validation")
const router = require("express").Router()
router
.post("/addOneAppUser", register)
.post("/verify", verifyOTP)
.delete("/deleteUser", deleteUser)
module.exports = router

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
frontend/.DS_Store
.DS_Store

View File

@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
[*.md]
max_line_length = off
trim_trailing_whitespace = false

View File

@ -0,0 +1,17 @@
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run a one-line script
run: echo Hello, world!
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.

View File

@ -0,0 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db

View File

@ -0,0 +1,52 @@
# Angular-Clarity
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.0.4 [Angular.io](https://angular.io/) version 16.0.4 and [Clarity Design System](https://vmware.github.io/clarity/news) by VMware version 6.4.5/15.5.0
## Install
- clone project `git clone https://github.com/superpck/angular-clarity`
- goto project folder `cd angular-clarity`
- install necessary package `npm install`
- Fix some vulnerabilities (if founded) `npm audit fix --force`
- Run application with command `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
- or Run `ng serve --port 8080 --open` with another port and open web browser.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
- Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
- or `ng build --base-href ./ --prod --output-hashing none`
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
## Screenshot
About Page
![About](1.png)
Login Page
![Datagrid](6.png)
Datagrid
![Datagrid](2.png)
Datagrid expand row and single action
![expand](3.png)
Modal
![modal](4.png)
sweetalert2
![sweetalert2](5.png)

View File

@ -0,0 +1,21 @@
# Security Policy
## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |
## Reporting a Vulnerability
Use this section to tell people how to report a vulnerability.
Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.

View File

@ -0,0 +1,134 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angularclarity": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"allowedCommonJsDependencies": [
"lodash", "xlsx", "file-saver","@swimlane/ngx-datatable","@swimlane/ngx-charts","jquery","highcharts","chart.js",
"clone-deep","@ckeditor/ckeditor5-build-classic","@ctrl/ngx-codemirror"
],
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/@clr/icons/clr-icons.min.css",
"node_modules/@clr/ui/clr-ui.min.css",
"src/styles.scss",
"node_modules/ngx-toastr/toastr.css"
],
"scripts": [
"node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js",
"node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js",
"node_modules/@clr/icons/clr-icons.min.js"
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "10mb",
"maximumError": "10mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "200kb",
"maximumError": "4mb"
}
]
}
},
"defaultConfiguration": ""
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "angularclarity:build"
},
"configurations": {
"production": {
"browserTarget": "angularclarity:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angularclarity:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "angularclarity:serve"
},
"configurations": {
"production": {
"devServerTarget": "angularclarity:serve:production"
}
}
}
}
}
},
"cli": {
"analytics": "6e7a3b23-d894-47dd-8b4b-7fdeba9a5abd"
}
}

View File

@ -0,0 +1,12 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

View File

@ -0,0 +1,32 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};

View File

@ -0,0 +1,23 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('angularclarity app is running!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});

View File

@ -0,0 +1,11 @@
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo(): Promise<unknown> {
return browser.get(browser.baseUrl) as Promise<unknown>;
}
getTitleText(): Promise<string> {
return element(by.css('app-root .content span')).getText() as Promise<string>;
}
}

View File

@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

View File

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/ang'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,87 @@
{
"name": "angular-clarity",
"version": "16.0.4",
"subVersion": "2023.06.02-01",
"scripts": {
"ng": "ng",
"start": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng serve --port 4201 -o",
"start:https": "ng serve --port 4201 --ssl -o",
"build-prod": "node --max_old_space_size=64384 ./node_modules/@angular/cli/bin/ng build --prod ",
"build": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --base-href ./ --configuration production --aot --build-optimizer",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^16.0.4",
"@angular/cdk": "^16.2.4",
"@angular/common": "^16.0.4",
"@angular/compiler": "^16.0.4",
"@angular/core": "^16.0.4",
"@angular/forms": "^16.0.4",
"@angular/platform-browser": "^16.0.4",
"@angular/platform-browser-dynamic": "^16.0.4",
"@angular/router": "^16.0.4",
"@auth0/angular-jwt": "^5.1.2",
"@cds/core": "^6.9.0",
"@ckeditor/ckeditor5-angular": "^7.0.1",
"@ckeditor/ckeditor5-build-classic": "^40.0.0",
"@clr/angular": "^15.5.0",
"@clr/core": "^4.0.15",
"@clr/icons": "^13.0.2",
"@clr/ui": "^15.5.0",
"@ctrl/ngx-codemirror": "^7.0.0",
"@swimlane/ngx-charts": "^20.4.1",
"@webcomponents/custom-elements": "^1.6.0",
"@webcomponents/webcomponentsjs": "^2.8.0",
"angular-gridster2": "^16.0.0",
"angularx-qrcode": "^16.0.2",
"chart.js": "^4.4.0",
"dom-to-image": "^2.6.0",
"express": "^4.18.2",
"file-saver": "^2.0.5",
"highcharts": "^11.1.0",
"highcharts-angular": "^3.1.2",
"jquery": "^3.7.1",
"jspdf": "^2.5.1",
"jszip": "^3.10.1",
"lit-html": "^3.1.0",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"ng-dynamic-component": "^10.1.1",
"ng2-charts": "^5.0.3",
"ng2-ckeditor": "^1.3.7",
"ng2-search-filter": "^0.5.1",
"ngx-captcha": "^13.0.0",
"ngx-chips": "^3.0.0",
"ngx-cookie-service": "^16.0.0",
"ngx-drag-drop": "^16.1.0",
"ngx-image-cropper": "^7.0.2",
"ngx-toastr": "^17.0.2",
"numeral": "^2.0.6",
"rxjs": "^7.8.1",
"sweetalert2": "^11.4.8",
"tslib": "^2.5.2",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.19.3/xlsx-0.19.3.tgz",
"zone.js": "~0.13.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.0.4",
"@angular/cli": "^16.0.4",
"@angular/compiler-cli": "^16.0.4",
"@types/jasmine": "~4.3.2",
"@types/jasminewd2": "~2.0.10",
"@types/node": "^20.2.5",
"jasmine-core": "~5.0.0",
"jasmine-spec-reporter": "~7.0.0",
"karma": "~6.4.2",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.0.0",
"ts-node": "^10.9.1",
"tslint": "~6.1.3",
"typescript": "^5.1.0"
}
}

View File

@ -0,0 +1,42 @@
import { Injectable } from '@angular/core';
import{environment} from 'src/environments/environment';
/**
* This is a singleton class
*/
@Injectable()
export class AppConfig {
//Provide all the Application Configs here
public version: string = "1.0.0";
public locale: string = "en-US";
public currencyFormat = { style: "currency", currency: "USD" };
public dateFormat = { year: 'numeric', month: 'short', day: 'numeric' };
// port in enviroment
// API Related configs
public apiPort: string; // this.apiURL //9191 to pc used and 8080/billingback to jboss
public apiProtocol: string;
public apiHostName: string;
public baseApiPath: string;
public backendURL: string = environment.backendUrl;
constructor() {
if (this.apiProtocol === undefined) {
this.apiProtocol = window.location.protocol;
}
if (this.apiHostName === undefined) {
this.apiHostName = window.location.hostname;
}
if (this.apiPort === undefined) {
this.apiPort = window.location.port;
}
if (this.apiHostName.includes("infomud") || this.apiHostName.includes("heroku")) {
this.baseApiPath = this.apiProtocol + "//" + this.apiHostName + "/";
}
else {
this.baseApiPath = this.backendURL + "/";
}
if (this.locale === undefined) {
this.locale = navigator.language;
}
}
}

View File

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [
{path: '', redirectTo: 'login', pathMatch: 'full'}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }

View File

@ -0,0 +1 @@
<router-outlet></router-outlet>

View File

@ -0,0 +1,35 @@
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'angularclarity'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('angularclarity');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('angularclarity app is running!');
});
});

View File

@ -0,0 +1,10 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'angularclarity';
}

View File

@ -0,0 +1,79 @@
import { ExcelService } from './services/excel.service';
import { BrowserModule } from '@angular/platform-browser';
import { ToastrModule } from 'ngx-toastr';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ClarityModule } from '@clr/angular';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HashLocationStrategy, LocationStrategy } from '@angular/common';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { MainModule } from './modules/main/main.module';
import { LoginModule } from './modules/login/login.module';
import { MainService } from './services/main.service';
import { AlertService } from './services/alert.service';
import { HelperModule } from './pipes/helpers.module';
import { LogoComponent } from './modules/logo/logo.component';
import { AppConfig } from './app-config';
import { JwtInterceptor } from './services/jwt.interceptor';
import { UserInfoService } from './services/user-info.service';
import { AuthGuard } from './services/auth_guard.service';
import { LoginService } from './services/api/login.service';
import { ApiRequestService } from './services/api/api-request.service';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import {CUSTOM_ELEMENTS_SCHEMA, NgModule } from "@angular/core";
import { TranslateService } from './services/api/translate.service';
import { RealnetMenuService } from './services/api/realnet-menu.service';
import { UserProfileService } from './services/admin/user-profile.service';
import { DragDropModule } from '@angular/cdk/drag-drop';
import '@clr/icons';
import '@clr/icons/shapes/all-shapes';
@NgModule({
declarations: [
AppComponent,
LogoComponent,
],
imports: [
BrowserModule,
AppRoutingModule,
ClarityModule,
HttpClientModule,
BrowserAnimationsModule,
ToastrModule.forRoot(),
HelperModule,
MainModule,
LoginModule,
FormsModule,
ReactiveFormsModule,
DragDropModule,
],
providers: [
MainService,
AlertService,
ExcelService,
UserInfoService,
LoginService,
ApiRequestService,
TranslateService,
RealnetMenuService,
UserProfileService,
// ProjectSetupService,
// TechnologyStackService,
// DropdownService,
// WireframeService,
// SuregitService,
AuthGuard,
AppConfig,
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
{ provide: LocationStrategy, useClass: HashLocationStrategy } // HashLocationStrategy to use # and remove # PathLocationStrategy
],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA ]
})
export class AppModule { }

View File

@ -0,0 +1,169 @@
export class field{
_id?:any;
name?:any;
type?:any;
icon?:any;
toggle?:any;
required?:any;
regex?:any;
errorText?:any;
label?:any;
description?:any;
placeholder?:any;
className?:any;
subtype?:any;
handle?:any;
min?:number;
max?:number;
inline?:any;
value?:any;
size?:any;
values?:Array<value>;
div_name?:any;
gridLine_name?:any;
children?: field[];
tooltipmsg?:any;
maxcharacters?:any;
visibilty?:any;
duplicateVal?:any;
encryptData?:any;
personalHealthInfo?:any;
descriptionText?:any;
heightpx?:any;
showDescription?:boolean;
personalInfo?:boolean;
readOnly?:any;
sessionVar?:any;
allowedDays?:any;
allowedHrsFrom?:any;
allowedHrsTo?:any;
showSeconds?:boolean;
datePicker?:any;
alphabeticalOrdering?:boolean;
fieldLayout?:any;
otherChoice?:boolean;
dynamicList?:any;
iconType?:any;
target?:any;
defaultCamera?:any;
imgoption?:Array<value>;
questions?:Array<value1>;
maxDuration?:any;
maxNo?:number;
decimalPlaces?:number;
currencyType?:any;
formatNo?:any;
providersData?:any;
apikey?:any;
expanded?:boolean;
files?:Array<any>;
password?:any;
content?:any;
theme?:any;
norows?:number;
nocolumns?:number;
editordata?:any;
}
export class value{
label?:any="";
value?:any="";
}
export class value1{
label1?:any="";
value1?:any="";
}
export interface IProperty {
url?: string;
loading?: boolean;
itemsPerPage?: number;
total?: number;
p?: number;
sizeLimit?: number;
title?: string;
text?: string;
items?: any[];
sub?: any;
isBlocked?: boolean;
isDeleted?: boolean;
isEmailVerified?: string;
successMsg?: string;
msg?: string;
userId?: string;
status?: number;
userPlaceholder?: string;
searchKey?: string;
fullName?: string;
email?: string;
countryCode?: string;
dialCode?: string;
phoneNumber?: string;
value?: Date;
data?: any;
name_es?: string;
name_en?: string;
countries?: any;
states?: any;
cities?: any;
countries1?: any;
states1?: any;
cities1?: any;
countries2?: any;
states2?: any;
cities2?: any;
localities?: any;
buildings?: any;
country_id?: string;
state_id?: string;
city_id?: string;
locality_id?: string;
building_id?: string;
countryCount?: number;
stateCount?: number;
cityCount?: number;
stateCityCount?: number;
localityCount?: number;
buildingCount?: number;
countriesAdd?: any;
statesAdd?: any;
citiesAdd?: any;
localitiesAdd?: any;
country_idAdd?: string;
state_idAdd?: string;
city_idAdd?: string;
locality_idAdd?: string;
countryCountAdd?: number;
stateCountAdd?: number;
cityCountAdd?: number;
localityCountAdd?: number;
successText?: string;
propertyTypes?: any;
propertyTypesCount?: number;
amenities?: any;
amenitiesCount?: number;
projectTypes?: any;
projectTypesCount?: number;
routeName?: string;
icon?: any;
userType?: string;
overlay?: any;
is_broker_seller_dev?: number;
is_buyer_renter?: number;
is_broker?: number;
is_data_collector?: number;
image?: any;
index?: number;
name?: string;
phone?: string;
type?: number;
property_id?: string;
banks?: any;
bankCount?: string;
flag?: number;
page?: number;
property_for?: any;
status_id?:any;
type_id?:any;
post_type?:any;
developer_id?:any;
}

View File

@ -0,0 +1,4 @@
export enum Role {
// User = 'User',
Admin = 'Admin'
}

View File

@ -0,0 +1,30 @@
export class Systemparameter{
public schedulerTime: number;
public leaseTaxCode: String;
public vesselConfProcessLimit: number;
public rowToDisplay: any;
public linkToDisplay: any;
public rowToAdd: any;
public lovRowToDisplay:any;
public lovLinkToDisplay: any;
public oidserverName: any;
public oidBase: any;
public oidAdminUser: any;
public oidServerPort: any;
public userDefaultGroup: any;
public defaultDepartment: any;
public defaultPosition: any;
public singleCharge: any;
public firstDayOftheWeek:any;
public hourPerShift: any;
public cnBillingFrequency: any;
public billingDepartmentCode: any;
public basePriceList: any;
public nonContainerServiceOrder: any;
public ediMaeSchedulerONOFF: any;
public ediSchedulerONOFF: any;
public company_Display_Name:any;
public upload_Logo:any;
}

View File

@ -0,0 +1,14 @@
export class User {
public id: number;
public name: string;
public gender: string;
public dob: string;
public email: string;
public picture:Blob;
public location:string;
public address1:string;
public country:string;
public phone:number;
}

View File

@ -0,0 +1,12 @@
export class userdepartment{
public departmentCode:String;
public active:String;
public description:String;
public createdOn:Date;
public createdBy:String;
public updatedOn:Date;
public updatedBy:String;
public id:number;
}

View File

@ -0,0 +1,10 @@
export class Usergrpmain {
public usrGrp: number;
public groupName:string;
public groupDesc:string;
public createby:string;
public createdate:Date;
public groupLevel:string;
public status:string;
}

View File

@ -0,0 +1,38 @@
import { userdepartment } from "./userdepartment";
import { userposition } from "./userposition";
export class Usermain {
public userId: number;
public changePassw:string;
public confirmPassword:string;
public createby:string;
public createdate:Date;
public customerId:number;
public customerNumer:String;
public departmentCode:string;
public departmentCodeString:string;
public email:string;
public firstLogin:String;
public fullName:String;
public langCode: String;
public notification:String;
public password1: String;
public password2: String;
public password3: String;
public password4: String;
public positionCodeString:String;
public pwdChangedCnt:string;
public shortName: string;
public status:string;
public updateby:string;
public updatedate:Date;
public username: string;
public userPassw: string;
public usrGrpId:number;
public title: string;
public expiryDate: Date;
public lastPwdChangedDate:Date;
}

View File

@ -0,0 +1,9 @@
export class userposition{
public positionCode:String;
public active:String;
public description:String;
public createdOn:Date;
public createdBy:String;
public updatedOn:Date;
public updatedBy:String;
}

View File

@ -0,0 +1,4 @@
export interface ActiveTechnology {
id;
name;
}

View File

@ -0,0 +1,13 @@
export class AdhocParam{
public id: number;
public table_allias_name: string;
public column_name: string;
public column_allias_name: string;
}

View File

@ -0,0 +1,9 @@
export class Audit {
public accountId: number;
public createdAt: Date;
public createdBy: string;
public updatedAt: Date;
public updatedBy: string;
}

View File

@ -0,0 +1,9 @@
import { Audit } from "./Audit";
export class Bcf_TechnologyStack extends Audit {
public id: number;
public tech_stack: string;
public tech_stack_key: string;
public tags: string;
public base_prj_file_name: string;
public active: boolean;
}

View File

@ -0,0 +1,4 @@
export interface ColumnList {
// id: number;
table_name: string;
}

View File

@ -0,0 +1,11 @@
export class DateParam{
public date_id: number;
public col_table_alies_name_date: string;
public col_date_query: string;
public column_alias_date_query: string;
}

View File

@ -0,0 +1,10 @@
export interface FileData {
id: number;
text: string;
/* public id: number;
public text: string; */
/* constructor(id: number, text: string) {
this.id = id;
this.text = text;
} */
}

View File

@ -0,0 +1,4 @@
export interface FileDetails {
id: number;
text: string;
}

View File

@ -0,0 +1,14 @@
import { Audit } from "./Audit";
import { ProjectSetup } from "./Project_setup";
import { Rn_Fb_Header } from "./Rn_Fb_Header";
export class ModuleSetup extends Audit {
public id: number;
public moduleName: string;
public description: string;
public modulePrefix: string;
public copyTo?: string;
public technologyStack: string;
public project: ProjectSetup;
public rn_fb_headers: Rn_Fb_Header[];
}

View File

@ -0,0 +1,22 @@
import { Audit } from "./Audit";
import { ModuleSetup } from "./Module_Setup";
export class ProjectSetup extends Audit {
public id: number;
public projectName: string;
public description: string;
public copyTo?: string;
public technologyStack: string;
public techStackId: number;
public projectPrefix: string;
public dbName: string;
public dbUserName: string;
public dbPassword: string;
public portNumber: string;
public namespace: string;
public tags:string;
public category:string;
public accessibility:boolean;
public modules: ModuleSetup[];
}

View File

@ -0,0 +1,12 @@
export class RbColumns{
public id: number;
public column_name: string;
public functions: string;
public column_allias_name: string;
public table_allies_name: string;
public asc_desc: string;
}

View File

@ -0,0 +1,7 @@
export class RbTables{
public table_id: number;
public table_name: string;
public table_allias_name: string;
}

View File

@ -0,0 +1,8 @@
export class ReportBuilder {
public report_id: number;
public report_name:string;
public description: string;
public report_tags: string;
public servicename:string;
}

View File

@ -0,0 +1,4 @@
export class ReportBuilderQuery {
public master_select: string;
}

View File

@ -0,0 +1,14 @@
import { Audit } from "./Audit";
import { Rn_Cff_ActionBuilder_Line } from "./Rn_Cff_ActionBuilder_Line";
import { Rn_Fb_Header } from "./Rn_Fb_Header";
export class Rn_Cff_ActionBuilder_Header extends Audit {
public id: number;
public rn_fb_header: Rn_Fb_Header;
public technologyStack: string;
public controllerName: string;
public methodName: string;
public actionName: string;
public fileLocation: string;
public actionBuilderLines: Rn_Cff_ActionBuilder_Line[];
}

View File

@ -0,0 +1,18 @@
import { Audit } from "./Audit";
import { Rn_Cff_ActionBuilder_Header } from "./Rn_Cff_ActionBuilder_Header";
export class Rn_Cff_ActionBuilder_Line extends Audit {
public id: number;
public actionType1: string;
public actionType2: string;
public dataType: string;
public variableName: string;
public assignment: string;
public message: string;
public conditions: string;
public forward: string;
public equation: string;
public seq: number;
public action: string;
public rn_cff_actionBuilderHeader: Rn_Cff_ActionBuilder_Header;
}

View File

@ -0,0 +1,22 @@
import { Audit } from "./Audit";
import { Rn_Fb_Lines } from "./Rn_Fb_Lines";
export class Rn_Fb_Header extends Audit {
public id: number;
public techStack: string;
public objectType: string;
public subObjectType: string;
public uiName: string;
public formType: string;
public tableName: string;
public lineTableName: string;
public multilineTableName: string;
public formCode: string;
public build: boolean;
public updated: boolean;
public menuName: string;
public headerName: string;
public convertedTableName: string;
public rn_fb_lines: Rn_Fb_Lines[];
}

View File

@ -0,0 +1,49 @@
import { Audit } from "./Audit";
export class Rn_Fb_Lines extends Audit {
public id: number;
public fieldName: string;
public mapping: string;
public dataType: string;
public formCode: string;
public key1: string;
public type1: string;
public mandatory: boolean;
public hidden: boolean;
public readonly: boolean;
public dependent: boolean;
public dependent_on: string;
public dependent_sp: string;
public dependent_sp_param: string;
public validation_1: boolean;
public val_type: string;
public val_sp: string;
public val_sp_param: string;
public sequence: boolean;
public seq_name: string;
public seq_sp: string;
public seq_sp_param: string;
public default_1: boolean;
public default_type: string;
public default_value: string;
public default_sp: string;
public default_sp_param: string;
public calculated_field: boolean;
public cal_sp: string;
public cal_sp_param: string;
public add_to_grid: boolean;
public sp_for_autocomplete: boolean;
public sp_name_for_autocomplete: string;
public sp_for_dropdown: boolean;
public sp_name_for_dropdown: string;
public type_field: string;
public methodName: string;
public seq: number;
public form_type: string;
public section_num: number;
public button_num: string;
public type2: string;
public table_name?: string;
public line_table_name: string;
public line_table_no: number;
}

View File

@ -0,0 +1,17 @@
import { Audit } from "./Audit";
import { Rn_Sub_Menu } from './Rn_Sub_Menu';
export class Rn_Main_Menu extends Audit {
public menuItemId: number;
public menuItemDesc: string;
public mainMenuActionName : string;
public mainMenuIconName: string;
public menu_type: string;
public mcreate:String;
public mdelete:String;
public medit:String;
public menuId:Number;
public mquery:String;
public mvisible:String;
public subMenus: Rn_Sub_Menu[];
}

View File

@ -0,0 +1,16 @@
import { Audit } from "./Audit";
export class Rn_Sub_Menu extends Audit {
public menuItemId: number;
public menuItemDesc: string;
public mainMenuActionName : string;
public mainMenuIconName: string;
public menu_type: string;
public mcreate:String;
public mdelete:String;
public medit:String;
public menuId:Number;
public mquery:String;
public mvisible:String;
//public menu_icon: string;
}

View File

@ -0,0 +1,12 @@
export class StdParam{
public std_id: number;
public col_table_alies_name_std_para: string;
public col_std_para_query: string;
public field_type: string;
public sp_for_dd: string;
}

View File

@ -0,0 +1,14 @@
export class WhereParam{
public where_id: number;
public explecity: string;
public where_coloumn1_tbl_alias_name: string;
public where_coloumn: string;
public where_condition: string;
public switch_control: string;
public where_coloumn2_tbl_alias_name:string;
public where_coloumn2:string;
}

View File

@ -0,0 +1,29 @@
export interface WireFrame {
header: Header;
line: Line;
}
export interface Header {
section: Section[];
}
export interface Line {
section: Section[];
}
export interface Section {
id: number;
fieldName: string;
mapping: string;
dataType: string;
type_field: string;
section_num: number;
fields: Field[];
}
export interface Field {
id: number;
fieldName: string;
mapping: string;
dataType: string;
type_field: string;
section_num: number;
seq: number;
}

View File

@ -0,0 +1,114 @@
export interface WidgetModel {
name: string;
identifier: string;
}
export interface SubmenuItem {
name: string;
identifier: string;
}
export interface WidgetModel1 {
name: string;
submenu?: SubmenuItem[];
showSubmenu?: boolean; // Optional property to control submenu visibility
identifier: string;
}
export interface DashboardContentModel {
cols: number;
rows: number;
y: number;
x: number;
chartid: number;
component?: any;
name: string;
type?:string;
}
export interface DashboardModel {
id: number;
username: string;
dashboard: Array<DashboardContentModel>;
}
export interface DashboardContentModel2 {
cols: number;
rows: number;
y: number;
x: number;
chartid: number;
charttitle?: string;
component?: any;
name: string;
type?: string;
values?:Array<value>;
imgoption?:Array<value>;
keyValue?:string;
fieldtext?:any;
dropdown_type?:string;
imageURL?:string;
}
export interface DashboardModel2 {
id: number;
username: string;
dashboard: Array<DashboardContentModel2>;
}
export class value{
label?:any="";
value?:any="";
}
export class value1{
label1?:any="";
value1?:any="";
}
export const WidgetsMock: WidgetModel[] = [
{
name: 'Radar Chart',
identifier: 'radar_chart'
},
{
name: 'Doughnut Chart',
identifier: 'doughnut_chart'
},
{
name: 'Line Chart',
identifier: 'line_chart'
},
{
name: 'Bar Chart',
identifier: 'bar_chart'
},
{
name: 'Pie Chart',
identifier: 'pie_chart'
},
{
name: 'Polar Area Chart',
identifier: 'polar_area_chart'
},
{
name: 'Bubble Chart',
identifier: 'bubble_chart'
},
{
name: 'Scatter Chart',
identifier: 'scatter_chart'
},
{
name: 'Dynamic Chart',
identifier: 'dynamic_chart'
},
{
name: 'Financial Chart',
identifier: 'financial_chart'
},
{
name: 'To Do',
identifier: 'to_do_chart'
}
]

View File

@ -0,0 +1,9 @@
export class Gitfile {
public content :String;
public url :String;
public sha:String;
public encoding:String;
public size:String;
}

View File

@ -0,0 +1,14 @@
export class RptBuilder{
public id:number;
public name;
public folder: string;
public query: string;
public date_param_flag:boolean;
public adhoc_param_flag:boolean;
public adhoc_param_string: string;
public std_param_json: string;
}

View File

@ -0,0 +1,9 @@
export class Suregit {
public path :String;
public sha :String;
public url :String;
public type:Number;
public mode:String;
public size:String;
}

View File

@ -0,0 +1,9 @@
export class Surename {
public id :number;
public message :String;
public name :String;
public timestamp:Number;
public email:String;
public username:String;
public sha:any;
}

View File

@ -0,0 +1,9 @@
export class Surestar {
public id :number;
public email :String;
public watchers_count :number;
public forks_count:Number;
public stars_count:number;
public size:String;
}

View File

@ -0,0 +1,55 @@
export interface WidgetModel {
name: string;
identifier: string;
}
export interface DashboardContentModel {
cols: number;
rows: number;
y: number;
x: number;
chartid: number;
component?: any;
name: string;
}
export interface DashboardModel {
id: number;
username: string;
dashboard: Array<DashboardContentModel>;
}
export const WidgetsMock: WidgetModel[] = [
// {
// name: 'Text field',
// identifier: 'text_field'
// },
{
name: 'Text area',
identifier: 'text_area'
},
{
name: 'Table field',
identifier: 'table_field'
},
// {
// name: 'Background Color',
// identifier: 'background_color'
// },
// {
// name: 'Box field',
// identifier: 'box_field'
// },
{
name: 'Image field',
identifier: 'img_field'
},
{
name: 'Line field',
identifier: 'line_field'
},
{
name: 'QR code',
identifier: 'qr_code'
}
]

View File

@ -0,0 +1,10 @@
import { Audit } from "../builder/Audit";
export class Bcf_Exception_Rule_Library extends Audit {
id: number;
tech_stack: string;
object_type: string;
sub_object_type: string;
object_name_variable: string;
object_name_dynamic_string: string;
}

View File

@ -0,0 +1,17 @@
import { Audit } from "../builder/Audit";
import { Bcf_Extractor_Params } from "./Bcf_Extractor_Params";
export class Bcf_Extractor extends Audit {
id: number;
tech_stack: string;
tech_stack_key: string;
object_type: string;
sub_object_type: string;
form_type_name: string;
std_wf_name: string;
icon_file_name: string;
sample_file_name: string;
extractor_stage: string;
rn_bcf_extractor_Params: Bcf_Extractor_Params[];
}

View File

@ -0,0 +1,20 @@
import { Audit } from "../builder/Audit";
export class Bcf_Extractor_Params extends Audit {
id: number;
tech_stack: string;
object_type: string;
sub_object_type: string;
file_code: any;
name_string: string;
address_string: string;
moved_address_string: string;
reference_address_string: string;
description: string;
file_name_var: string;
file_name_dynamic_string: string;
is_extraction_enabled: boolean;
is_creation_enabled: boolean;
total_project_path_dynamic_string:string;
}

View File

@ -0,0 +1,16 @@
import { Audit } from "../builder/Audit";
export class Bcf_Rule_Library extends Audit {
id: number;
group_id: number;
rule_name: string;
tech_stack: string;
object_type: string;
sub_object_type: string;
file_code: string;
rule_type: string;
identifier_start_string: string;
identifier_end_string: string;
replacement_string: string;
}

View File

@ -0,0 +1,13 @@
import { BiDashLine } from './BiDashLine';
export class BiDashHeader{
public header_id: number;
public dashboard_name: string;
public components: BiDashLine[];
}

View File

@ -0,0 +1,17 @@
export class BiDashLine{
public section_type: string;
public widgets1: string;
public widgets2: string;
public widgets3: string;
public widgets4: string;
public widgets5: string;
public widgets6: string;
}

View File

@ -0,0 +1,10 @@
export class BiWidget {
public id: number;
public widget_name: string;
public widget_description: string;
public chart_type: string;
public sql_query:string;
public label:string;
public color_scheme:string;
}

Some files were not shown because too many files have changed in this diff Show More