client.go 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. package models
  2. import (
  3. "time"
  4. "gorm.io/gorm"
  5. )
  6. type Client struct {
  7. ID int64 `gorm:"column:rowid;primaryKey;autoIncrement" json:"id"` // Unique identifier
  8. Name string `json:"name" gorm:"not null"` // Client name
  9. ContactEmail string `json:"contactEmail" gorm:"index"` // Client contact email
  10. ContactPhone string `json:"contactPhone,omitempty"` // Optional contact phone
  11. Organization string `json:"organization"` // Client organization name
  12. Plan PlanType `json:"plan" gorm:"default:'basic'"` // Client plan type (basic, pro, enterprise)
  13. CreatedAt time.Time `json:"createdAt" gorm:"autoCreateTime"` // Creation timestamp
  14. UpdatedAt time.Time `json:"updatedAt" gorm:"autoUpdateTime"` // Last update timestamp
  15. DeletedAt gorm.DeletedAt `json:"deletedAt" gorm:"index"` // Soft delete support
  16. // GORM relationships
  17. Deployments []Deployment `json:"deployments" gorm:"foreignKey:ClientID"` // Deployments belonging to this client
  18. }
  19. // PlanType represents the type of plan a client can have
  20. type PlanType string
  21. const (
  22. Basic PlanType = "basic" // Basic plan
  23. Pro PlanType = "pro" // Pro plan
  24. Enterprise PlanType = "enterprise" // Enterprise plan
  25. )