add invite to space feature

This commit is contained in:
juancwu 2026-01-14 21:11:16 +00:00
commit 4d6e6799a0
10 changed files with 407 additions and 8 deletions

View file

@ -11,10 +11,10 @@ import (
)
func SetupRoutes(a *app.App) http.Handler {
auth := handler.NewAuthHandler(a.AuthService)
auth := handler.NewAuthHandler(a.AuthService, a.InviteService)
home := handler.NewHomeHandler()
dashboard := handler.NewDashboardHandler()
space := handler.NewSpaceHandler(a.SpaceService, a.TagService, a.ShoppingListService, a.ExpenseService)
space := handler.NewSpaceHandler(a.SpaceService, a.TagService, a.ShoppingListService, a.ExpenseService, a.InviteService)
mux := http.NewServeMux()
@ -103,6 +103,13 @@ func SetupRoutes(a *app.App) http.Handler {
createExpenseWithAccess := middleware.RequireSpaceAccess(a.SpaceService)(createExpenseHandler)
mux.Handle("POST /app/spaces/{spaceID}/expenses", createExpenseWithAccess)
// Invite routes
createInviteHandler := middleware.RequireAuth(space.CreateInvite)
createInviteWithAccess := middleware.RequireSpaceAccess(a.SpaceService)(createInviteHandler)
mux.Handle("POST /app/spaces/{spaceID}/invites", createInviteWithAccess)
mux.HandleFunc("GET /join/{token}", space.JoinSpace)
// 404
mux.HandleFunc("/{path...}", home.NotFoundPage)