32 lines
576 B
Go
32 lines
576 B
Go
package account
|
|
|
|
import (
|
|
"git.supernets.org/perp/gopay/internal/context"
|
|
)
|
|
|
|
// @summary Delete an account
|
|
// @tags account
|
|
// @accept json
|
|
// @produce json
|
|
// @success 204
|
|
// @response default {object} v1.Error "There was an error"
|
|
// @router /v1/account/delete [delete]
|
|
func Delete(ctx *context.Context) {
|
|
// Call middleware
|
|
ctx.GetAccount()
|
|
|
|
// Account not found
|
|
if ctx.Account == nil {
|
|
return
|
|
}
|
|
|
|
// Delete account
|
|
err := ctx.Database.Account.DeleteByID(ctx.Account.ID)
|
|
if err != nil {
|
|
ctx.Error(500, "InternalServerError")
|
|
return
|
|
}
|
|
|
|
ctx.String(200, "")
|
|
}
|