mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-07-03 10:58:18 +02:00
d1f100968e
Signed-off-by: Ronni Skansing <rskansing@gmail.com>
41 lines
1.4 KiB
Go
41 lines
1.4 KiB
Go
package database
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
const (
|
|
REPORT_SEND_LOG_TABLE = "report_send_logs"
|
|
)
|
|
|
|
// ReportSendLog is one record of a report delivery attempt for a campaign.
|
|
// values are denormalized so the row stays meaningful after the campaign,
|
|
// group or smtp config is changed or removed.
|
|
type ReportSendLog struct {
|
|
ID *uuid.UUID `gorm:"primary_key;not null;unique;type:uuid"`
|
|
CreatedAt *time.Time `gorm:"not null;index;"`
|
|
CompanyID *uuid.UUID `gorm:"type:uuid;index"` // the campaign's company, NULL for a global campaign
|
|
CampaignID *uuid.UUID `gorm:"type:uuid;index"`
|
|
CampaignName string `gorm:"not null;default:''"`
|
|
GroupName string `gorm:"not null;default:''"` // recipient group name at send time
|
|
Trigger string `gorm:"not null;default:''"` // on_demand or on_finish
|
|
Status string `gorm:"not null;default:''"` // sent or failed
|
|
RecipientCount int `gorm:"not null;default:0"`
|
|
Recipients string `gorm:"not null;default:'';type:text"` // comma separated recipient addresses
|
|
SenderEmail string `gorm:"not null;default:''"`
|
|
ErrorMessage string `gorm:"not null;default:'';type:text"` // empty on success
|
|
|
|
Company *Company `gorm:"foreignKey:CompanyID"`
|
|
}
|
|
|
|
func (e *ReportSendLog) Migrate(db *gorm.DB) error {
|
|
return nil
|
|
}
|
|
|
|
func (ReportSendLog) TableName() string {
|
|
return REPORT_SEND_LOG_TABLE
|
|
}
|