refactor(correction to folder sturcture): before we got to deep resturctures to best pactice folder
This commit is contained in:
21
backend/internal/models/logs.go
Normal file
21
backend/internal/models/logs.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
"lst.net/pkg"
|
||||
)
|
||||
|
||||
type Log struct {
|
||||
LogID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primaryKey" json:"id"`
|
||||
Level string `gorm:"size:10;not null"` // "info", "error", etc.
|
||||
Message string `gorm:"not null"`
|
||||
Service string `gorm:"size:50"`
|
||||
Metadata pkg.JSONB `gorm:"type:jsonb"` // fields (e.g., {"user_id": 123})
|
||||
CreatedAt time.Time `gorm:"index"`
|
||||
Checked bool `gorm:"type:boolean;default:false"`
|
||||
UpdatedAt time.Time
|
||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||
}
|
||||
32
backend/internal/models/servers.go
Normal file
32
backend/internal/models/servers.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"lst.net/pkg"
|
||||
)
|
||||
|
||||
type Servers struct {
|
||||
ServerID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primaryKey" json:"id"`
|
||||
ServerName string `gorm:"size:50;not null"`
|
||||
ServerDNS string `gorm:"size:25;not null"`
|
||||
PlantToken string `gorm:"size:10;not null"`
|
||||
IPAddress string `gorm:"size:16;not null"`
|
||||
GreatPlainsPlantCode int `gorm:"size:10;not null"`
|
||||
StreetAddress string `gorm:"size:255;not null"`
|
||||
CityState string `gorm:"size:50;not null"`
|
||||
Zipcode int `gorm:"size:13;not null"`
|
||||
ContactEmail string `gorm:"size:255"`
|
||||
ContactPhone string `gorm:"size:255"`
|
||||
CustomerTiAcc string `gorm:"size:255"`
|
||||
LstServerPort int `gorm:"size:255; not null"`
|
||||
Active bool `gorm:"type:boolean;default:true"`
|
||||
LerverLoc string `gorm:"size:255:not null"`
|
||||
LastUpdated time.Time `gorm:"index"`
|
||||
ShippingHours pkg.JSONB `gorm:"type:jsonb;default:'[{\"early\": \"06:30\", \"late\": \"23:00\"}]'"`
|
||||
TiPostTime pkg.JSONB `gorm:"type:jsonb;default:'[{\"from\": \"24\", \"to\": \"24\"}]'"`
|
||||
OtherSettings pkg.JSONB `gorm:"type:jsonb;default:'[{\"specialInstructions\": \"something for ti\", \"active\": false}]'"`
|
||||
IsUpgrading bool `gorm:"type:boolean;default:true"`
|
||||
AlplaProdApiKey string `gorm:"size:255"`
|
||||
}
|
||||
20
backend/internal/models/settings.go
Normal file
20
backend/internal/models/settings.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
SettingID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primaryKey" json:"id"`
|
||||
Name string `gorm:"uniqueIndex;not null"`
|
||||
Description string `gorm:"type:text"`
|
||||
Value string `gorm:"not null"`
|
||||
Enabled bool `gorm:"default:true"`
|
||||
AppService string `gorm:"default:system"`
|
||||
CreatedAt time.Time `gorm:"index"`
|
||||
UpdatedAt time.Time `gorm:"index"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index"`
|
||||
}
|
||||
21
backend/internal/models/ws_client.go
Normal file
21
backend/internal/models/ws_client.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"lst.net/pkg"
|
||||
)
|
||||
|
||||
type ClientRecord struct {
|
||||
ClientID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primaryKey" json:"id"`
|
||||
APIKey string `gorm:"not null"`
|
||||
IPAddress string `gorm:"not null"`
|
||||
UserAgent string `gorm:"size:255"`
|
||||
ConnectedAt time.Time `gorm:"index"`
|
||||
LastHeartbeat time.Time `gorm:"column:last_heartbeat"`
|
||||
Channels pkg.JSONB `gorm:"type:jsonb"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
DisconnectedAt *time.Time `gorm:"column:disconnected_at"`
|
||||
}
|
||||
Reference in New Issue
Block a user