Files
old-riskletpy/db/basicProfile.go
2024-11-17 19:41:30 +01:00

65 lines
2.7 KiB
Go

package db
type BasicProfile struct {
CompanyId int // Company ID (foreign key reference)
Employees string // Current employee headcount
Revenue string // Annual revenue range
Applications string // Critical business applications
Compliance string // Regulatory frameworks
Industry string // Primary industry sector
ITDependency string // Technology dependency
DataSensitivity string // Sensitive data level
DataVolume string // Data volume (if applicable)
NetworkSegmentation string // Network infrastructure model
LegacySystems string // Legacy systems (if applicable)
IoTIntegration string // IoT integration (if applicable)
RemoteWork string // Remote work details
BYOD string // Bring Your Own Device policy
VPN string // VPN usage policy
API string // API integration (if applicable)
VendorAccess string // Third-party vendor access
InternalDev string // Internal software development activities
// New fields from the advanced form
GeoScope string // Geographic operational scope
CustomerBase string // Customer base distribution
CustomerType string // Primary customer type
ProductPortfolio string // Product/service portfolio
SupplierBase string // Supplier base structure
ITInfrastructure string // IT infrastructure model (comma-separated values)
IPProtection string // Intellectual property protection (comma-separated values)
SensitiveData string // Sensitive data types (comma-separated values)
IntegrationLevel string // Integration level of business systems
RemotePolicy string // Remote work policy
}
// 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
}