feat: add media sources
This commit is contained in:
@@ -28,3 +28,30 @@ func (c *Controller) List(ctx fiber.Ctx) error {
|
||||
|
||||
return ctx.JSON(items)
|
||||
}
|
||||
|
||||
// Show
|
||||
func (c *Controller) Show(ctx fiber.Ctx) error {
|
||||
id := ToInt64(ctx.Params("id"))
|
||||
tenantId, userId := ToInt64(ctx.Locals("tenantId")), ToInt64(ctx.Locals("userId"))
|
||||
|
||||
item, err := c.svc.GetByID(ctx.Context(), tenantId, userId, id)
|
||||
if err != nil {
|
||||
return ctx.Status(fiber.StatusInternalServerError).JSON(errorx.InternalError)
|
||||
}
|
||||
|
||||
return ctx.JSON(item)
|
||||
}
|
||||
|
||||
// Audio
|
||||
func (c *Controller) Video(ctx fiber.Ctx) error {
|
||||
mediaId := ToInt64(ctx.Params("media"))
|
||||
tenantId := ToInt64(ctx.Locals("tenantId"))
|
||||
userId := ToInt64(ctx.Locals("userId"))
|
||||
|
||||
item, err := c.svc.GetVideo(ctx.Context(), tenantId, userId, mediaId)
|
||||
if err != nil {
|
||||
return ctx.Status(fiber.StatusInternalServerError).JSON(errorx.InternalError)
|
||||
}
|
||||
|
||||
return ctx.JSON(item)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user