完善功能
This commit is contained in:
29
internal/controller/book/book_v1_edit.go
Normal file
29
internal/controller/book/book_v1_edit.go
Normal file
@ -0,0 +1,29 @@
|
||||
package book
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "server/api/book/v1"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) Edit(ctx context.Context, req *v1.EditReq) (res *v1.EditRes, err error) {
|
||||
out, err := service.Book().Update(ctx, &model.BookEditIn{
|
||||
Id: req.Id,
|
||||
AuthorId: req.AuthorId,
|
||||
CategoryId: req.CategoryId,
|
||||
Title: req.Title,
|
||||
CoverUrl: req.CoverUrl,
|
||||
Description: req.Description,
|
||||
Status: req.Status,
|
||||
Tags: req.Tags,
|
||||
IsRecommended: req.IsRecommended,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.EditRes{
|
||||
Success: out.Success,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user