You've already forked openaccounting-server
forked from cybercinch/openaccounting-server
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>
This commit is contained in:
18
models/permission.go
Normal file
18
models/permission.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package models
|
||||
|
||||
// Permission represents access control rules
|
||||
type Permission struct {
|
||||
ID []byte `gorm:"type:BINARY(16);primaryKey"`
|
||||
UserID []byte `gorm:"column:userId;type:BINARY(16)"`
|
||||
TokenID []byte `gorm:"column:tokenId;type:BINARY(16)"`
|
||||
OrgID []byte `gorm:"column:orgId;type:BINARY(16);not null"`
|
||||
AccountID []byte `gorm:"column:accountId;type:BINARY(16);not null"`
|
||||
Type uint `gorm:"column:type;not null"`
|
||||
Inserted uint64 `gorm:"column:inserted;not null"`
|
||||
Updated uint64 `gorm:"column:updated;not null"`
|
||||
|
||||
User User `gorm:"foreignKey:UserID"`
|
||||
Token Token `gorm:"foreignKey:TokenID"`
|
||||
Org Org `gorm:"foreignKey:OrgID"`
|
||||
Account Account `gorm:"foreignKey:AccountID"`
|
||||
}
|
||||
Reference in New Issue
Block a user