controllers

package
v0.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2022 License: AGPL-3.0 Imports: 10 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAccount

func CreateAccount(c *gin.Context)

@Summary Create account @Description Creates a new account @Tags Accounts @Produce json @Success 201 {object} AccountResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param account body models.AccountCreate true "Account" @Router /v1/accounts [post]

func CreateAllocation

func CreateAllocation(c *gin.Context)

@Summary Create allocations @Description Create a new allocation of funds to an envelope for a specific month @Tags Allocations @Produce json @Success 201 {object} AllocationResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param allocation body models.AllocationCreate true "Allocation" @Router /v1/allocations [post]

func CreateBudget

func CreateBudget(c *gin.Context)

@Summary Create budget @Description Creates a new budget @Tags Budgets @Accept json @Produce json @Success 201 {object} BudgetResponse @Failure 400 {object} httputil.HTTPError @Failure 500 {object} httputil.HTTPError @Param budget body models.BudgetCreate true "Budget" @Router /v1/budgets [post]

func CreateCategory

func CreateCategory(c *gin.Context)

@Summary Create category @Description Creates a new category @Tags Categories @Produce json @Success 201 {object} CategoryResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param category body models.CategoryCreate true "Category" @Router /v1/categories [post]

func CreateEnvelope

func CreateEnvelope(c *gin.Context)

@Summary Create envelope @Description Creates a new envelope @Tags Envelopes @Produce json @Success 201 {object} EnvelopeResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param envelope body models.EnvelopeCreate true "Envelope" @Router /v1/envelopes [post]

func CreateTransaction

func CreateTransaction(c *gin.Context)

@Summary Create transaction @Description Creates a new transaction @Tags Transactions @Produce json @Success 201 {object} TransactionResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param transaction body models.TransactionCreate true "Transaction" @Router /v1/transactions [post]

func DeleteAccount

func DeleteAccount(c *gin.Context)

@Summary Delete account @Description Deletes an account @Tags Accounts @Produce json @Success 204 @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param accountId path string true "ID formatted as string" @Router /v1/accounts/{accountId} [delete]

func DeleteAllocation

func DeleteAllocation(c *gin.Context)

@Summary Delete allocation @Description Deletes an allocation @Tags Allocations @Success 204 @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param allocationId path string true "ID formatted as string" @Router /v1/allocations/{allocationId} [delete]

func DeleteBudget

func DeleteBudget(c *gin.Context)

@Summary Delete budget @Description Deletes a budget @Tags Budgets @Success 204 @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param budgetId path string true "ID formatted as string" @Router /v1/budgets/{budgetId} [delete]

func DeleteCategory

func DeleteCategory(c *gin.Context)

@Summary Delete category @Description Deletes a category @Tags Categories @Success 204 @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param categoryId path string true "ID formatted as string" @Router /v1/categories/{categoryId} [delete]

func DeleteEnvelope

func DeleteEnvelope(c *gin.Context)

@Summary Delete envelope @Description Deletes an envelope @Tags Envelopes @Success 204 @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param envelopeId path string true "ID formatted as string" @Router /v1/envelopes/{envelopeId} [delete]

func DeleteTransaction

func DeleteTransaction(c *gin.Context)

@Summary Delete transaction @Description Deletes a transaction @Tags Transactions @Success 204 @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param transactionId path string true "ID formatted as string" @Router /v1/transactions/{transactionId} [delete]

func GetAccount

func GetAccount(c *gin.Context)

@Summary Get account @Description Returns a specific account @Tags Accounts @Produce json @Success 200 {object} AccountResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param accountId path string true "ID formatted as string" @Router /v1/accounts/{accountId} [get]

func GetAccounts

func GetAccounts(c *gin.Context)

@Summary List accounts @Description Returns a list of accounts @Tags Accounts @Produce json @Success 200 {object} AccountListResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Router /v1/accounts [get] @Param name query string false "Filter by name" @Param note query string false "Filter by note" @Param budget query string false "Filter by budget ID" @Param onBudget query bool false "Filter by on/off-budget" @Param external query bool false "Filter internal/external"

func GetAllocation

func GetAllocation(c *gin.Context)

@Summary Get allocation @Description Returns a specific allocation @Tags Allocations @Produce json @Success 200 {object} AllocationResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param allocationId path string true "ID formatted as string" @Router /v1/allocations/{allocationId} [get]

func GetAllocations

func GetAllocations(c *gin.Context)

@Summary Get allocations @Description Returns a list of allocations @Tags Allocations @Produce json @Success 200 {object} AllocationListResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Router /v1/allocations [get]

func GetBudget

func GetBudget(c *gin.Context)

@Summary Get budget @Description Returns a specific budget @Tags Budgets @Produce json @Success 200 {object} BudgetResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param budgetId path string true "ID formatted as string" @Router /v1/budgets/{budgetId} [get]

func GetBudgetMonth

func GetBudgetMonth(c *gin.Context)

@Summary Get Budget month data @Description Returns data about a budget for a for a specific month @Tags Budgets @Produce json @Success 200 {object} BudgetMonthResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param budgetId path string true "ID formatted as string" @Param month path string true "The month in YYYY-MM format" @Router /v1/budgets/{budgetId}/{month} [get]

func GetBudgets

func GetBudgets(c *gin.Context)

@Summary List budgets @Description Returns a list of budgets @Tags Budgets @Produce json @Success 200 {object} BudgetListResponse @Failure 500 {object} httputil.HTTPError @Router /v1/budgets [get] @Router /v1/budgets [get] @Param name query string false "Filter by name" @Param note query string false "Filter by note" @Param currency query string false "Filter by currency"

func GetCategories

func GetCategories(c *gin.Context)

@Summary Get categories @Description Returns a list of categories @Tags Categories @Produce json @Success 200 {object} CategoryListResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Router /v1/categories [get]

func GetCategory

func GetCategory(c *gin.Context)

@Summary Get category @Description Returns a specific category @Tags Categories @Produce json @Success 200 {object} CategoryResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param categoryId path string true "ID formatted as string" @Router /v1/categories/{categoryId} [get]

func GetEnvelope

func GetEnvelope(c *gin.Context)

@Summary Get envelope @Description Returns a specific envelope @Tags Envelopes @Produce json @Success 200 {object} EnvelopeResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param envelopeId path string true "ID formatted as string" @Router /v1/envelopes/{envelopeId} [get]

func GetEnvelopeMonth

func GetEnvelopeMonth(c *gin.Context)

@Summary Get Envelope month data @Description Returns data about an envelope for a for a specific month @Tags Envelopes @Produce json @Success 200 {object} EnvelopeMonthResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param envelopeId path string true "ID formatted as string" @Param month path string true "The month in YYYY-MM format" @Router /v1/envelopes/{envelopeId}/{month} [get]

func GetEnvelopes

func GetEnvelopes(c *gin.Context)

@Summary Get envelopes @Description Returns a list of envelopes @Tags Envelopes @Produce json @Success 200 {object} EnvelopeListResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Router /v1/envelopes [get]

func GetTransaction

func GetTransaction(c *gin.Context)

@Summary Get transaction @Description Returns a specific transaction @Tags Transactions @Produce json @Success 200 {object} TransactionResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param transactionId path string true "ID formatted as string" @Router /v1/transactions/{transactionId} [get]

func GetTransactions

func GetTransactions(c *gin.Context)

@Summary Get transactions @Description Returns a list of transactions @Tags Transactions @Produce json @Success 200 {object} TransactionListResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Router /v1/transactions [get]

func OptionsAccountDetail

func OptionsAccountDetail(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Accounts @Success 204 @Failure 400 {object} httputil.HTTPError @Failure 404 @Param accountId path string true "ID formatted as string" @Router /v1/accounts/{accountId} [options]

func OptionsAccountList

func OptionsAccountList(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Accounts @Success 204 @Failure 400 {object} httputil.HTTPError @Failure 404 @Router /v1/accounts [options]

func OptionsAllocationDetail

func OptionsAllocationDetail(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Allocations @Success 204 @Param allocationId path string true "ID formatted as string" @Router /v1/allocations/{allocationId} [options]

func OptionsAllocationList

func OptionsAllocationList(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Allocations @Success 204 @Router /v1/allocations [options]

func OptionsBudgetDetail

func OptionsBudgetDetail(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Budgets @Success 204 @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param budgetId path string true "ID formatted as string" @Router /v1/budgets/{budgetId} [options]

func OptionsBudgetList

func OptionsBudgetList(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Budgets @Success 204 @Failure 500 {object} httputil.HTTPError @Router /v1/budgets [options]

func OptionsCategoryDetail

func OptionsCategoryDetail(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Categories @Success 204 @Failure 400 {object} httputil.HTTPError @Failure 404 @Param categoryId path string true "ID formatted as string" @Router /v1/categories/{categoryId} [options]

func OptionsCategoryList

func OptionsCategoryList(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Categories @Success 204 @Failure 400 {object} httputil.HTTPError @Failure 404 @Router /v1/categories [options]

func OptionsEnvelopeDetail

func OptionsEnvelopeDetail(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Envelopes @Success 204 @Param envelopeId path string true "ID formatted as string" @Router /v1/envelopes/{envelopeId} [options]

func OptionsEnvelopeList

func OptionsEnvelopeList(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Envelopes @Success 204 @Router /v1/envelopes [options]

func OptionsTransactionDetail

func OptionsTransactionDetail(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Transactions @Success 204 @Param transactionId path string true "ID formatted as string" @Router /v1/transactions/{transactionId} [options]

func OptionsTransactionList

func OptionsTransactionList(c *gin.Context)

@Summary Allowed HTTP verbs @Description Returns an empty response with the HTTP Header "allow" set to the allowed HTTP verbs @Tags Transactions @Success 204 @Router /v1/transactions [options]

func RegisterAccountRoutes

func RegisterAccountRoutes(r *gin.RouterGroup)

RegisterAccountRoutes registers the routes for accounts with the RouterGroup that is passed.

func RegisterAllocationRoutes

func RegisterAllocationRoutes(r *gin.RouterGroup)

RegisterAllocationRoutes registers the routes for allocations with the RouterGroup that is passed.

func RegisterBudgetRoutes

func RegisterBudgetRoutes(r *gin.RouterGroup)

RegisterBudgetRoutes registers the routes for budgets with the RouterGroup that is passed.

func RegisterCategoryRoutes

func RegisterCategoryRoutes(r *gin.RouterGroup)

RegisterCategoryRoutes registers the routes for categories with the RouterGroup that is passed.

func RegisterEnvelopeRoutes

func RegisterEnvelopeRoutes(r *gin.RouterGroup)

RegisterEnvelopeRoutes registers the routes for envelopes with the RouterGroup that is passed.

func RegisterTransactionRoutes

func RegisterTransactionRoutes(r *gin.RouterGroup)

RegisterTransactionRoutes registers the routes for transactions with the RouterGroup that is passed.

func UpdateAccount

func UpdateAccount(c *gin.Context)

@Summary Update account @Description Updates an account. Only values to be updated need to be specified. @Tags Accounts @Produce json @Success 200 {object} AccountResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param accountId path string true "ID formatted as string" @Param account body models.AccountCreate true "Account" @Router /v1/accounts/{accountId} [patch]

func UpdateAllocation

func UpdateAllocation(c *gin.Context)

@Summary Update allocation @Description Update an allocation. Only values to be updated need to be specified. @Tags Allocations @Accept json @Produce json @Success 200 {object} AllocationResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param allocationId path string true "ID formatted as string" @Param allocation body models.AllocationCreate true "Allocation" @Router /v1/allocations/{allocationId} [patch]

func UpdateBudget

func UpdateBudget(c *gin.Context)

@Summary Update budget @Description Update an existing budget. Only values to be updated need to be specified. @Tags Budgets @Accept json @Produce json @Success 200 {object} BudgetResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param budgetId path string true "ID formatted as string" @Param budget body models.BudgetCreate true "Budget" @Router /v1/budgets/{budgetId} [patch]

func UpdateCategory

func UpdateCategory(c *gin.Context)

@Summary Update category @Description Update an existing category. Only values to be updated need to be specified. @Tags Categories @Accept json @Produce json @Success 200 {object} CategoryResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param categoryId path string true "ID formatted as string" @Param category body models.CategoryCreate true "Category" @Router /v1/categories/{categoryId} [patch]

func UpdateEnvelope

func UpdateEnvelope(c *gin.Context)

@Summary Update envelope @Description Updates an existing envelope. Only values to be updated need to be specified. @Tags Envelopes @Accept json @Produce json @Success 200 {object} EnvelopeResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param envelopeId path string true "ID formatted as string" @Param envelope body models.EnvelopeCreate true "Envelope" @Router /v1/envelopes/{envelopeId} [patch]

func UpdateTransaction

func UpdateTransaction(c *gin.Context)

@Summary Update transaction @Description Updates an existing transaction. Only values to be updated need to be specified. @Tags Transactions @Accept json @Produce json @Success 200 {object} TransactionResponse @Failure 400 {object} httputil.HTTPError @Failure 404 @Failure 500 {object} httputil.HTTPError @Param transactionId path string true "ID formatted as string" @Param transaction body models.TransactionCreate true "Transaction" @Router /v1/transactions/{transactionId} [patch]

Types

type Account

type Account struct {
	models.Account
	Links AccountLinks `json:"links"`
}
type AccountLinks struct {
	Self         string `json:"self" example:"https://example.com/api/v1/accounts/af892e10-7e0a-4fb8-b1bc-4b6d88401ed2"`
	Transactions string `json:"transactions" example:"https://example.com/api/v1/transactions?account=af892e10-7e0a-4fb8-b1bc-4b6d88401ed2"`
}

type AccountListResponse

type AccountListResponse struct {
	Data []Account `json:"data"`
}

type AccountQueryFilter added in v0.26.0

type AccountQueryFilter struct {
	Name     string `form:"name"`
	Note     string `form:"note"`
	BudgetID string `form:"budget"`
	OnBudget bool   `form:"onBudget"`
	External bool   `form:"external"`
}

func (AccountQueryFilter) ToCreate added in v0.26.0

type AccountResponse

type AccountResponse struct {
	Data Account `json:"data"`
}

type Allocation

type Allocation struct {
	models.Allocation
	Links AllocationLinks `json:"links"`
}
type AllocationLinks struct {
	Self string `json:"self" example:"https://example.com/api/v1/allocations/902cd93c-3724-4e46-8540-d014131282fc"`
}

type AllocationListResponse

type AllocationListResponse struct {
	Data []Allocation `json:"data"`
}

type AllocationResponse

type AllocationResponse struct {
	Data Allocation `json:"data"`
}

type Budget

type Budget struct {
	models.Budget
	Links BudgetLinks `json:"links"`
}
type BudgetLinks struct {
	Self         string `json:"self" example:"https://example.com/api/v1/budgets/550dc009-cea6-4c12-b2a5-03446eb7b7cf"`
	Accounts     string `json:"accounts" example:"https://example.com/api/v1/accounts?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"`
	Categories   string `json:"categories" example:"https://example.com/api/v1/categories?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"`
	Envelopes    string `json:"envelopes" example:"https://example.com/api/v1/envelopes?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"`
	Transactions string `json:"transactions" example:"https://example.com/api/v1/transactions?budget=550dc009-cea6-4c12-b2a5-03446eb7b7cf"`
	Month        string `json:"month" example:"https://example.com/api/v1/budgets/550dc009-cea6-4c12-b2a5-03446eb7b7cf/YYYY-MM"` // This will always end in 'YYYY-MM' for clients to use replace with actual numbers.
}

type BudgetListResponse

type BudgetListResponse struct {
	Data []Budget `json:"data"`
}

type BudgetMonthResponse

type BudgetMonthResponse struct {
	Data models.BudgetMonth `json:"data"`
}

type BudgetQueryFilter added in v0.24.0

type BudgetQueryFilter struct {
	Name     string `form:"name"`
	Note     string `form:"note"`
	Currency string `form:"currency"`
}

type BudgetResponse

type BudgetResponse struct {
	Data Budget `json:"data"`
}

type Category

type Category struct {
	models.Category
	Links     CategoryLinks `json:"links"`
	Envelopes []Envelope    `json:"envelopes"`
}
type CategoryLinks struct {
	Self      string `json:"self" example:"https://example.com/api/v1/categories/3b1ea324-d438-4419-882a-2fc91d71772f"`
	Envelopes string `json:"envelopes" example:"https://example.com/api/v1/envelopes?category=3b1ea324-d438-4419-882a-2fc91d71772f"`
}

type CategoryListResponse

type CategoryListResponse struct {
	Data []Category `json:"data"`
}

type CategoryResponse

type CategoryResponse struct {
	Data Category `json:"data"`
}

type Envelope

type Envelope struct {
	models.Envelope
	Links EnvelopeLinks `json:"links"`
}
type EnvelopeLinks struct {
	Self         string `json:"self" example:"https://example.com/api/v1/envelopes/45b6b5b9-f746-4ae9-b77b-7688b91f8166"`
	Allocations  string `json:"allocations" example:"https://example.com/api/v1/allocations?envelope=45b6b5b9-f746-4ae9-b77b-7688b91f8166"`
	Month        string `json:"month" example:"https://example.com/api/v1/envelopes/45b6b5b9-f746-4ae9-b77b-7688b91f8166/YYYY-MM"` // This will always end in 'YYYY-MM' for clients to use replace with actual numbers.
	Transactions string `json:"transactions" example:"https://example.com/api/v1/transactions?envelope=45b6b5b9-f746-4ae9-b77b-7688b91f8166"`
}

type EnvelopeListResponse

type EnvelopeListResponse struct {
	Data []Envelope `json:"data"`
}

type EnvelopeMonthResponse

type EnvelopeMonthResponse struct {
	Data models.EnvelopeMonth `json:"data"`
}

type EnvelopeResponse

type EnvelopeResponse struct {
	Data Envelope `json:"data"`
}

type Transaction

type Transaction struct {
	models.Transaction
	Links TransactionLinks `json:"links"`
}
type TransactionLinks struct {
	Self string `json:"self" example:"https://example.com/api/v1/transactions/d430d7c3-d14c-4712-9336-ee56965a6673"`
}

type TransactionListResponse

type TransactionListResponse struct {
	Data []Transaction `json:"data"`
}

type TransactionResponse

type TransactionResponse struct {
	Data Transaction `json:"data"`
}

type URIMonth

type URIMonth struct {
	Month time.Time `uri:"month" time_format:"2006-01" time_utc:"1"`
}

Month is used to parse requests for data about a specific month.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL