43 lines
778 B
Go
43 lines
778 B
Go
|
package other
|
||
|
|
||
|
import (
|
||
|
"github.com/gofiber/fiber/v2"
|
||
|
"heruvym/internal/repository/mongo"
|
||
|
"heruvym/internal/utils/jwt_adapter"
|
||
|
)
|
||
|
|
||
|
type Deps struct {
|
||
|
Dal *mongo.DAL
|
||
|
}
|
||
|
type OtherController struct {
|
||
|
dal *mongo.DAL
|
||
|
}
|
||
|
|
||
|
func NewOtherController(deps Deps) *OtherController {
|
||
|
return &OtherController{
|
||
|
dal: deps.Dal,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
type ReqScreenshot struct {
|
||
|
TicketID string `json:"ticket"`
|
||
|
Lang string `json:"lang"`
|
||
|
}
|
||
|
|
||
|
func (o *OtherController) RequestScreenshot(ctx *fiber.Ctx) error {
|
||
|
var request ReqScreenshot
|
||
|
sess := jwt_adapter.Get(ctx.Context())
|
||
|
|
||
|
_, err := o.dal.PutSCRequest(
|
||
|
ctx.Context(),
|
||
|
sess.Id,
|
||
|
sess.Id,
|
||
|
request.TicketID,
|
||
|
)
|
||
|
if err != nil {
|
||
|
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||
|
}
|
||
|
|
||
|
return ctx.SendStatus(fiber.StatusOK)
|
||
|
}
|