feat: support charge for user
This commit is contained in:
@@ -41,3 +41,16 @@ func (ctl *users) Show(ctx fiber.Ctx, id int64) (*model.Users, error) {
|
||||
func (ctl *users) Articles(ctx fiber.Ctx, id int64, pagination *requests.Pagination) (*requests.Pager, error) {
|
||||
return models.Posts.Bought(ctx.Context(), id, pagination)
|
||||
}
|
||||
|
||||
type UserBalance struct {
|
||||
Balance int64 `json:"balance"`
|
||||
}
|
||||
|
||||
// Balance
|
||||
//
|
||||
// @Router /admin/users/:id/balance [post]
|
||||
// @Bind id path
|
||||
// @Bind balance body
|
||||
func (ctl *users) Balance(ctx fiber.Ctx, id int64, balance *UserBalance) error {
|
||||
return models.Users.AddBalance(ctx.Context(), id, balance.Balance)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user