完善功能
This commit is contained in:
24
internal/controller/author/author_v1_edit.go
Normal file
24
internal/controller/author/author_v1_edit.go
Normal file
@ -0,0 +1,24 @@
|
||||
package author
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "server/api/author/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.Author().Update(ctx, &model.AuthorEditIn{
|
||||
Id: req.Id,
|
||||
PenName: req.PenName,
|
||||
Bio: req.Bio,
|
||||
Status: req.Status,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.EditRes{
|
||||
Success: out.Success,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user