func DeletePrice(w rest.ResponseWriter, r *rest.Request) {
	user := r.Env["USER"].(*types.User)
	priceId := r.PathParam("priceId")
	err := model.Instance.DeletePrice(priceId, user.Id)
	if err != nil {
		rest.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.WriteHeader(http.StatusOK)
}
@api {delete} /orgs/:orgId/prices/:priceId Delete a Price
@apiVersion 1.4.0
@apiName DeletePrice
@apiGroup Price

@apiHeader {String} Authorization HTTP Basic Auth
@apiHeader {String} Accept-Version ^1.4.0 semver versioning

@apiSuccessExample Success-Response:
HTTP/1.1 200 OK

@apiUse NotAuthorizedError
@apiUse InternalServerError
package api
import (
	"github.com/ant0ine/go-json-rest/rest"
	"github.com/openaccounting/oa-server/core/model"
	"github.com/openaccounting/oa-server/core/model/types"
	"net/http"
	"strconv"
	"time"
)
func GetPrices(w rest.ResponseWriter, r *rest.Request) {
	user := r.Env["USER"].(*types.User)
	orgId := r.PathParam("orgId")
	nearestDate := time.Date(2100, time.January, 1, 0, 0, 0, 0, time.UTC)
	nearestDateParam := r.URL.Query().Get("nearestDate")
	currencyParam := r.URL.Query().Get("currency")
	if currencyParam != "" {
		prices, err := model.Instance.GetPricesByCurrency(orgId, currencyParam, user.Id)
		if err != nil {
			rest.Error(w, err.Error(), http.StatusInternalServerError)
			return
		}
		w.WriteJson(prices)
		return
	}
	if nearestDateParam != "" {
		nearestDateParamNumeric, err := strconv.ParseInt(nearestDateParam, 10, 64)
		if err != nil {
			rest.Error(w, "invalid date", 400)
			return
		}
		nearestDate = time.Unix(0, nearestDateParamNumeric*1000000)
	}
	prices, err := model.Instance.GetPricesNearestInTime(orgId, nearestDate, user.Id)
	if err != nil {
		rest.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.WriteJson(prices)
}
func PostPrice(w rest.ResponseWriter, r *rest.Request) {
	user := r.Env["USER"].(*types.User)
	orgId := r.PathParam("orgId")
	price := types.Price{}
	err := r.DecodeJsonPayload(&price)
	if err != nil {
		rest.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	price.OrgId = orgId
	err = model.Instance.CreatePrice(&price, user.Id)
	if err != nil {
		rest.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.WriteJson(&price)
}