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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

60
docs/tag_order.go Normal file
View File

@@ -0,0 +1,60 @@
package docs
import "strings"
// Swagger tag order for Swagger UI. Listed first appears at the top.
var swaggerTagOrder = []struct {
Name string
Description string
}{
{Name: "auth", Description: "Authentication"},
{Name: "location", Description: "Locations"},
{Name: "province", Description: "Provinces"},
{Name: "branches", Description: "Branches"},
{Name: "payment-card", Description: "Payment cards"},
{Name: "reason-card", Description: "Reason cards"},
{Name: "loan-type", Description: "Loan types"},
{Name: "loan-document", Description: "Loan required documents"},
}
func applySwaggerTagOrder() {
const anchor = ` },
"securityDefinitions": {`
if !strings.Contains(SwaggerInfo.SwaggerTemplate, anchor) {
return
}
if strings.Contains(SwaggerInfo.SwaggerTemplate, ` "tags": [
{"name": "auth"`) {
return
}
SwaggerInfo.SwaggerTemplate = strings.Replace(
SwaggerInfo.SwaggerTemplate,
anchor,
` },
`+buildSwaggerTagsJSON()+`"securityDefinitions": {`,
1,
)
}
func buildSwaggerTagsJSON() string {
var b strings.Builder
b.WriteString(`"tags": [`)
for i, tag := range swaggerTagOrder {
if i > 0 {
b.WriteString(",")
}
b.WriteString(`{"name":`)
b.WriteString(jsonString(tag.Name))
b.WriteString(`,"description":`)
b.WriteString(jsonString(tag.Description))
b.WriteString("}")
}
b.WriteString(`],
`)
return b.String()
}
func jsonString(value string) string {
return `"` + strings.ReplaceAll(value, `"`, `\"`) + `"`
}