22 lines
706 B
Go
22 lines
706 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// Contact model structure
|
|
type Contact struct {
|
|
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primaryKey" json:"id"`
|
|
Name string `gorm:"not null" json:"name"`
|
|
Email string `gorm:"not null" json:"email"`
|
|
Subject string `gorm:"not null" json:"subject"`
|
|
Message string `gorm:"not null" json:"message"`
|
|
IP string `json:"ip"`
|
|
UserID *uuid.UUID `gorm:"type:uuid" json:"user_id,omitempty"` // Optional: if user is logged in
|
|
User *User `gorm:"foreignKey:UserID" json:"user,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|