27 lines
507 B
Go
27 lines
507 B
Go
package chapter
|
|
|
|
import (
|
|
"context"
|
|
"server/internal/model"
|
|
"server/internal/service"
|
|
|
|
"server/api/chapter/v1"
|
|
)
|
|
|
|
func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) {
|
|
out, err := service.Chapter().List(ctx, &model.ChapterListIn{
|
|
BookId: req.BookId,
|
|
IsLocked: req.IsLocked,
|
|
Page: req.Page,
|
|
Size: req.Size,
|
|
Title: req.Title,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.ListRes{
|
|
List: out.List,
|
|
Total: out.Total,
|
|
}, nil
|
|
}
|