move todo
This commit is contained in:
parent
dafb97288f
commit
d49e16dd3e
@ -90,13 +90,18 @@ type PutFileResp struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// todo чекнуть надо как я переписал
|
||||
func (o *OtherController) PutFile(ctx *fiber.Ctx) error {
|
||||
sess := jwt_adapter.Get(ctx.Context())
|
||||
if sess == nil {
|
||||
return ctx.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "not authorized"})
|
||||
}
|
||||
|
||||
domain, ok := ctx.Context().Value(middleware.HostKey).(string)
|
||||
if !ok || domain == "" {
|
||||
fmt.Println("domain is nil err")
|
||||
return ctx.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "domain is nil"})
|
||||
}
|
||||
|
||||
form, err := ctx.MultipartForm()
|
||||
if err != nil {
|
||||
return ctx.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "can not parse multipart: " + err.Error()})
|
||||
@ -257,11 +262,6 @@ func (o *OtherController) PutFile(ctx *fiber.Ctx) error {
|
||||
return ctx.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": "can not store message: " + err.Error()})
|
||||
}
|
||||
|
||||
domain, ok := ctx.Context().Value(middleware.HostKey).(string)
|
||||
if !ok || domain == "" {
|
||||
fmt.Println("domain is nil err")
|
||||
return ctx.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "domain is nil"})
|
||||
}
|
||||
role := jwt_adapter.GetRole(ctx.Context())
|
||||
go func() {
|
||||
if sess.Id != "" && role != "admin" {
|
||||
@ -312,7 +312,6 @@ type PutSCResp struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// todo чекнуть надо как я переписал
|
||||
func (o *OtherController) PutSC(ctx *fiber.Ctx) error {
|
||||
form, err := ctx.MultipartForm()
|
||||
if err != nil {
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
|
||||
func (t *TicketController) Register(router fiber.Router) {
|
||||
router.Post("/create", t.CreateTicket)
|
||||
router.Get("/subscribe", tools.SseWrapper(t.GetList)) // sse todo
|
||||
router.Get("/ticket", tools.SseWrapper(t.Subscribe)) // sse todo
|
||||
router.Get("/subscribe", tools.SseWrapper(t.GetList))
|
||||
router.Get("/ticket", tools.SseWrapper(t.Subscribe))
|
||||
router.Post("/send", t.PutMessage)
|
||||
router.Post("/getTickets", t.GetTickets)
|
||||
router.Post("/getMessages", t.GetMessages)
|
||||
|
@ -113,7 +113,7 @@ func (t *TicketController) CreateTicket(ctx *fiber.Ctx) error {
|
||||
|
||||
domain, ok := ctx.Context().Value(middleware.HostKey).(string)
|
||||
if !ok || domain == "" {
|
||||
t.zapLogger.Error("domain is nil err")
|
||||
return ctx.Status(fiber.StatusBadRequest).JSON(fiber.Map{"error": "domain is nil"})
|
||||
}
|
||||
|
||||
go func() {
|
||||
@ -121,7 +121,7 @@ func (t *TicketController) CreateTicket(ctx *fiber.Ctx) error {
|
||||
if err == nil && t.notifier != nil {
|
||||
var userLink, supportLink string
|
||||
if session.StandardClaims.Issuer != "" {
|
||||
if domain[0] == 's' {
|
||||
if len(domain) > 0 && domain[0] == 's' {
|
||||
userLink = fmt.Sprintf("https://sadmin.pena/users/%s", session.Id)
|
||||
supportLink = fmt.Sprintf("https://sadmin.pena/support/%s", ticketID)
|
||||
} else {
|
||||
@ -129,7 +129,7 @@ func (t *TicketController) CreateTicket(ctx *fiber.Ctx) error {
|
||||
supportLink = fmt.Sprintf("https://admin.pena/support/%s", ticketID)
|
||||
}
|
||||
} else {
|
||||
if domain[0] == 's' {
|
||||
if len(domain) > 0 && domain[0] == 's' {
|
||||
supportLink = fmt.Sprintf("https://sadmin.pena/support/%s", ticketID)
|
||||
} else {
|
||||
supportLink = fmt.Sprintf("https://admin.pena/support/%s", ticketID)
|
||||
@ -238,6 +238,7 @@ func (t *TicketController) PutMessage(ctx *fiber.Ctx) error {
|
||||
|
||||
if err := t.dal.UpdateTopMessage(ctx.Context(), request.TicketID, message); err != nil {
|
||||
fmt.Println("PUTMES01", err, request.TicketID, message)
|
||||
return ctx.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": err.Error()})
|
||||
//return errors.New("can not update ticket"), http.StatusInternalServerError
|
||||
}
|
||||
|
||||
@ -411,7 +412,6 @@ func (t *TicketController) SetShown(ctx *fiber.Ctx) error {
|
||||
return ctx.SendStatus(fiber.StatusOK)
|
||||
}
|
||||
|
||||
// todo екнуть как работает
|
||||
var _ tools.DataEmitter = (&TicketController{}).GetList
|
||||
|
||||
func (t *TicketController) GetList(ctx context.Context) chan interface{} {
|
||||
|
Loading…
Reference in New Issue
Block a user