25 lines
686 B
Go
25 lines
686 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
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"`
|
|
}
|
|
|
|
func (Organization) TableName() string {
|
|
return "organizations"
|
|
}
|