You've already forked openaccounting-server
mirror of
https://github.com/openaccounting/oa-server.git
synced 2025-12-09 00:50:59 +13:00
@@ -13,12 +13,12 @@ import (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} /orgs/:orgId/accounts Get Accounts by Org id
|
* @api {get} /orgs/:orgId/accounts Get Accounts by Org id
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName GetOrgAccounts
|
* @apiName GetOrgAccounts
|
||||||
* @apiGroup Account
|
* @apiGroup Account
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccess {String} id Id of the Account.
|
* @apiSuccess {String} id Id of the Account.
|
||||||
* @apiSuccess {String} orgId Id of the Org.
|
* @apiSuccess {String} orgId Id of the Org.
|
||||||
@@ -85,12 +85,12 @@ func GetOrgAccounts(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} /orgs/:orgId/accounts Create a new Account
|
* @api {post} /orgs/:orgId/accounts Create a new Account
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PostAccount
|
* @apiName PostAccount
|
||||||
* @apiGroup Account
|
* @apiGroup Account
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} id Id 32 character hex string
|
* @apiParam {String} id Id 32 character hex string
|
||||||
* @apiParam {String} name Name of the Account.
|
* @apiParam {String} name Name of the Account.
|
||||||
@@ -198,12 +198,12 @@ func PostAccounts(w rest.ResponseWriter, r *rest.Request, content []byte) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {put} /orgs/:orgId/accounts/:accountId Modify an Account
|
* @api {put} /orgs/:orgId/accounts/:accountId Modify an Account
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PutAccount
|
* @apiName PutAccount
|
||||||
* @apiGroup Account
|
* @apiGroup Account
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} id Id 32 character hex string
|
* @apiParam {String} id Id 32 character hex string
|
||||||
* @apiParam {String} name Name of the Account.
|
* @apiParam {String} name Name of the Account.
|
||||||
@@ -273,12 +273,12 @@ func PutAccount(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {delete} /orgs/:orgId/accounts/:accountId Delete an Account
|
* @api {delete} /orgs/:orgId/accounts/:accountId Delete an Account
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName DeleteAccount
|
* @apiName DeleteAccount
|
||||||
* @apiGroup Account
|
* @apiGroup Account
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccessExample Success-Response:
|
* @apiSuccessExample Success-Response:
|
||||||
* HTTP/1.1 200 OK
|
* HTTP/1.1 200 OK
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import (
|
|||||||
/**
|
/**
|
||||||
* Changelog
|
* Changelog
|
||||||
*
|
*
|
||||||
|
* 1.1.0
|
||||||
|
* - add `GET /health-check`
|
||||||
|
*
|
||||||
* 1.0.1
|
* 1.0.1
|
||||||
* - add user.signupSource
|
* - add user.signupSource
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ import (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} /apikeys Get API keys
|
* @api {get} /apikeys Get API keys
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName GetApiKeys
|
* @apiName GetApiKeys
|
||||||
* @apiGroup ApiKey
|
* @apiGroup ApiKey
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccess {String} id Id of the ApiKey.
|
* @apiSuccess {String} id Id of the ApiKey.
|
||||||
* @apiSuccess {Date} inserted Date ApiKey was created
|
* @apiSuccess {Date} inserted Date ApiKey was created
|
||||||
@@ -52,11 +52,11 @@ func GetApiKeys(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} /apikeys Create a new API key
|
* @api {post} /apikeys Create a new API key
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PostApiKey
|
* @apiName PostApiKey
|
||||||
* @apiGroup ApiKey
|
* @apiGroup ApiKey
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
*
|
*
|
||||||
* @apiParam {String} id 32 character hex string
|
* @apiParam {String} id 32 character hex string
|
||||||
@@ -105,11 +105,11 @@ func PostApiKey(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {put} /apikeys Modify an API key
|
* @api {put} /apikeys Modify an API key
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PutApiKey
|
* @apiName PutApiKey
|
||||||
* @apiGroup ApiKey
|
* @apiGroup ApiKey
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
*
|
*
|
||||||
* @apiParam {String} id 32 character hex string
|
* @apiParam {String} id 32 character hex string
|
||||||
@@ -160,12 +160,12 @@ func PutApiKey(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {delete} /apikeys/:apiKeyId Delete an API key
|
* @api {delete} /apikeys/:apiKeyId Delete an API key
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName DeleteApiKey
|
* @apiName DeleteApiKey
|
||||||
* @apiGroup ApiKey
|
* @apiGroup ApiKey
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccessExample Success-Response:
|
* @apiSuccessExample Success-Response:
|
||||||
* HTTP/1.1 200 OK
|
* HTTP/1.1 200 OK
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ import (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} /org/:orgId Get Org by id
|
* @api {get} /org/:orgId Get Org by id
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName GetOrg
|
* @apiName GetOrg
|
||||||
* @apiGroup Org
|
* @apiGroup Org
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccess {String} id Id of the Org.
|
* @apiSuccess {String} id Id of the Org.
|
||||||
* @apiSuccess {Date} inserted Date Org was created
|
* @apiSuccess {Date} inserted Date Org was created
|
||||||
@@ -53,12 +53,12 @@ func GetOrg(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} /orgs Get a User's Orgs
|
* @api {get} /orgs Get a User's Orgs
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName GetOrgs
|
* @apiName GetOrgs
|
||||||
* @apiGroup Org
|
* @apiGroup Org
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccess {String} id Id of the Org.
|
* @apiSuccess {String} id Id of the Org.
|
||||||
* @apiSuccess {Date} inserted Date Org was created
|
* @apiSuccess {Date} inserted Date Org was created
|
||||||
@@ -98,12 +98,12 @@ func GetOrgs(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} /orgs Create a new Org
|
* @api {post} /orgs Create a new Org
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PostOrg
|
* @apiName PostOrg
|
||||||
* @apiGroup Org
|
* @apiGroup Org
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} id Id 32 character hex string
|
* @apiParam {String} id Id 32 character hex string
|
||||||
* @apiParam {String} name Name of the Org.
|
* @apiParam {String} name Name of the Org.
|
||||||
@@ -152,12 +152,12 @@ func PostOrg(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {put} /orgs/:orgId Modify an Org
|
* @api {put} /orgs/:orgId Modify an Org
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PutOrg
|
* @apiName PutOrg
|
||||||
* @apiGroup Org
|
* @apiGroup Org
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} name Name of the Org.
|
* @apiParam {String} name Name of the Org.
|
||||||
*
|
*
|
||||||
@@ -207,12 +207,12 @@ func PutOrg(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} /orgs/:orgId/invites Invite a user to an Org
|
* @api {post} /orgs/:orgId/invites Invite a user to an Org
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PostInvite
|
* @apiName PostInvite
|
||||||
* @apiGroup Org
|
* @apiGroup Org
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} email Email address of user
|
* @apiParam {String} email Email address of user
|
||||||
*
|
*
|
||||||
@@ -263,12 +263,12 @@ func PostInvite(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {put} /orgs/:orgId/invites/:inviteId Accept an invitation
|
* @api {put} /orgs/:orgId/invites/:inviteId Accept an invitation
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PutInvite
|
* @apiName PutInvite
|
||||||
* @apiGroup Org
|
* @apiGroup Org
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} accepted true
|
* @apiParam {String} accepted true
|
||||||
*
|
*
|
||||||
@@ -320,12 +320,12 @@ func PutInvite(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} /orgs/:orgId/invites Get Org invites
|
* @api {get} /orgs/:orgId/invites Get Org invites
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName GetInvites
|
* @apiName GetInvites
|
||||||
* @apiGroup Org
|
* @apiGroup Org
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccess {String} id Id of the Invite
|
* @apiSuccess {String} id Id of the Invite
|
||||||
* @apiSuccess {orgId} id Id of the Org
|
* @apiSuccess {orgId} id Id of the Org
|
||||||
@@ -366,12 +366,12 @@ func GetInvites(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {delete} /orgs/:orgId/invites/:inviteId Delete Invite
|
* @api {delete} /orgs/:orgId/invites/:inviteId Delete Invite
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName DeleteInvite
|
* @apiName DeleteInvite
|
||||||
* @apiGroup Org
|
* @apiGroup Org
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccessExample Success-Response:
|
* @apiSuccessExample Success-Response:
|
||||||
* HTTP/1.1 200 OK
|
* HTTP/1.1 200 OK
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ import (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} /org/:orgId/prices Get prices nearest in time or by currency
|
* @api {get} /org/:orgId/prices Get prices nearest in time or by currency
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName GetPrices
|
* @apiName GetPrices
|
||||||
* @apiGroup Price
|
* @apiGroup Price
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {Number} nearestDate Milliseconds since epoch
|
* @apiParam {Number} nearestDate Milliseconds since epoch
|
||||||
* @apiParam {String} currency Currency code
|
* @apiParam {String} currency Currency code
|
||||||
@@ -93,12 +93,12 @@ func GetPrices(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} /orgs/:orgId/prices Create a new Price
|
* @api {post} /orgs/:orgId/prices Create a new Price
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PostPrice
|
* @apiName PostPrice
|
||||||
* @apiGroup Price
|
* @apiGroup Price
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} id Id 32 character hex string.
|
* @apiParam {String} id Id 32 character hex string.
|
||||||
* @apiParam {String} orgId Id of the Org.
|
* @apiParam {String} orgId Id of the Org.
|
||||||
@@ -155,12 +155,12 @@ func PostPrice(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {delete} /orgs/:orgId/prices/:priceId Delete a Price
|
* @api {delete} /orgs/:orgId/prices/:priceId Delete a Price
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName DeletePrice
|
* @apiName DeletePrice
|
||||||
* @apiGroup Price
|
* @apiGroup Price
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccessExample Success-Response:
|
* @apiSuccessExample Success-Response:
|
||||||
* HTTP/1.1 200 OK
|
* HTTP/1.1 200 OK
|
||||||
|
|||||||
@@ -44,5 +44,6 @@ func GetRouter(auth *AuthMiddleware, prefix string) (rest.App, error) {
|
|||||||
rest.Post(prefix+"/orgs/:orgId/invites", auth.RequireAuth(PostInvite)),
|
rest.Post(prefix+"/orgs/:orgId/invites", auth.RequireAuth(PostInvite)),
|
||||||
rest.Put(prefix+"/orgs/:orgId/invites/:inviteId", auth.RequireAuth(PutInvite)),
|
rest.Put(prefix+"/orgs/:orgId/invites/:inviteId", auth.RequireAuth(PutInvite)),
|
||||||
rest.Delete(prefix+"/orgs/:orgId/invites/:inviteId", auth.RequireAuth(DeleteInvite)),
|
rest.Delete(prefix+"/orgs/:orgId/invites/:inviteId", auth.RequireAuth(DeleteInvite)),
|
||||||
|
rest.Get(prefix+"/health-check", GetSystemHealthStatus),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} /sessions Create a new Session
|
* @api {post} /sessions Create a new Session
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PostSession
|
* @apiName PostSession
|
||||||
* @apiGroup Session
|
* @apiGroup Session
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
*
|
*
|
||||||
* @apiParam {String} id 32 character hex string
|
* @apiParam {String} id 32 character hex string
|
||||||
@@ -59,12 +59,12 @@ func PostSession(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {delete} /sessions/:sessionId Log out of a Session
|
* @api {delete} /sessions/:sessionId Log out of a Session
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName DeleteSession
|
* @apiName DeleteSession
|
||||||
* @apiGroup Session
|
* @apiGroup Session
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccessExample Success-Response:
|
* @apiSuccessExample Success-Response:
|
||||||
* HTTP/1.1 200 OK
|
* HTTP/1.1 200 OK
|
||||||
|
|||||||
38
core/api/syshealth.go
Normal file
38
core/api/syshealth.go
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/ant0ine/go-json-rest/rest"
|
||||||
|
"github.com/openaccounting/oa-server/core/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @api {get} /health-check Get system health status
|
||||||
|
* @apiVersion 1.1.0
|
||||||
|
* @apiName GetSystemHealthStatus
|
||||||
|
* @apiGroup SystemHealth
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @apiHeader {String} Accept-Version: 1.1.0 semver versioning
|
||||||
|
*
|
||||||
|
* @apiSuccess {String} database Database status: "ok"; "fail"
|
||||||
|
* @apiSuccess {String} api API status: "ok"
|
||||||
|
*
|
||||||
|
* @apiSuccessExample Success-Response:
|
||||||
|
* HTTP/1.1 200 OK
|
||||||
|
* {
|
||||||
|
* "database": "ok",
|
||||||
|
* "api": "ok",
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @apiUse InternalServerError
|
||||||
|
*/
|
||||||
|
func GetSystemHealthStatus(w rest.ResponseWriter, r *rest.Request) {
|
||||||
|
status := map[string]string{
|
||||||
|
"database": "ok",
|
||||||
|
"api": "ok",
|
||||||
|
}
|
||||||
|
if err := model.Instance.PingDatabase(); err != nil {
|
||||||
|
status["database"] = "fail"
|
||||||
|
}
|
||||||
|
w.WriteJson(status)
|
||||||
|
}
|
||||||
@@ -9,12 +9,12 @@ import (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} /orgs/:orgId/accounts/:accountId/transactions Get Transactions by Account Id
|
* @api {get} /orgs/:orgId/accounts/:accountId/transactions Get Transactions by Account Id
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName GetAccountTransactions
|
* @apiName GetAccountTransactions
|
||||||
* @apiGroup Transaction
|
* @apiGroup Transaction
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccess {String} id Id of the Transaction.
|
* @apiSuccess {String} id Id of the Transaction.
|
||||||
* @apiSuccess {String} orgId Id of the Org.
|
* @apiSuccess {String} orgId Id of the Org.
|
||||||
@@ -85,12 +85,12 @@ func GetTransactionsByAccount(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} /orgs/:orgId/transactions Get Transactions by Org Id
|
* @api {get} /orgs/:orgId/transactions Get Transactions by Org Id
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName GetOrgTransactions
|
* @apiName GetOrgTransactions
|
||||||
* @apiGroup Transaction
|
* @apiGroup Transaction
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccess {String} id Id of the Transaction.
|
* @apiSuccess {String} id Id of the Transaction.
|
||||||
* @apiSuccess {String} orgId Id of the Org.
|
* @apiSuccess {String} orgId Id of the Org.
|
||||||
@@ -160,12 +160,12 @@ func GetTransactionsByOrg(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} /orgs/:orgId/transactions Create a new Transaction
|
* @api {post} /orgs/:orgId/transactions Create a new Transaction
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PostTransaction
|
* @apiName PostTransaction
|
||||||
* @apiGroup Transaction
|
* @apiGroup Transaction
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} id Id 32 character hex string
|
* @apiParam {String} id Id 32 character hex string
|
||||||
* @apiParam {Date} date Date of the Transaction
|
* @apiParam {Date} date Date of the Transaction
|
||||||
@@ -246,12 +246,12 @@ func PostTransaction(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {put} /orgs/:orgId/transactions/:transactionId Modify a Transaction
|
* @api {put} /orgs/:orgId/transactions/:transactionId Modify a Transaction
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PutTransaction
|
* @apiName PutTransaction
|
||||||
* @apiGroup Transaction
|
* @apiGroup Transaction
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} id 32 character hex string
|
* @apiParam {String} id 32 character hex string
|
||||||
* @apiParam {Date} date Date of the Transaction
|
* @apiParam {Date} date Date of the Transaction
|
||||||
@@ -333,12 +333,12 @@ func PutTransaction(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {delete} /orgs/:orgId/transactions/:transactionId Delete a Transaction
|
* @api {delete} /orgs/:orgId/transactions/:transactionId Delete a Transaction
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName DeleteTransaction
|
* @apiName DeleteTransaction
|
||||||
* @apiGroup Transaction
|
* @apiGroup Transaction
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccessExample Success-Response:
|
* @apiSuccessExample Success-Response:
|
||||||
* HTTP/1.1 200 OK
|
* HTTP/1.1 200 OK
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ type ResetPasswordParams struct {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} /user Get Authenticated User
|
* @api {get} /user Get Authenticated User
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName GetUser
|
* @apiName GetUser
|
||||||
* @apiGroup User
|
* @apiGroup User
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiSuccess {String} id Id of the User.
|
* @apiSuccess {String} id Id of the User.
|
||||||
* @apiSuccess {Date} inserted Date User was created
|
* @apiSuccess {Date} inserted Date User was created
|
||||||
@@ -64,11 +64,11 @@ func GetUser(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} /users Create a new User
|
* @api {post} /users Create a new User
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PostUser
|
* @apiName PostUser
|
||||||
* @apiGroup User
|
* @apiGroup User
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} id 32 character hex string
|
* @apiParam {String} id 32 character hex string
|
||||||
* @apiParam {String} firstName First name of the User.
|
* @apiParam {String} firstName First name of the User.
|
||||||
@@ -123,12 +123,12 @@ func PostUser(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {put} /user Modify User
|
* @api {put} /user Modify User
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName PutUser
|
* @apiName PutUser
|
||||||
* @apiGroup User
|
* @apiGroup User
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} password New password
|
* @apiParam {String} password New password
|
||||||
* @apiParam {String} code Password reset code. (Instead of Authorization header)
|
* @apiParam {String} code Password reset code. (Instead of Authorization header)
|
||||||
@@ -204,11 +204,11 @@ func PutUser(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} /user/verify Verify user email address
|
* @api {post} /user/verify Verify user email address
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName VerifyUser
|
* @apiName VerifyUser
|
||||||
* @apiGroup User
|
* @apiGroup User
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} code Email verification code
|
* @apiParam {String} code Email verification code
|
||||||
*
|
*
|
||||||
@@ -238,11 +238,11 @@ func VerifyUser(w rest.ResponseWriter, r *rest.Request) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {post} /user/reset-password Send reset password email
|
* @api {post} /user/reset-password Send reset password email
|
||||||
* @apiVersion 1.0.1
|
* @apiVersion 1.1.0
|
||||||
* @apiName ResetPassword
|
* @apiName ResetPassword
|
||||||
* @apiGroup User
|
* @apiGroup User
|
||||||
*
|
*
|
||||||
* @apiHeader {String} Accept-Version ^1.0.1 semver versioning
|
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||||
*
|
*
|
||||||
* @apiParam {String} email Email address for user
|
* @apiParam {String} email Email address for user
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ func (mw *VersionMiddleware) MiddlewareFunc(handler rest.HandlerFunc) rest.Handl
|
|||||||
rest.Error(writer, "Invalid version", http.StatusBadRequest)
|
rest.Error(writer, "Invalid version", http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
serverVersion, _ := semver.NewVersion("1.0.1")
|
serverVersion, _ := semver.NewVersion("1.1.0")
|
||||||
// Pre-release versions
|
// Pre-release versions
|
||||||
compatVersion, _ := semver.NewVersion("0.1.8")
|
compatVersion, _ := semver.NewVersion("0.1.8")
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ type Datastore interface {
|
|||||||
PriceInterface
|
PriceInterface
|
||||||
SessionInterface
|
SessionInterface
|
||||||
ApiKeyInterface
|
ApiKeyInterface
|
||||||
|
SystemHealthInteface
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDB(dataSourceName string) (*DB, error) {
|
func NewDB(dataSourceName string) (*DB, error) {
|
||||||
|
|||||||
5
core/model/db/syshealth.go
Normal file
5
core/model/db/syshealth.go
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package db
|
||||||
|
|
||||||
|
type SystemHealthInteface interface {
|
||||||
|
Ping() error
|
||||||
|
}
|
||||||
@@ -22,6 +22,7 @@ type Interface interface {
|
|||||||
PriceInterface
|
PriceInterface
|
||||||
SessionInterface
|
SessionInterface
|
||||||
ApiKeyInterface
|
ApiKeyInterface
|
||||||
|
SystemHealthInteface
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewModel(db db.Datastore, bcrypt util.Bcrypt, config types.Config) *Model {
|
func NewModel(db db.Datastore, bcrypt util.Bcrypt, config types.Config) *Model {
|
||||||
|
|||||||
9
core/model/syshealth.go
Normal file
9
core/model/syshealth.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
type SystemHealthInteface interface {
|
||||||
|
PingDatabase() error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (model *Model) PingDatabase() error {
|
||||||
|
return model.db.Ping()
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "1.0.1"
|
const version = "1.1.0"
|
||||||
|
|
||||||
//var upgrader = websocket.Upgrader{} // use default options
|
//var upgrader = websocket.Upgrader{} // use default options
|
||||||
var txSubscriptions = make(map[string][]*websocket.Conn)
|
var txSubscriptions = make(map[string][]*websocket.Conn)
|
||||||
|
|||||||
17
go.mod
Normal file
17
go.mod
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
module github.com/openaccounting/oa-server
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/Masterminds/semver v0.0.0-20180807142431-c84ddcca87bf
|
||||||
|
github.com/ant0ine/go-json-rest v0.0.0-20170913041208-ebb33769ae01
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/go-sql-driver/mysql v1.4.1
|
||||||
|
github.com/gorilla/websocket v0.0.0-20180605202552-5ed622c449da
|
||||||
|
github.com/mitchellh/mapstructure v0.0.0-20180511142126-bb74f1db0675
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
github.com/sendgrid/rest v0.0.0-20180905234047-875828e14d98 // indirect
|
||||||
|
github.com/sendgrid/sendgrid-go v0.0.0-20180905233524-8cb43f4ca4f5
|
||||||
|
github.com/stretchr/objx v0.1.1 // indirect
|
||||||
|
github.com/stretchr/testify v1.2.2
|
||||||
|
golang.org/x/crypto v0.0.0-20171231215028-0fcca4842a8d
|
||||||
|
google.golang.org/appengine v1.4.0 // indirect
|
||||||
|
)
|
||||||
29
go.sum
Normal file
29
go.sum
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
github.com/Masterminds/semver v0.0.0-20180807142431-c84ddcca87bf h1:BMUJnVJI5J506LOcyGHEvbCocMHAmKTRcG6CMAwGFYU=
|
||||||
|
github.com/Masterminds/semver v0.0.0-20180807142431-c84ddcca87bf/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
||||||
|
github.com/ant0ine/go-json-rest v0.0.0-20170913041208-ebb33769ae01 h1:oYAjCHMjyRaNBo3nUEepDce4LC+Kuh+6jU6y+AllvnU=
|
||||||
|
github.com/ant0ine/go-json-rest v0.0.0-20170913041208-ebb33769ae01/go.mod h1:q6aCt0GfU6LhpBsnZ/2U+mwe+0XB5WStbmwyoPfc+sk=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA=
|
||||||
|
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/gorilla/websocket v0.0.0-20180605202552-5ed622c449da h1:b5fma7aUP2fn6+tdKKCJ0TxXYzY/5wDiqUxNdyi5VF4=
|
||||||
|
github.com/gorilla/websocket v0.0.0-20180605202552-5ed622c449da/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
|
github.com/mitchellh/mapstructure v0.0.0-20180511142126-bb74f1db0675 h1:/rdJjIiKG5rRdwG5yxHmSE/7ZREjpyC0kL7GxGT/qJw=
|
||||||
|
github.com/mitchellh/mapstructure v0.0.0-20180511142126-bb74f1db0675/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/sendgrid/rest v0.0.0-20180905234047-875828e14d98 h1:wpBZ5DAYLNl+2v4E4WP8k/y8tM5OjIf1FezJS1qX8sU=
|
||||||
|
github.com/sendgrid/rest v0.0.0-20180905234047-875828e14d98/go.mod h1:kXX7q3jZtJXK5c5qK83bSGMdV6tsOE70KbHoqJls4lE=
|
||||||
|
github.com/sendgrid/sendgrid-go v0.0.0-20180905233524-8cb43f4ca4f5 h1:V18LU+jSbihmDiWfLSzs9FV1d3KVB1gRTkNxgVHmcvg=
|
||||||
|
github.com/sendgrid/sendgrid-go v0.0.0-20180905233524-8cb43f4ca4f5/go.mod h1:QRQt+LX/NmgVEvmdRw0VT/QgUn499+iza2FnDca9fg8=
|
||||||
|
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
|
||||||
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
golang.org/x/crypto v0.0.0-20171231215028-0fcca4842a8d h1:GrqEEc3+MtHKTsZrdIGVoYDgLpbSRzW1EF+nLu0PcHE=
|
||||||
|
golang.org/x/crypto v0.0.0-20171231215028-0fcca4842a8d/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||||
|
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||||
Reference in New Issue
Block a user