Spaces:
Runtime error
Runtime error
File size: 1,227 Bytes
e1a0299 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | package controllers
import (
"abdanhafidz.com/go-boilerplate/services"
"github.com/gin-gonic/gin"
)
type AssistantController interface {
GetAssistantDetail(ctx *gin.Context)
}
type assistantController struct {
assistantService services.AssistantService
}
func NewAssistantController(assistantService services.AssistantService) AssistantController {
return &assistantController{assistantService: assistantService}
}
// GetAssistantDetail godoc
// @Summary Get Assistant Detail
// @Description Return detailed information about an assistant (instructor) including nested previews of their classes.
// @Tags Assistants
// @Accept json
// @Produce json
// @Param id path string true "Assistant ID"
// @Success 200 {object} dto.AssistantDetail
// @Failure 400 {object} dto.ErrorResponse
// @Failure 404 {object} dto.ErrorResponse
// @Security BearerAuth
// @Router /api/v1/assistants/{id} [get]
func (c *assistantController) GetAssistantDetail(ctx *gin.Context) {
assistantID := ctx.Param("id")
userID := ParseUserId(ctx)
res, err := c.assistantService.GetAssistantDetail(ctx.Request.Context(), assistantID, userID)
ResponseJSON(ctx, "", res, err)
}
|