Skip to content

Commit

Permalink
update tiket postman
Browse files Browse the repository at this point in the history
  • Loading branch information
rezapace committed Dec 1, 2023
1 parent 8ab3cd7 commit 3488226
Show file tree
Hide file tree
Showing 5 changed files with 2,293 additions and 1,090 deletions.
5 changes: 5 additions & 0 deletions %USERPROFILE%/go/bin/pkg/sumdb/sum.golang.org/latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
go.sum database tree
20857462
Kn0F1e8O8fQOl6YvfyegETTq1tmu1qpkfDZj5AtvhWI=

— sum.golang.org Az3gru8zyaj7EuaczqV+hDOTF+63AeV8mvhZHqRv6bbiV3gaYIvN9DnNHoSzVwNBCGSXS7qp50Ui6l9wNpxiJmNpwAc=
16 changes: 14 additions & 2 deletions internal/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,26 @@ import (
func BuildPublicRoutes(cfg *config.Config, db *gorm.DB) []*router.Route {
registrationRepository := repository.NewRegistrationRepository(db)
registrationService := service.NewRegistrationService(registrationRepository)
userRepository := repository.NewUserRepository(db) // kenapa make ini? karena nge find email nya dari user_repository

userRepository := repository.NewUserRepository(db)
loginService := service.NewLoginService(userRepository)
tokenService := service.NewTokenService(cfg)

BlogRepository := repository.NewBlogRepository(db)
BlogService := service.NewBlogService(BlogRepository)
BlogHandler := handler.NewBlogHandler(BlogService)

ticketRepository := repository.NewTicketRepository(db)
ticketService := service.NewTicketService(ticketRepository)
ticketHandler := handler.NewTicketHandler(ticketService)

authHandler := handler.NewAuthHandler(registrationService, loginService, tokenService)

return router.PublicRoutes(authHandler)
// Update the line below with the additional TicketHandler argument
return router.PublicRoutes(authHandler, ticketHandler, BlogHandler) // Update this line
}


func BuildPrivateRoutes(cfg *config.Config, db *gorm.DB) []*router.Route {
// Create a user handler
userRepository := repository.NewUserRepository(db)
Expand Down
12 changes: 11 additions & 1 deletion internal/http/router/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Route struct {

// membuat fungsi untuk mengembalikan route
// pada func ini perlu login krna private
func PublicRoutes(authHandler *handler.AuthHandler) []*Route {
func PublicRoutes(authHandler *handler.AuthHandler, TicketHandler *handler.TicketHandler, BlogHandler *handler.BlogHandler) []*Route {
return []*Route{
{
Method: echo.POST,
Expand All @@ -39,6 +39,16 @@ func PublicRoutes(authHandler *handler.AuthHandler) []*Route {
Path: "/register",
Handler: authHandler.Registration,
},
{
Method: echo.GET,
Path: "/public/blog",
Handler: BlogHandler.GetAllBlogs,
},
{
Method: echo.GET,
Path: "/public/ticket",
Handler: TicketHandler.GetAllTickets,
},
}
}

Expand Down
Loading

0 comments on commit 3488226

Please sign in to comment.