Spaces:
Runtime error
Runtime error
| 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) | |
| } | |