UPDATE: Add some api
This commit is contained in:
@@ -12,19 +12,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type UserController struct {
|
type UserController struct {
|
||||||
service services.UserService
|
service services.UserService
|
||||||
mediaService services.MediaService
|
mediaService services.MediaService
|
||||||
verificationService services.VerificationService
|
verificationService services.VerificationService
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUserController(
|
func NewUserController(
|
||||||
svc services.UserService,
|
svc services.UserService,
|
||||||
mediaSvc services.MediaService,
|
mediaSvc services.MediaService,
|
||||||
verificationSvc services.VerificationService,
|
verificationSvc services.VerificationService,
|
||||||
) *UserController {
|
) *UserController {
|
||||||
return &UserController{
|
return &UserController{
|
||||||
service: svc,
|
service: svc,
|
||||||
mediaService: mediaSvc,
|
mediaService: mediaSvc,
|
||||||
verificationService: verificationSvc,
|
verificationService: verificationSvc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,6 +85,34 @@ func (h *UserController) GetUserMedia(c fiber.Ctx) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserApplication godoc
|
||||||
|
// @Summary Get current user's application
|
||||||
|
// @Description Retrieve application list of the currently authenticated user
|
||||||
|
// @Tags Users
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Security BearerAuth
|
||||||
|
// @Success 200 {object} response.CommonResponse
|
||||||
|
// @Failure 500 {object} response.CommonResponse
|
||||||
|
// @Router /users/current/application [get]
|
||||||
|
func (h *UserController) GetUserApplication(c fiber.Ctx) error {
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
res, err := h.verificationService.GetVerificationByUserID(ctx, c.Locals("uid").(string))
|
||||||
|
if err != nil {
|
||||||
|
return c.Status(fiber.StatusInternalServerError).JSON(response.CommonResponse{
|
||||||
|
Status: false,
|
||||||
|
Message: err.Error(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.Status(fiber.StatusOK).JSON(response.CommonResponse{
|
||||||
|
Status: true,
|
||||||
|
Data: res,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// GetMediaByUserID godoc
|
// GetMediaByUserID godoc
|
||||||
// @Summary Get user's media by user ID
|
// @Summary Get user's media by user ID
|
||||||
// @Description Retrieve media list by specific user ID
|
// @Description Retrieve media list by specific user ID
|
||||||
|
|||||||
@@ -31,6 +31,12 @@ func UserRoutes(app *fiber.App, controller *controllers.UserController, userRepo
|
|||||||
controller.GetUserMedia,
|
controller.GetUserMedia,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
route.Get(
|
||||||
|
"/current/application",
|
||||||
|
middlewares.JwtAccess(userRepo),
|
||||||
|
controller.GetUserApplication,
|
||||||
|
)
|
||||||
|
|
||||||
route.Get(
|
route.Get(
|
||||||
"/:id",
|
"/:id",
|
||||||
middlewares.JwtAccess(userRepo),
|
middlewares.JwtAccess(userRepo),
|
||||||
|
|||||||
Reference in New Issue
Block a user