Align schema, API routes, and auth with updated admin domain model.

Rename users table fields and loan documents table, expand branch billing credentials, switch to /api/admin prefix, refactor auth endpoints, replace PATCH with PUT for status updates, remove file upload APIs, and regenerate Swagger with ordered tags.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-06 14:09:45 +05:00
parent 0c717101da
commit 82e1aad016
22 changed files with 4248 additions and 418 deletions

47
app.go
View File

@@ -3,8 +3,7 @@ package main
import (
"context"
_ "online-back/docs"
"online-back/internal/admin/auth"
"online-back/docs"
"online-back/internal/config"
handlermanager "online-back/internal/handlers/manager"
"online-back/pkg/client/postgresql"
@@ -15,32 +14,39 @@ import (
ginSwagger "github.com/swaggo/gin-swagger"
)
// @title Service APIs
// @title Service APIs
// @version 1.0
// @description Online payment system admin API.
// @termsOfService http://swagger.io/terms/
// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email support@swagger.io
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
// @host localhost:5050
// @BasePath /v1/admin
// @BasePath /api/admin
// @securityDefinitions.apikey BearerAuth
// @in header
// @name Authorization
// @tag.name auth
// @tag.name province
// @tag.name location
// @tag.name branches
// @tag.name payment-card
// @tag.name reason-card
// @tag.name loan-type
// @tag.name loan-document
// @Success 200 {object} appresult.AppSuccess "Success Code"
// @Failure 400 {object} appresult.AppError "Error Code"
// @schemes http
// @tag.name auth
// @tag.description Authentication
// @tag.name location
// @tag.description Locations
// @tag.name province
// @tag.description Provinces
// @tag.name branches
// @tag.description Branches
// @tag.name payment-card
// @tag.description Payment cards
// @tag.name reason-card
// @tag.description Reason cards
// @tag.name loan-type
// @tag.description Loan types
// @tag.name loan-document
// @tag.description Loan required documents
func main() {
docs.SwaggerInfo.Title = "Service APIs"
docs.SwaggerInfo.Version = "1.0"
docs.SwaggerInfo.Description = "Online payment system admin API."
docs.SwaggerInfo.Host = "localhost:5050"
docs.SwaggerInfo.BasePath = "/api/admin"
docs.SwaggerInfo.Schemes = []string{"http"}
cfg := config.GetConfig()
logger := logging.GetLogger()
@@ -48,7 +54,6 @@ func main() {
router := handlermanager.New(cfg, pool, logger)
router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
router.GET("/images/:id", auth.GetObject)
addr := cfg.Listen.BindIP + ":" + cfg.Listen.Port
logger.Infof("starting server on %s", addr)