初始化项目框架,完成部分接口开发
This commit is contained in:
27
internal/controller/book/book_v1_book_edit.go
Normal file
27
internal/controller/book/book_v1_book_edit.go
Normal file
@ -0,0 +1,27 @@
|
||||
package book
|
||||
|
||||
import (
|
||||
"context"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
|
||||
"server/api/book/v1"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) BookEdit(ctx context.Context, req *v1.BookEditReq) (res *v1.BookEditRes, err error) {
|
||||
out, err := service.Book().Update(ctx, &model.BookEditIn{
|
||||
AuthorId: req.AuthorId,
|
||||
CategoryId: req.CategoryId,
|
||||
CoverUrl: req.CoverUrl,
|
||||
Description: req.Description,
|
||||
Id: req.Id,
|
||||
IsRecommended: req.IsRecommended,
|
||||
Status: req.Status,
|
||||
Tags: req.Tags,
|
||||
Title: req.Title,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v1.BookEditRes{Success: out.Success}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user