refactor: enhance parameter descriptions and standardize model fields

- Added descriptive annotations to various parameters across controllers to improve API documentation clarity.
- Standardized field definitions in models by including descriptions for better understanding of their purpose.
- Updated validation patterns for ID fields to ensure consistency and improve data integrity.
- Enhanced overall code readability and maintainability by aligning naming conventions and adding necessary comments.
This commit is contained in:
Marvin Zhang
2025-03-19 13:39:02 +08:00
parent 13ce1d551b
commit 931a36c8bf
41 changed files with 551 additions and 400 deletions

View File

@@ -32,9 +32,7 @@ func ToSnakeCase(s string) string {
}
func ToPascalCase(s string) string {
s = strings.TrimSpace(s)
s = strings.ReplaceAll(s, "_", " ")
s = cases.Title(language.English).String(s)
s = Capitalize(s)
s = strings.ReplaceAll(s, " ", "")
return s
}
@@ -45,6 +43,15 @@ func ToKebabCase(s string) string {
return replaceChars(s, []string{" ", "_", "."}, "-")
}
func Capitalize(s string) string {
s = strings.TrimSpace(s)
for _, char := range []string{" ", "_", "-", "/"} {
s = strings.ReplaceAll(s, char, " ")
}
s = cases.Title(language.English).String(s)
return s
}
// splitStringWithQuotes splits a string with quotes
// Parameters:
// - s: the string to split