30 lines
619 B
Go
30 lines
619 B
Go
package book
|
|
|
|
import (
|
|
"context"
|
|
v1 "server/api/book/v1"
|
|
"server/internal/model"
|
|
"server/internal/service"
|
|
)
|
|
|
|
func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) {
|
|
out, err := service.Book().List(ctx, &model.BookListIn{
|
|
Page: req.Page,
|
|
Size: req.Size,
|
|
Title: req.Title,
|
|
CategoryId: req.CategoryId,
|
|
AuthorId: req.AuthorId,
|
|
Status: req.Status,
|
|
IsRecommended: req.IsRecommended,
|
|
Sort: req.Sort,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &v1.ListRes{
|
|
Total: out.Total,
|
|
List: out.List,
|
|
}, nil
|
|
}
|