package feedback

import (
	"context"
	"server/internal/model"
	"server/internal/service"

	"server/api/feedback/v1"
)

func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) {
	out, err := service.Feedback().List(ctx, &model.FeedbackListIn{
		Page:   req.Page,
		Size:   req.Size,
		Status: req.Status,
		UserId: req.UserId,
	})
	if err != nil {
		return nil, err
	}
	return &v1.ListRes{
		Total: out.Total,
		List:  out.List,
	}, nil
}
