You've already forked openaccounting-server
forked from cybercinch/openaccounting-server
- Add core attachment type with metadata fields for transaction files - Add GORM model for attachment with proper relationships - Include file information, upload timestamps, and soft deletion support 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
28 lines
1.1 KiB
Go
28 lines
1.1 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type Attachment struct {
|
|
ID []byte `gorm:"type:BINARY(16);primaryKey"`
|
|
TransactionID []byte `gorm:"column:transactionId;type:BINARY(16);not null"`
|
|
OrgID []byte `gorm:"column:orgId;type:BINARY(16);not null"`
|
|
UserID []byte `gorm:"column:userId;type:BINARY(16);not null"`
|
|
FileName string `gorm:"column:fileName;size:255;not null"`
|
|
OriginalName string `gorm:"column:originalName;size:255;not null"`
|
|
ContentType string `gorm:"column:contentType;size:100;not null"`
|
|
FileSize int64 `gorm:"column:fileSize;not null"`
|
|
FilePath string `gorm:"column:filePath;size:500;not null"`
|
|
Description string `gorm:"column:description;size:500"`
|
|
Uploaded time.Time `gorm:"column:uploaded;not null"`
|
|
Deleted bool `gorm:"column:deleted;default:false"`
|
|
|
|
Transaction Transaction `gorm:"foreignKey:TransactionID"`
|
|
Org Org `gorm:"foreignKey:OrgID"`
|
|
User User `gorm:"foreignKey:UserID"`
|
|
}
|
|
|
|
func (Attachment) TableName() string {
|
|
return "attachment"
|
|
} |