Updated backend
This commit is contained in:
parent
577066c9ea
commit
28cea3241b
1 changed files with 17 additions and 17 deletions
|
|
@ -18,12 +18,12 @@ import (
|
|||
)
|
||||
|
||||
// DEV
|
||||
var connection string = "root:superuser@tcp(localhost:3306)/iips"
|
||||
var connectionPops string = "root:superuser@tcp(localhost:3306)/pops"
|
||||
// var connection string = "root:superuser@tcp(localhost:3306)/iips"
|
||||
// var connectionPops string = "root:superuser@tcp(localhost:3306)/pops"
|
||||
|
||||
// SERVER
|
||||
// var connection string = "iips:iipsuser@tcp(192.168.7.100:3306)/iips"
|
||||
// var connectionPops string = "pops:Pops2023!@tcp(192.168.76.10:3306)/pops"
|
||||
var connection string = "iips:iipsuser@tcp(192.168.7.100:3306)/iips"
|
||||
var connectionPops string = "pops:Pops2023!@tcp(192.168.76.10:3306)/pops"
|
||||
|
||||
func main() {
|
||||
connect()
|
||||
|
|
@ -44,23 +44,23 @@ func connect() {
|
|||
router.Use(cors.Default())
|
||||
|
||||
//DEV
|
||||
router.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"http://localhost:5173"},
|
||||
AllowMethods: []string{"GET", "POST"},
|
||||
AllowHeaders: []string{"Origin", "OCBO-ShieldConnection"},
|
||||
ExposeHeaders: []string{"Content-Length"},
|
||||
AllowCredentials: true,
|
||||
}))
|
||||
|
||||
//SERVER
|
||||
// router.Use(cors.New(cors.Config{
|
||||
// AllowAllOrigins: true,
|
||||
// AllowOrigins: []string{"http://localhost:5173"},
|
||||
// AllowMethods: []string{"GET", "POST"},
|
||||
// AllowHeaders: []string{"Origin"},
|
||||
// AllowHeaders: []string{"Origin", "OCBO-ShieldConnection"},
|
||||
// ExposeHeaders: []string{"Content-Length"},
|
||||
// AllowCredentials: true,
|
||||
// }))
|
||||
|
||||
//SERVER
|
||||
router.Use(cors.New(cors.Config{
|
||||
AllowAllOrigins: true,
|
||||
AllowMethods: []string{"GET", "POST"},
|
||||
AllowHeaders: []string{"Origin"},
|
||||
ExposeHeaders: []string{"Content-Length"},
|
||||
AllowCredentials: true,
|
||||
}))
|
||||
|
||||
router.StaticFile("/", "static/index.html")
|
||||
|
||||
// shield := "inquiry"
|
||||
|
|
@ -612,8 +612,8 @@ func connect() {
|
|||
array11 := []string{}
|
||||
array12 := []string{}
|
||||
|
||||
results, err := db.Query(`SELECT IFNULL(e.electricalNo, '') AS result, IFNULL(c.firstName, '') AS result2, IFNULL(c.middleInitial, '') AS result3, IFNULL(c.lastName, '') AS result4, IFNULL(e.locationofinstallation, '') AS result5, IFNULL(re.type, '') AS result6, IFNULL(em.employeename, '') AS result7, IFNULL(rb.accountdescription, '') AS result8, IFNULL(o.amount, '') AS result9, IFNULL(o.opDate, '') AS result10, IFNULL(e.electricalid, 0) AS result11, IFNULL(o.assessedbyid, 0) AS result12
|
||||
FROM electrical e, customer c, electrical_orderofpayment_new o, ref_electrical_type re, ref_bldgcomputationsheet rb, employee em WHERE e.customerid = c.customerid AND e.electricalid = o.electricalid AND e.ref_electrical_typeid = re.ref_electrical_typeid AND o.ref_bldgcomputationsheetid = rb.ref_bldgcomputationsheetid AND o.assessedbyid = em.employeeid AND e.electricalNo = ?`, data)
|
||||
results, err := db.Query(`SELECT IFNULL(e.electricalNo, '') AS result, IFNULL(c.firstName, '') AS result2, IFNULL(c.middleInitial, '') AS result3, IFNULL(c.lastName, '') AS result4, IFNULL(e.locationofinstallation, '') AS result5, IFNULL(re.occupancyoruse, '') AS result6, IFNULL(em.employeename, '') AS result7, IFNULL(rb.accountdescription, '') AS result8, IFNULL(o.amount, '') AS result9, IFNULL(o.opDate, '') AS result10, IFNULL(e.electricalid, 0) AS result11, IFNULL(o.assessedbyid, 0) AS result12
|
||||
FROM electrical e, customer c, electrical_orderofpayment_new o, ref_elec_occupancy re, ref_bldgcomputationsheet rb, employee em WHERE e.customerid = c.customerid AND e.electricalid = o.electricalid AND e.ref_elec_occupancyid = re.ref_elec_occupancyid AND o.ref_bldgcomputationsheetid = rb.ref_bldgcomputationsheetid AND o.assessedbyid = em.employeeid AND e.electricalNo = ?`, data)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue