fixed backend imports
This commit is contained in:
@ -3,7 +3,7 @@ import ownConn from "../dbConfig.js";
|
||||
//get all master maintenance visits
|
||||
export const getMasterMaintenanceVisits = async (result) => {
|
||||
try {
|
||||
let sql = `SELECT * FROM masterMaintenanceVisits ORDER BY name ASC`;
|
||||
let sql = `SELECT * FROM mastermaintenancevisits ORDER BY name ASC`;
|
||||
const results = await ownConn.execute(sql)
|
||||
result(null, results);
|
||||
}
|
||||
@ -17,7 +17,7 @@ export const getMasterMaintenanceVisits = async (result) => {
|
||||
//get all selected master maintenance visits by customer
|
||||
export const getSelectedMasterMaintenanceVisitsByCustomer = async (selected, result) => {
|
||||
try {
|
||||
let sql = `SELECT * FROM masterMaintenanceVisits WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
|
||||
let sql = `SELECT * FROM mastermaintenancevisits WHERE customer LIKE '%${selected}%' ORDER BY customer ASC`;
|
||||
const results = await ownConn.execute(sql)
|
||||
result(null, results);
|
||||
}
|
||||
@ -31,7 +31,7 @@ export const getSelectedMasterMaintenanceVisitsByCustomer = async (selected, res
|
||||
//get all selected master maintenance visits by checklistname
|
||||
export const getSelectedMasterMaintenanceVisitsByChecklistname = async (selected, result) => {
|
||||
try {
|
||||
let sql = `SELECT * FROM masterMaintenanceVisits WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
|
||||
let sql = `SELECT * FROM mastermaintenancevisits WHERE name LIKE '%${selected}%' ORDER BY name ASC`;
|
||||
const results = await ownConn.execute(sql)
|
||||
result(null, results);
|
||||
}
|
||||
@ -45,7 +45,7 @@ export const getSelectedMasterMaintenanceVisitsByChecklistname = async (selected
|
||||
//get single master maintenance visit
|
||||
export const getMasterMaintenanceVisitById = async (id, result) => {
|
||||
try {
|
||||
let sql = `SELECT * FROM masterMaintenanceVisits WHERE checklistID = ?`;
|
||||
let sql = `SELECT * FROM mastermaintenancevisits WHERE checklistID = ?`;
|
||||
const results = await ownConn.execute(sql, [id])
|
||||
result(null, results[0]);
|
||||
}
|
||||
@ -60,7 +60,7 @@ export const getMasterMaintenanceVisitById = async (id, result) => {
|
||||
export const updateMasterMaintenanceVisitById = async (data, result) => {
|
||||
try {
|
||||
const id = data.checklistID;
|
||||
let sql = `UPDATE masterMaintenanceVisits SET name = ?, customerID = ? , customer = ?, type = ?, lastView = ?, user = ?, notes = ? WHERE checklistID = ?`;
|
||||
let sql = `UPDATE mastermaintenancevisits SET name = ?, customerID = ? , customer = ?, type = ?, lastView = ?, user = ?, notes = ? WHERE checklistID = ?`;
|
||||
const results = await ownConn.query(sql, [data.name, data.customerID, data.customer, data.type, data.lastView, data.user, data.notes, id])
|
||||
result(null, results);
|
||||
}
|
||||
@ -74,7 +74,7 @@ export const updateMasterMaintenanceVisitById = async (data, result) => {
|
||||
//insert master maintenance visit to databased
|
||||
export const insertMasterMaintenanceVisit = async (data, result) => {
|
||||
try {
|
||||
const results = await ownConn.query(`INSERT INTO masterMaintenanceVisits(name, customerID, customer, type, lastView, user, notes) VALUES(?, ?, ?, ?, ?, ?, ?)`, [data.name, data.customerID, data.customer, data.type, data.lastView, data.user, data.notes])
|
||||
const results = await ownConn.query(`INSERT INTO mastermaintenancevisits(name, customerID, customer, type, lastView, user, notes) VALUES(?, ?, ?, ?, ?, ?, ?)`, [data.name, data.customerID, data.customer, data.type, data.lastView, data.user, data.notes])
|
||||
result(null, results);
|
||||
}
|
||||
catch (err) {
|
||||
@ -87,7 +87,7 @@ export const insertMasterMaintenanceVisit = async (data, result) => {
|
||||
// Delete master maintenance visit to Database
|
||||
export const deleteMasterMaintenanceVisitById = async (id, result) => {
|
||||
try {
|
||||
let sql = `DELETE FROM masterMaintenanceVisits WHERE checklistID = ?`;
|
||||
let sql = `DELETE FROM mastermaintenancevisits WHERE checklistID = ?`;
|
||||
const results = await ownConn.query(sql, [id])
|
||||
result(null, results);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user