SecNex

Organizations

Organization model in ClueQuest Go SDK

Schema

FieldTypeDescriptionExtra Info
IDuuid.UUIDUnique identifier for the organization.Primary Key
NamestringName of the organization.unique, not null
DisplayNamestringDisplay name of the organization.not null
CreatedByuuid.UUIDIdentifier of the user who created the organization.Relation to User model
CreatedAttime.TimeTimestamp of when the organization was created.Set automatically to current time at creation
UpdatedAttime.TimeTimestamp of the last update to the organization.Set automatically to current time at update
DeletedAtgorm.DeletedAtTimestamp of when the organization was deleted (if applicable).It is needed for soft deletion.

Model

organization.go
type Organization struct {
	ID          uuid.UUID      `gorm:"type:uuid;primaryKey;default:uuid_generate_v4()" json:"id"`
	Name        string         `gorm:"unique;not null" json:"name"`
	DisplayName string         `gorm:"not null" json:"display_name"`
	CreatedBy   uuid.UUID      `gorm:"type:uuid;" json:"created_by"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`
	DeletedAt   gorm.DeletedAt `gorm:"index" json:"-"`

	Creator User `gorm:"foreignKey:CreatedBy" json:"creator,omitempty"`
}

Relationships

  • Creator: Many-to-one relationship with the User model. An organization is created by a single user.