Company now works

This commit is contained in:
2024-11-04 07:35:24 +01:00
parent ddebbad1c8
commit 51b0641702
12 changed files with 498 additions and 10 deletions

52
db/basicProfile.go Normal file
View File

@@ -0,0 +1,52 @@
package db
type BasicProfile struct {
CompanyId int
Employees string
Revenue string
Applications string
Compliance string
Industry string
ITDependency string
DataSensitivity string
DataVolume string
NetworkSegmentation string
LegacySystems string
IoTIntegration string
RemoteWork string
BYOD string
VPN string
API string
VendorAccess string
InternalDev string
}
// InsertBasicProfile inserts a new record into the BasicProfile table
func InsertBasicProfile(profile BasicProfile) (int, error) {
query := `
INSERT INTO BasicProfile (
CompanyId, Employees, Revenue, Applications, Compliance, Industry, ITDependency, DataSensitivity, DataVolume,
NetworkSegmentation, LegacySystems, IoTIntegration, RemoteWork, BYOD, VPN, API, VendorAccess, InternalDev
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id
`
stmt, err := db.Prepare(query)
if err != nil {
return -2, err
}
defer stmt.Close()
id := 0
err = stmt.QueryRow(
profile.CompanyId, profile.Employees, profile.Revenue, profile.Applications, profile.Compliance, profile.Industry,
profile.ITDependency, profile.DataSensitivity, profile.DataVolume, profile.NetworkSegmentation, profile.LegacySystems,
profile.IoTIntegration, profile.RemoteWork, profile.BYOD, profile.VPN, profile.API, profile.VendorAccess, profile.InternalDev,
).Scan(&id)
if err != nil {
return -1, err
}
return id, nil
}