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,7 +2,7 @@ package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -12,48 +12,7 @@ import (
|
||||
"github.com/openaccounting/oa-server/core/model/types"
|
||||
)
|
||||
|
||||
/**
|
||||
* @api {get} /orgs/:orgId/accounts Get Accounts by Org id
|
||||
* @apiVersion 1.4.0
|
||||
* @apiName GetOrgAccounts
|
||||
* @apiGroup Account
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.4.0 semver versioning
|
||||
*
|
||||
* @apiSuccess {String} id Id of the Account.
|
||||
* @apiSuccess {String} orgId Id of the Org.
|
||||
* @apiSuccess {Date} inserted Date Account was created
|
||||
* @apiSuccess {Date} updated Date Account was updated
|
||||
* @apiSuccess {String} name Name of the Account.
|
||||
* @apiSuccess {String} parent Id of the parent Account.
|
||||
* @apiSuccess {String} currency Three letter currency code.
|
||||
* @apiSuccess {Number} precision How many digits the currency goes out to.
|
||||
* @apiSuccess {Boolean} debitBalance True if Account has a debit balance.
|
||||
* @apiSuccess {Number} balance Current Account balance in this Account's currency
|
||||
* @apiSuccess {Number} nativeBalance Current Account balance in the Org's currency
|
||||
*
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
* [
|
||||
* {
|
||||
* "id": "22222222222222222222222222222222",
|
||||
* "orgId": "11111111111111111111111111111111",
|
||||
* "inserted": "2018-09-11T18:05:04.420Z",
|
||||
* "updated": "2018-09-11T18:05:04.420Z",
|
||||
* "name": "Cash",
|
||||
* "parent": "11111111111111111111111111111111",
|
||||
* "currency": "USD",
|
||||
* "precision": 2,
|
||||
* "debitBalance": true,
|
||||
* "balance": 10000,
|
||||
* "nativeBalance": 10000
|
||||
* }
|
||||
* ]
|
||||
*
|
||||
* @apiUse NotAuthorizedError
|
||||
* @apiUse InternalServerError
|
||||
*/
|
||||
// GetOrgAccounts /**
|
||||
func GetOrgAccounts(w rest.ResponseWriter, r *rest.Request) {
|
||||
user := r.Env["USER"].(*types.User)
|
||||
orgId := r.PathParam("orgId")
|
||||
@@ -208,7 +167,7 @@ func PostAccount(w rest.ResponseWriter, r *rest.Request) {
|
||||
user := r.Env["USER"].(*types.User)
|
||||
orgId := r.PathParam("orgId")
|
||||
|
||||
content, err := ioutil.ReadAll(r.Body)
|
||||
content, err := io.ReadAll(r.Body)
|
||||
r.Body.Close()
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user