fix: issues
This commit is contained in:
@@ -2,6 +2,7 @@ package medias
|
||||
|
||||
import (
|
||||
"backend/pkg/consts"
|
||||
"backend/pkg/errorx"
|
||||
"backend/pkg/pg"
|
||||
"backend/providers/jwt"
|
||||
|
||||
@@ -48,6 +49,9 @@ func (c *Controller) Show(ctx fiber.Ctx) error {
|
||||
hash := ctx.Params("hash")
|
||||
claim := fiber.Locals[*jwt.Claims](ctx, consts.CtxKeyClaim)
|
||||
log.Debug(claim)
|
||||
if claim == nil {
|
||||
return errorx.RequestUnAuthorized
|
||||
}
|
||||
|
||||
model, err := c.svc.GetMediaByHash(ctx.Context(), claim.TenantID, hash)
|
||||
if err != nil {
|
||||
@@ -75,6 +79,9 @@ func (c *Controller) MediaIndex(ctx fiber.Ctx) error {
|
||||
hash := ctx.Params("hash")
|
||||
claim := fiber.Locals[*jwt.Claims](ctx, consts.CtxKeyClaim)
|
||||
log.Debug(claim)
|
||||
if claim == nil {
|
||||
return errorx.RequestUnAuthorized
|
||||
}
|
||||
|
||||
model, err := c.svc.GetMediaByHash(ctx.Context(), claim.TenantID, hash)
|
||||
if err != nil {
|
||||
@@ -113,6 +120,9 @@ func (c *Controller) MediaSegment(ctx fiber.Ctx) error {
|
||||
hash := ctx.Params("hash")
|
||||
claim := fiber.Locals[*jwt.Claims](ctx, consts.CtxKeyClaim)
|
||||
log.Debug(claim)
|
||||
if claim == nil {
|
||||
return errorx.RequestUnAuthorized
|
||||
}
|
||||
|
||||
model, err := c.svc.GetMediaByHash(ctx.Context(), claim.TenantID, hash)
|
||||
if err != nil {
|
||||
@@ -129,6 +139,9 @@ func (c *Controller) Checkout(ctx fiber.Ctx) error {
|
||||
hash := ctx.Params("hash")
|
||||
claim := fiber.Locals[*jwt.Claims](ctx, consts.CtxKeyClaim)
|
||||
log.Debug(claim)
|
||||
if claim == nil {
|
||||
return errorx.RequestUnAuthorized
|
||||
}
|
||||
|
||||
model, err := c.svc.GetMediaByHash(ctx.Context(), claim.TenantID, hash)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user