Skip to content

Commit

Permalink
feat: 增加reading list接口
Browse files Browse the repository at this point in the history
  • Loading branch information
oldme-git committed Nov 22, 2024
1 parent b4e158d commit 214ca2b
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 0 deletions.
15 changes: 15 additions & 0 deletions api/reading/reading.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions api/reading/v1/reading.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package v1

import (
"github.com/gogf/gf/v2/frame/g"
"github.com/oldme-git/oldme-api/internal/model/entity"
)

type (
ReadingReq struct {
g.Meta `path:"reading" method:"get" sm:"查询阅读列表" tags:"reading"`
}

ReadingRes struct {
List []entity.Reading `json:"list"`
}
)
2 changes: 2 additions & 0 deletions internal/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/oldme-git/oldme-api/internal/controller/link"
"github.com/oldme-git/oldme-api/internal/controller/login"
"github.com/oldme-git/oldme-api/internal/controller/other"
"github.com/oldme-git/oldme-api/internal/controller/reading"
"github.com/oldme-git/oldme-api/internal/controller/reply"
"github.com/oldme-git/oldme-api/internal/controller/saying"
"github.com/oldme-git/oldme-api/internal/controller/sentence"
Expand Down Expand Up @@ -49,6 +50,7 @@ var (
saying.NewV1(),
link.NewV1(),
reply.NewV1(),
reading.NewV1(),

tag_grp.NewV1(),
tag.NewV1(),
Expand Down
5 changes: 5 additions & 0 deletions internal/controller/reading/reading.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================

package reading
15 changes: 15 additions & 0 deletions internal/controller/reading/reading_new.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================

package reading

import (
"github.com/oldme-git/oldme-api/api/reading"
)

type ControllerV1 struct{}

func NewV1() reading.IReadingV1 {
return &ControllerV1{}
}
19 changes: 19 additions & 0 deletions internal/controller/reading/reading_v1_reading.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package reading

import (
"context"

"github.com/oldme-git/oldme-api/internal/logic/reading"

"github.com/oldme-git/oldme-api/api/reading/v1"
)

func (c *ControllerV1) Reading(ctx context.Context, req *v1.ReadingReq) (res *v1.ReadingRes, err error) {
list, err := reading.List(ctx)
if err != nil {
return nil, err
}
return &v1.ReadingRes{
List: list,
}, nil
}

0 comments on commit 214ca2b

Please sign in to comment.