Skip to content

Commit

Permalink
update api
Browse files Browse the repository at this point in the history
  • Loading branch information
gsxhnd committed Apr 30, 2024
1 parent b1f2270 commit 4bc25fb
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
2 changes: 2 additions & 0 deletions garage_di/wire_gen.go

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

15 changes: 15 additions & 0 deletions garage_server/handler/crawl_handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package handler

import "github.com/gsxhnd/garage/utils"

type CrawlHandler interface{}

type crawlHnadler struct {
logger utils.Logger
}

func NewCrwalHandler(l utils.Logger) CrawlHandler {
return crawlHnadler{
logger: l,
}
}
4 changes: 3 additions & 1 deletion garage_server/handler/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ import (
type Handler struct {
RootHandler RootHandler
WebsocketHandler WebsocketHandler
CrawlHandler CrawlHandler
JavHandler JavHandler
FFmpegHander FFmpegHandler
}

var HandlerSet = wire.NewSet(
NewPingHandle,
NewRootHandle,

Check failure on line 16 in garage_server/handler/init.go

View workflow job for this annotation

GitHub Actions / Test

undefined: NewRootHandle
NewWebsocketHandler,
NewJavHandler,
NewFFmpegHandler,
NewCrwalHandler,
wire.Struct(new(Handler), "*"),
)
4 changes: 2 additions & 2 deletions garage_server/handler/jav_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

type JavHandler interface {
CrawlJavByCode(ctx *fiber.Ctx) error
CrawlJavbus(ctx *fiber.Ctx) error
}

type javHnadler struct {
Expand All @@ -25,6 +25,6 @@ func NewJavHandler(l utils.Logger, v *validator.Validate, t task.TaskMgr) JavHan
}
}

func (h *javHnadler) CrawlJavByCode(ctx *fiber.Ctx) error {
func (h *javHnadler) CrawlJavbus(ctx *fiber.Ctx) error {
return ctx.SendString("CrawlJavByCode")
}
11 changes: 10 additions & 1 deletion garage_server/routes/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ func (r *router) ApiInit() {
ffmpegGroup.Post("/add_fonts", r.h.FFmpegHander.AddFonts)
ffmpegGroup.Post("/add_subtitle", r.h.FFmpegHander.AddSubtitle)

crawlGroup := api.Group("/crawl")
crawlGroup.Post("/javbus", r.h.JavHandler.CrawlJavbus)
crawlGroup.Post("/javdb")
crawlGroup.Post("/tenhou")

javGroup := api.Group("/jav")
javGroup.Post("/code", r.h.JavHandler.CrawlJavByCode)
javGroup.Get("/")
javGroup.Get("/code/:code")
javGroup.Get("/star_code/:code")
javGroup.Put("/code/:code")
javGroup.Put("/star_code/:code")
}

0 comments on commit 4bc25fb

Please sign in to comment.