intial commit

This commit is contained in:
2026-05-25 11:45:56 +05:30
commit 6ab508560f
73 changed files with 23713 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
package controllers
import (
"nearle/db"
"nearle/models"
"net/http"
"strconv"
"github.com/gofiber/fiber/v2"
)
func CreatePaymentRequest(c *fiber.Ctx) error {
var data models.Paymentrequests
if err := c.BodyParser(&data); err != nil {
return err
}
err := db.DB.Create(&data).Error
if err != nil {
return c.JSON(fiber.Map{
"code": http.StatusConflict,
"message": err.Error(),
"status": false,
})
}
return c.JSON(fiber.Map{
"code": http.StatusCreated,
"message": "Success",
"status": true,
})
}
func GetPaymentRequests(c *fiber.Ctx) error {
var data []models.RequestInfo
pid, _ := strconv.Atoi(c.Query("partnerid"))
status, _ := strconv.Atoi(c.Query("status"))
q1 := "select * from paymentrequests where partnerid=? and status=?"
db.DB.Raw(q1, pid, status).Find(&data)
return c.JSON(fiber.Map{
"code": http.StatusOK,
"message": "Success",
"status": true,
"details": data,
})
}