Files
openaccounting-server/models/transaction.go
Aaron Guise bd3f101fb4 feat: add GORM integration with repository pattern
- Add GORM models in models/ directory with proper column tags
- Create repository interfaces and implementations in core/repository/
- Add database package with MySQL and SQLite support
- Add UUID ID utility for GORM models
- Implement complete repository layer replacing SQL-based data access
- Add database migrations and index creation
- Support both MySQL and SQLite drivers with auto-migration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-30 22:07:51 +12:00

19 lines
762 B
Go

package models
// Transaction represents a financial transaction
type Transaction struct {
ID []byte `gorm:"type:BINARY(16);primaryKey"`
OrgID []byte `gorm:"column:orgId;type:BINARY(16);not null"`
UserID []byte `gorm:"column:userId;type:BINARY(16);not null"`
Date uint64 `gorm:"column:date;not null"`
Inserted uint64 `gorm:"column:inserted;not null"`
Updated uint64 `gorm:"column:updated;not null"`
Description string `gorm:"column:description;size:300;not null"`
Data string `gorm:"column:data;type:TEXT;not null"`
Deleted bool `gorm:"column:deleted;default:false"`
Org Org `gorm:"foreignKey:OrgID"`
User User `gorm:"foreignKey:UserID"`
Splits []Split `gorm:"foreignKey:TransactionID"`
}