You've already forked openaccounting-server
forked from cybercinch/openaccounting-server
refactor: update data access layer to use GORM repositories
- Replace SQL-based queries with GORM repository calls - Update all model interfaces to use repository pattern - Fix compilation errors in core/model/ files - Update mocks to match new repository interfaces - Modify API handlers to use new repository layer - Maintain backward compatibility with existing interfaces 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,44 +2,45 @@ package model
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/openaccounting/oa-server/core/mocks"
|
||||
"github.com/openaccounting/oa-server/core/model/types"
|
||||
"github.com/openaccounting/oa-server/core/util"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestCreatePrice(t *testing.T) {
|
||||
|
||||
price := types.Price{
|
||||
"1",
|
||||
"2",
|
||||
"BTC",
|
||||
time.Unix(0, 0),
|
||||
time.Unix(0, 0),
|
||||
time.Unix(0, 0),
|
||||
6700,
|
||||
Id: "1",
|
||||
OrgId: "2",
|
||||
Currency: "BTC",
|
||||
Date: time.Unix(0, 0),
|
||||
Inserted: time.Unix(0, 0),
|
||||
Updated: time.Unix(0, 0),
|
||||
Price: 6700,
|
||||
}
|
||||
|
||||
badPrice := types.Price{
|
||||
"1",
|
||||
"2",
|
||||
"",
|
||||
time.Unix(0, 0),
|
||||
time.Unix(0, 0),
|
||||
time.Unix(0, 0),
|
||||
6700,
|
||||
Id: "1",
|
||||
OrgId: "2",
|
||||
Currency: "",
|
||||
Date: time.Unix(0, 0),
|
||||
Inserted: time.Unix(0, 0),
|
||||
Updated: time.Unix(0, 0),
|
||||
Price: 6700,
|
||||
}
|
||||
|
||||
badOrg := types.Price{
|
||||
"1",
|
||||
"1",
|
||||
"BTC",
|
||||
time.Unix(0, 0),
|
||||
time.Unix(0, 0),
|
||||
time.Unix(0, 0),
|
||||
6700,
|
||||
Id: "1",
|
||||
OrgId: "1",
|
||||
Currency: "BTC",
|
||||
Date: time.Unix(0, 0),
|
||||
Inserted: time.Unix(0, 0),
|
||||
Updated: time.Unix(0, 0),
|
||||
Price: 6700,
|
||||
}
|
||||
|
||||
tests := map[string]struct {
|
||||
@@ -89,13 +90,13 @@ func TestCreatePrice(t *testing.T) {
|
||||
func TestDeletePrice(t *testing.T) {
|
||||
|
||||
price := types.Price{
|
||||
"1",
|
||||
"2",
|
||||
"BTC",
|
||||
time.Unix(0, 0),
|
||||
time.Unix(0, 0),
|
||||
time.Unix(0, 0),
|
||||
6700,
|
||||
Id: "1",
|
||||
OrgId: "2",
|
||||
Currency: "BTC",
|
||||
Date: time.Unix(0, 0),
|
||||
Inserted: time.Unix(0, 0),
|
||||
Updated: time.Unix(0, 0),
|
||||
Price: 6700,
|
||||
}
|
||||
|
||||
tests := map[string]struct {
|
||||
|
||||
Reference in New Issue
Block a user