first commit
This commit is contained in:
21
internal/models/contact.go
Normal file
21
internal/models/contact.go
Normal file
@@ -0,0 +1,21 @@
|
||||
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"`
|
||||
}
|
||||
Reference in New Issue
Block a user