Files
online-backend/internal/org/router.go
GuwandykA 1987d4f596 Add region and etrap APIs for branch create form.
Expose distinct regions and etraps-by-region under provinces and branches, and seed real etraps per welayat.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 12:12:07 +05:00

32 lines
1022 B
Go

// Package org groups the organizational/geographic hierarchy (provinces and
// branches) under one bounded context, replacing the flat internal/admin/*
// listing.
package org
import (
"online-back/internal/handlers"
"online-back/internal/org/branches"
branchesdb "online-back/internal/org/branches/db"
"online-back/internal/org/province"
provincedb "online-back/internal/org/province/db"
"online-back/pkg/client/postgresql"
"online-back/pkg/logging"
"github.com/gin-gonic/gin"
)
// Register wires every org module's handler onto router.
func Register(router *gin.RouterGroup, client postgresql.Client, logger *logging.Logger) {
for _, h := range Handlers(client, logger) {
h.Register(router)
}
}
func Handlers(client postgresql.Client, logger *logging.Logger) []handlers.Handler {
provinceRepo := provincedb.NewRepository(client, logger)
return []handlers.Handler{
province.NewHandler(logger, provinceRepo),
branches.NewHandler(logger, branchesdb.NewRepository(client, logger), provinceRepo),
}
}