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:
1548
docs/docs.go
1548
docs/docs.go
File diff suppressed because it is too large
Load Diff
1542
docs/swagger.json
1542
docs/swagger.json
File diff suppressed because it is too large
Load Diff
1027
docs/swagger.yaml
1027
docs/swagger.yaml
File diff suppressed because it is too large
Load Diff
60
docs/tag_order.go
Normal file
60
docs/tag_order.go
Normal 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, `"`, `\"`) + `"`
|
||||
}
|
||||
Reference in New Issue
Block a user