format code

This commit is contained in:
Patrick Nagurny
2020-01-14 14:29:00 -05:00
parent 83f3cfc983
commit f2877230e2
7 changed files with 267 additions and 267 deletions

View File

@@ -54,39 +54,39 @@ func GetOrg(w rest.ResponseWriter, r *rest.Request) {
}
/**
* @api {get} /orgs Get a User's Orgs
* @apiVersion 1.4.0
* @apiName GetOrgs
* @apiGroup Org
*
* @apiHeader {String} Authorization HTTP Basic Auth
* @apiHeader {String} Accept-Version ^1.4.0 semver versioning
*
* @apiSuccess {String} id Id of the Org.
* @apiSuccess {Date} inserted Date Org was created
* @apiSuccess {Date} updated Date Org was updated
* @apiSuccess {String} name Name of the Org.
* @apiSuccess {String} currency Three letter currency code.
* @apiSuccess {Number} precision How many digits the currency goes out to.
@apiSuccess {String} timezone Timezone to use for accounting.
*
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* [
* {
* "id": "11111111111111111111111111111111",
* "inserted": "2018-09-11T18:05:04.420Z",
* "updated": "2018-09-11T18:05:04.420Z",
* "name": "MyOrg",
* "currency": "USD",
* "precision": 2,
* "timezone": "America/New_York"
* }
* ]
*
* @apiUse NotAuthorizedError
* @apiUse InternalServerError
*/
* @api {get} /orgs Get a User's Orgs
* @apiVersion 1.4.0
* @apiName GetOrgs
* @apiGroup Org
*
* @apiHeader {String} Authorization HTTP Basic Auth
* @apiHeader {String} Accept-Version ^1.4.0 semver versioning
*
* @apiSuccess {String} id Id of the Org.
* @apiSuccess {Date} inserted Date Org was created
* @apiSuccess {Date} updated Date Org was updated
* @apiSuccess {String} name Name of the Org.
* @apiSuccess {String} currency Three letter currency code.
* @apiSuccess {Number} precision How many digits the currency goes out to.
@apiSuccess {String} timezone Timezone to use for accounting.
*
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* [
* {
* "id": "11111111111111111111111111111111",
* "inserted": "2018-09-11T18:05:04.420Z",
* "updated": "2018-09-11T18:05:04.420Z",
* "name": "MyOrg",
* "currency": "USD",
* "precision": 2,
* "timezone": "America/New_York"
* }
* ]
*
* @apiUse NotAuthorizedError
* @apiUse InternalServerError
*/
func GetOrgs(w rest.ResponseWriter, r *rest.Request) {
user := r.Env["USER"].(*types.User)

View File

@@ -105,4 +105,4 @@ func (auth *AuthService) AuthenticateEmailVerifyCode(code string) (*types.User,
}
return u, nil
}
}

View File

@@ -77,17 +77,17 @@ func (db *DB) InsertAndReplaceBudget(budget *types.Budget) (err error) {
}
}()
// delete previous budget
query1 := "DELETE FROM budgetitem WHERE orgId = UNHEX(?)"
// delete previous budget
query1 := "DELETE FROM budgetitem WHERE orgId = UNHEX(?)"
_, err = dbTx.Exec(
query1,
budget.OrgId,
)
if err != nil {
return
}
_, err = dbTx.Exec(
query1,
budget.OrgId,
)
if err != nil {
return
}
// save items
for _, item := range budget.Items {
@@ -114,4 +114,4 @@ func (db *DB) DeleteBudget(orgId string) error {
_, err := db.Exec(query, orgId)
return err
}
}

View File

@@ -5,13 +5,13 @@ import (
)
type Budget struct {
OrgId string `json:"orgId"`
Inserted time.Time `json:"inserted"`
Items []*BudgetItem `json:"items"`
OrgId string `json:"orgId"`
Inserted time.Time `json:"inserted"`
Items []*BudgetItem `json:"items"`
}
type BudgetItem struct {
OrgId string `json:"-"`
AccountId string `json:"accountId"`
Amount int64 `json:"amount"`
OrgId string `json:"-"`
AccountId string `json:"accountId"`
Amount int64 `json:"amount"`
}