20 lines
779 B
Go
20 lines
779 B
Go
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// PortalMember represents a member associated with a portal.
|
|
// Reference: Chatwoot PortalMember model + P2B M9 spec
|
|
type PortalMember struct {
|
|
Base
|
|
PortalID uint `gorm:"index;not null" json:"portal_id"`
|
|
UserID uint `gorm:"index;not null" json:"user_id"`
|
|
Role string `gorm:"size:50;not null;default:'reader'" json:"role"` // reader/editor/administrator (PortalMemberRole)
|
|
CustomAttributes json.RawMessage `gorm:"type:jsonb;serializer:json" json:"custom_attributes"`
|
|
|
|
Portal Portal `gorm:"foreignKey:PortalID" json:"portal,omitempty"`
|
|
User User `gorm:"foreignKey:UserID" json:"user,omitempty"`
|
|
}
|
|
|
|
func (PortalMember) TableName() string { return "portal_members" } |