handler

package
v0.0.0-...-bf028c8 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserRole_Admin = 100
	UserRole_Base  = 10
)

Variables

This section is empty.

Functions

func AddAccount

func AddAccount(w http.ResponseWriter, r *http.Request, user database.User)

AddAccount godoc

@Summary		Create Account
@Description	create new bank account
@Tags			Bank Accounts
@Accept			json
@Produce		json
@Param			account	body		models.AddBankAccountReq	true	"Bank Account Body"
@Success		201		{object}	models.BankAccount
@Failure		400		{object}	models.JSONerrResponse
@Router			/accounts/ [post]

func AddCard

func AddCard(w http.ResponseWriter, r *http.Request, user database.User)

func CreateBank

func CreateBank(w http.ResponseWriter, r *http.Request, user database.User)

CreateBank godoc

@Summary		Create Bank
@Description	create a new bank
@Tags			Bank
@Accept			json
@Produce		json
@Param			page	body		models.CreateBankReq	true	"Create Bank Body"
@Success		201		{object}	models.Bank
@Failure		400		{object}	models.JSONerrResponse
@Router			/banks/register [post]

func CreateUser

func CreateUser(w http.ResponseWriter, r *http.Request)

CreateUser godoc

@Summary		Create User
@Description	create new user
@Tags			Users
@Accept			json
@Produce		json
@Param			user	body		models.CreateUserReq	true	"User Body"
@Success		201		{object}	models.User
@Failure		400		{object}	models.JSONerrResponse
@Router			/users/register [post]

func CreateUserByAdmin

func CreateUserByAdmin(w http.ResponseWriter, r *http.Request, user database.User)

CreateUserByAdmin godoc

@Summary		Create User By Admin
@Description	create new user by admin
@Tags			Users
@Accept			json
@Produce		json
@Param			user	body		models.CreateUserByAdminReq	true	"User Body"
@Success		201		{object}	models.User
@Failure		400		{object}	models.JSONerrResponse
@Router			/users/add [post]

func DbDeleteUser

func DbDeleteUser(w http.ResponseWriter, r *http.Request, user database.User)

DbDeleteUser godoc

@Summary		Delete user from DB
@Description	delete user from db by admin
@Tags			Users
@Accept			json
@Produce		json
@Param			username	path		string	true	"Username"
@Success		201			{object}	models.JSONerrResponse
@Failure		400			{object}	models.JSONerrResponse
@Router			/users/{username} [delete]

func DeleteUser

func DeleteUser(w http.ResponseWriter, r *http.Request, user database.User)

DeleteUser godoc

@Summary		Delete user
@Description	delete user
@Tags			Users
@Accept			json
@Produce		json
@Success		201	{object}	models.JSONerrResponse
@Failure		400	{object}	models.JSONerrResponse
@Router			/users/me [delete]

func GetAccount

func GetAccount(w http.ResponseWriter, r *http.Request, user database.User)

GetAccount godoc

@Summary		Get Account
@Description	get bank account details
@Tags			Bank Accounts
@Accept			json
@Produce		json
@Param			account_id	path		string	true	"Bank Account ID"
@Success		201			{object}	models.BankAccount
@Failure		400			{object}	models.JSONerrResponse
@Router			/accounts/{account_id} [get]

func GetAllAccounts

func GetAllAccounts(w http.ResponseWriter, r *http.Request, user database.User)

GetAllAccounts godoc

@Summary		Get All Account
@Description	get all bank account
@Tags			Bank Accounts
@Accept			json
@Produce		json
@Param			page			query		int32	true	"Page Number"
@Param			items_per_page	query		int32	true	"Items Per Page"
@Success		200				{object}	models.PaginatedListResp[models.BankAccount]
@Failure		400				{object}	models.JSONerrResponse
@Router			/accounts/ [get]

func GetAllCards

func GetAllCards(w http.ResponseWriter, r *http.Request, user database.User)

func GetAnotherUser

func GetAnotherUser(w http.ResponseWriter, r *http.Request, user database.User)

GetAnotherUser godoc

@Summary		Get User
@Description	get another user details
@Tags			Users
@Accept			json
@Produce		json
@Param			username	path		string	true	"Username"
@Success		200			{object}	models.User
@Failure		400			{object}	models.JSONerrResponse
@Router			/users/{username} [get]

func GetBankList

func GetBankList(w http.ResponseWriter, r *http.Request)

GetBankList godoc

@Summary		Get Bank List
@Description	get all bank list
@Tags			Bank
@Accept			json
@Produce		json
@Param			page			query		int32	true	"Page Number"
@Param			items_per_page	query		int32	true	"Items Per Page"
@Success		200				{object}	models.PaginatedListResp[models.Bank]
@Failure		400				{object}	models.JSONerrResponse
@Router			/banks/list [get]

func GetCard

func GetCard(w http.ResponseWriter, r *http.Request, user database.User)

func GetUser

func GetUser(w http.ResponseWriter, r *http.Request, user database.User)

GetUser godoc

@Summary		Get User
@Description	get user details
@Tags			Users
@Accept			json
@Produce		json
@Success		200	{object}	models.User
@Failure		400	{object}	models.JSONerrResponse
@Router			/users/me [get]

func GetUserList

func GetUserList(w http.ResponseWriter, r *http.Request, user database.User)

GetUserList godoc

@Summary		Get User List
@Description	user list
@Tags			Users
@Accept			json
@Produce		json
@Param			page			query		int32	true	"Page Number"
@Param			items_per_page	query		int32	true	"Items Per Page"
@Success		200				{object}	models.PaginatedListResp[models.User]
@Failure		400				{object}	models.JSONerrResponse
@Router			/users/list [get]

func HashPassword

func HashPassword(password string) string

func Hello

func Hello(w http.ResponseWriter, r *http.Request)

Hello godoc

@Summary		Hello API
@Description	get string by ID
@Tags			Ping
@Produce		json
@Success		200	{object}	models.JSONResp
@Router			/ [get]

func Init

func Init()

func LoginUser

func LoginUser(w http.ResponseWriter, r *http.Request)

LoginUser godoc

@Summary		Login User
@Description	get login token
@Tags			Authentication
@Accept			json
@Produce		json
@Param			login	body		models.AuthReq	true	"Login Body"
@Success		201		{object}	models.AuthResp
@Failure		400		{object}	models.JSONerrResponse
@Router			/users/login [post]

func MiddlewareAuth

func MiddlewareAuth(handler authHandler) http.HandlerFunc

func UpdateAccount

func UpdateAccount(w http.ResponseWriter, r *http.Request, user database.User)

UpdateAccount godoc

@Summary		Update Account
@Description	update bank account details
@Tags			Bank Accounts
@Accept			json
@Produce		json
@Param			account_id	path		string						true	"Bank Account ID"
@Param			account		body		models.UpdateBankAccountReq	true	"Bank Account Body"
@Success		201			{object}	models.JSONerrResponse
@Failure		400			{object}	models.JSONerrResponse
@Router			/accounts/{account_id} [put]

func UpdateAnotherUser

func UpdateAnotherUser(w http.ResponseWriter, r *http.Request, user database.User)

UpdateAnotherUser godoc

@Summary		Create User By Admin
@Description	create new user by admin
@Tags			Users
@Accept			json
@Produce		json
@Param			username	path		string					true	"Username"
@Param			user		body		models.UpdateUserReq	true	"User Body"
@Success		201			{object}	models.JSONerrResponse
@Failure		400			{object}	models.JSONerrResponse
@Router			/users/{username} [post]

func UpdateBank

func UpdateBank(w http.ResponseWriter, r *http.Request, user database.User)

func UpdateCard

func UpdateCard(w http.ResponseWriter, r *http.Request, user database.User)

func UpdateDB

func UpdateDB(db *database.Queries)

func UpdateUser

func UpdateUser(w http.ResponseWriter, r *http.Request, user database.User)

UpdateUser godoc

@Summary		update User
@Description	update user details
@Tags			Users
@Accept			json
@Produce		json
@Param			user	body		models.UpdateUserReq	true	"User Body"
@Success		201		{object}	models.JSONerrResponse
@Failure		400		{object}	models.JSONerrResponse
@Router			/users/me [put]

func UpdateUserPassword

func UpdateUserPassword(w http.ResponseWriter, r *http.Request, user database.User)

UpdateUserPassword godoc

@Summary		Update User Password
@Description	update user password
@Tags			Users
@Accept			json
@Produce		json
@Param			password	body		models.UpdatePasswordReq	true	"Password Body"
@Success		201			{object}	models.JSONerrResponse
@Failure		400			{object}	models.JSONerrResponse
@Router			/users/me/password [put]

Types

This section is empty.

Jump to

Keyboard shortcuts

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