You've already forked openaccounting-server
forked from cybercinch/openaccounting-server
- Add AttachmentInterface to main model interface - Implement attachment CRUD operations with permission checking - Add GetTransaction method for secure attachment access validation - Add accountsContainReadAccess for permission verification - Ensure users can only access attachments for authorized transactions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
38 lines
746 B
Go
38 lines
746 B
Go
package model
|
|
|
|
import (
|
|
"github.com/openaccounting/oa-server/core/model/db"
|
|
"github.com/openaccounting/oa-server/core/model/types"
|
|
"github.com/openaccounting/oa-server/core/util"
|
|
)
|
|
|
|
var Instance Interface
|
|
|
|
type Model struct {
|
|
db db.Datastore
|
|
bcrypt util.Bcrypt
|
|
config types.Config
|
|
}
|
|
|
|
|
|
type Interface interface {
|
|
UserInterface
|
|
OrgInterface
|
|
AccountInterface
|
|
TransactionInterface
|
|
AttachmentInterface
|
|
PriceInterface
|
|
SessionInterface
|
|
ApiKeyInterface
|
|
SystemHealthInteface
|
|
BudgetInterface
|
|
GetTransaction(string, string, string) (*types.Transaction, error)
|
|
}
|
|
|
|
func NewModel(db db.Datastore, bcrypt util.Bcrypt, config types.Config) *Model {
|
|
model := &Model{db: db, bcrypt: bcrypt, config: config}
|
|
Instance = model
|
|
return model
|
|
}
|
|
|