endpoint

package
v0.0.0-...-c6fbc10 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoAuthorizationError = errors.New("No Authorization")

Functions

func CreateAccountTitle

func CreateAccountTitle(c *gin.Context)

CreateAccountTitle godoc @Summary Create Account Title @Tags Account Title @Description Create Account Title @Accept json @Produce json @Param bid path string true "Book ID" @Param accountTitle body CreateAccountTitleRequest true "Create Account Title" @Success 200 {string} string "Create Account Title" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/accountTitle [post]

func CreateBook

func CreateBook(c *gin.Context)

CreateBook godoc @Summary Create Book @Tags Book @Description Create Book @Accept json @Produce json @Param book body CreateBookRequest true "Create Book" @Success 200 {string} string "Created Book" @Failure 400 {string} string "Request is failed" @Router /book [post]

func CreateBookAuthorization

func CreateBookAuthorization(c *gin.Context)

CreateBookAuthorization godoc @Summary Create Book Authorization @Tags Book Authorization @Description Create Book Authorization @Accept json @Produce json @Param bid path string true "Book ID" @Success 200 {string} string "Create Book Authorization" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/bookAuthorization [post]

func CreateTransaction

func CreateTransaction(c *gin.Context)

CreateTransaction godoc @Summary Create Transaction @Tags Transaction @Description Create Transaction @Accept json @Produce json @Param bid path string true "Book ID" @Param transaction body CreateTransactionRequest true "Create Transaction" @Success 200 {string} string "Created Transaction" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/transaction [post]

func CreateUser

func CreateUser(c *gin.Context)

CreateUser godoc @Summary Create User @Tags User @Description Create User @Accept json @Produce json @Param user body CreateUserRequest true "Create User" @Success 200 {string} string "Created User" @Failure 400 {string} string "Request is failed" @Router /user [post]

func CreateUserAtDatabase

func CreateUserAtDatabase(c *gin.Context)

CreateUserAtDatabase godoc @Summary Create User At Database Note: This endpoint is not for API.

func DeleteAccountTitle

func DeleteAccountTitle(c *gin.Context)

DeleteAccountTitle godoc @Summary Delete Account Title @Tags Account Title @Description Delete Account Title @Accept json @Produce json @Param bid path string true "Book ID" @Param tid path string true "Account Title ID" @Success 200 {string} string "Delete Account Title" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/accountTitle/{tid} [delete]

func DeleteBook

func DeleteBook(c *gin.Context)

DeleteBook godoc @Summary Delete Book @Tags Book @Description Delete Book @Accept json @Produce json @Param bid path string true "Book ID" @Success 200 {string} string "Delete Book" @Failure 400 {string} string "Request is failed" @Router /book/{bid} [delete]

func DeleteTransaction

func DeleteTransaction(c *gin.Context)

DeleteTransaction godoc @Summary Delete Transaction @Tags Transaction @Description Delete Transaction @Accept json @Produce json @Param bid path string true "Book ID" @Param tid path string true "Transaction ID" @Success 200 {string} string "Transaction was deleted" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/transaction/{tid} [delete]

func GetAccountTitle

func GetAccountTitle(c *gin.Context)

GetAccountTitle godoc @Summary Get Account Title @Tags Account Title @Description Get Account Title @Accept json @Produce json @Param bid path string true "Book ID" @Param tid path string true "Account Title ID" @Success 200 {string} string "Get Account Title" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/accountTitle/{tid} [get]

func GetAllAccountTitles

func GetAllAccountTitles(c *gin.Context)

GetAllAccountTitles godoc @Summary Get All Account Titles @Tags Account Title @Description Get All Account Titles @Accept json @Produce json @Param bid path string true "Book ID" @Success 200 {string} string "Get All Account Titles" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/accountTitle [get]

func GetAllBooks

func GetAllBooks(c *gin.Context)

GetAllBooks godoc @Summary Get All Books @Tags Book @Description Get All Books @Accept json @Produce json @Success 200 {string} string "Get All Books" @Failure 400 {string} string "Request is failed" @Router /book [get]

func GetBook

func GetBook(c *gin.Context)

GetBook godoc @Summary Get Book @Tags Book @Description Get Book @Accept json @Produce json @Param bid path string true "Book ID" @Success 200 {string} string "Get Book" @Failure 400 {string} string "Request is failed" @Router /book/{bid} [get]

func GetBookAuthorizations

func GetBookAuthorizations(c *gin.Context)

func GetSubTransactionsFromAccountTitle

func GetSubTransactionsFromAccountTitle(c *gin.Context)

GetSubTransactionsFromAccountTitle godoc @Summary Get Sub Transactions from Account Title @Tags Sub Transaction @Description Get Sub Transactions from Account Title @Accept json @Produce json @Param bid path string true "Book ID" @Param tid path string true "Account Title ID" @Success 200 {string} string "Sub Transactions was found" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/accountTitle/{tid}/transactions [get]

func GetSubTransactionsFromAccountTitleWithPage

func GetSubTransactionsFromAccountTitleWithPage(c *gin.Context)

GetSubTransactionsFromAccountTitleWithPage godoc @Summary Get Sub Transactions from Account Title with Page @Tags Sub Transaction @Description Get Sub Transactions from Account Title with Page @Accept json @Produce json @Param bid path string true "Book ID" @Param tid path string true "Account Title ID" @Param pid path string true "Page ID" @Success 200 {string} string "Sub Transactions was found" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/accountTitle/{tid}/transactions/{pid} [get]

func GetTransaction

func GetTransaction(c *gin.Context)

GetTransaction godoc @Summary Get Transaction @Tags Transaction @Description Get Transaction @Accept json @Produce json @Param bid path string true "Book ID" @Param tid path string true "Transaction ID" @Success 200 {string} string "Transaction was found" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/transaction/{tid} [get]

func GetTransactions

func GetTransactions(c *gin.Context)

GetTransactions godoc @Summary Get Transactions @Tags Transaction @Description Get Transactions @Accept json @Produce json @Param bid path string true "Book ID" @Success 200 {string} string "Transactions was found" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/transaction [get]

func GetTransactionsWithPage

func GetTransactionsWithPage(c *gin.Context)

GetTransactionsWithPage godoc @Summary Get Transactions with Page @Tags Transaction @Description Get Transactions with Page @Accept json @Produce json @Param bid path string true "Book ID" @Param pid path string true "Page ID" @Success 200 {string} string "Transactions was found" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/transaction/page/{pid} [get]

func GetUser

func GetUser(c *gin.Context)

GetUser godoc @Summary Get User @Tags User @Description Get User @Accept json @Produce json @Success 200 {string} string "Get User" @Failure 400 {string} string "Request is failed" @Router /user [get]

func Login

func Login(c *gin.Context)

Login godoc @Summary Login @Tags User @Description Login @Accept json @Produce json @Param user body LoginWithEmailAndPassword true "Login" @Success 200 {string} string "Login" @Failure 400 {string} string "Request is failed" @Router /login [post]

func Logout

func Logout(c *gin.Context)

Logout godoc @Summary Logout @Tags User @Description Logout @Accept json @Produce json @Success 200 {string} string "Logout" @Failure 400 {string} string "Request is failed" @Router /logout [get]

func Ping

func Ping(c *gin.Context)

Ping godoc @Summary Ping @Tags Ping @Description Ping @Accept json @Produce json @Success 200 {string} string "pong" @Router /ping [get]

func UpdateAccountTitle

func UpdateAccountTitle(c *gin.Context)

UpdateAccountTitle godoc @Summary Update Account Title @Tags Account Title @Description Update Account Title @Accept json @Produce json @Param bid path string true "Book ID" @Param tid path string true "Account Title ID" @Param accountTitle body UpdateAccountTitleRequest true "Update Account Title" @Success 200 {string} string "Update Account Title" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/accountTitle/{tid} [patch]

func UpdateBook

func UpdateBook(c *gin.Context)

UpdateBook godoc @Summary Update Book @Tags Book @Description Update Book @Accept json @Produce json @Param bid path string true "Book ID" @Param book body UpdateBookRequest true "Update Book" @Success 200 {string} string "Update Book" @Failure 400 {string} string "Request is failed" @Router /book/{bid} [patch]

func UpdateBookAuthorization

func UpdateBookAuthorization(c *gin.Context)

UpdateBookAuthorization godoc @Summary Update Book Authorization @Tags Book Authorization @Description Update Book Authorization @Accept json @Produce json @Param bid path string true "Book ID" @Param uid path string true "User ID" @Success 200 {string} string "Update Book Authorization" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/bookAuthorization/{uid} [patch]

func UpdateTransaction

func UpdateTransaction(c *gin.Context)

UpdateTransaction godoc @Summary Update Transaction @Tags Transaction @Description Update Transaction @Accept json @Produce json @Param bid path string true "Book ID" @Param tid path string true "Transaction ID" @Param transaction body UpdateTransactionRequest true "Update Transaction" @Success 200 {string} string "Updated Transaction" @Failure 400 {string} string "Request is failed" @Router /book/{bid}/transaction/{tid} [patch]

Types

type CreateAccountTitleRequest

type CreateAccountTitleRequest struct {
	Name       string `json:"name" binding:"required"`
	Amount     int64  `json:"amount"`
	AmountBase int64  `json:"amount_base"`
	Type       uint   `json:"type"`
}

type CreateBookAuthorizationRequest

type CreateBookAuthorizationRequest struct {
	UserId    string `json:"user_id" binding:"required"`
	Authority string `json:"authority" binding:"required"`
}

type CreateBookRequest

type CreateBookRequest struct {
	Name string `json:"name" binding:"required"`
	Year uint   `json:"year" binding:"required"`
}

type CreateTransactionRequest

type CreateTransactionRequest struct {
	Description     string                 `json:"description" binding:"required"`
	OccurredAt      time.Time              `json:"occurred_at" binding:"required"`
	SubTransactions []model.SubTransaction `json:"sub_transactions" binding:"required"`
}

type CreateUserRequest

type CreateUserRequest struct {
	Email    string `json:"email" binding:"required"`
	Name     string `json:"name" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type LoginWithEmailAndPassword

type LoginWithEmailAndPassword struct {
	Email    string `json:"email" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type UpdateAccountTitleRequest

type UpdateAccountTitleRequest struct {
	Name       *string `json:"name"`
	Amount     *int64  `json:"amount"`
	AmountBase *int64  `json:"amount_base"`
	Type       *uint   `json:"type"`
}

type UpdateBookAuthorizationRequest

type UpdateBookAuthorizationRequest struct {
	UserId    string `json:"user_id" binding:"required"`
	Authority string `json:"authority" binding:"required"`
}

type UpdateBookRequest

type UpdateBookRequest struct {
	Name *string `json:"name"`
	Year *uint   `json:"year"`
}

type UpdateTransactionRequest

type UpdateTransactionRequest struct {
	Description     *string                 `json:"description"`
	OccurredAt      *time.Time              `json:"occurred_at"`
	SubTransactions *[]model.SubTransaction `json:"sub_transactions"`
}

Jump to

Keyboard shortcuts

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