Files
phishingclub/backend/database/recipient.go
T
2026-06-11 20:34:13 +02:00

49 lines
1.2 KiB
Go

package database
import (
"time"
"github.com/google/uuid"
)
const (
RECIPIENT_TABLE = "recipients"
)
// Recipient is a gorm data model
type Recipient struct {
ID *uuid.UUID `gorm:"primary_key;not null;unique;type:uuid"`
CreatedAt *time.Time `gorm:"not null;index;"`
UpdatedAt *time.Time `gorm:"not null;index"`
DeletedAt *time.Time `gorm:"index;"`
Email *string `gorm:";uniqueIndex"`
Phone *string `gorm:";index"`
ExtraIdentifier *string `gorm:";index"`
FirstName string `gorm:";"`
LastName string `gorm:";"`
Position string `gorm:";"`
Department string `gorm:";"`
City string `gorm:";"`
Country string `gorm:";"`
Misc string `gorm:";"`
ScimUserName string `gorm:";"`
// ScimSoftDeletedAt marks a recipient that the IdP has deprovisioned via SCIM
// but is kept during the retention grace period before being pruned. Null
// means the recipient is active.
ScimSoftDeletedAt *time.Time `gorm:"index;"`
// can belong to
CompanyID *uuid.UUID `gorm:"type:uuid;index;"`
Company *Company
// many-to-many
Groups []RecipientGroup `gorm:"many2many:recipient_group_recipients;"`
}
func (Recipient) TableName() string {
return RECIPIENT_TABLE
}