Refactor customer domain by removing obsolete files and updating main application structure
- Deleted customer domain files including entities, services, handlers, and forms to streamline the codebase. - Removed customer-related routes and service initializations from the main application. - Updated Swagger documentation to reflect the removal of customer endpoints and definitions. - Cleaned up the project structure to enhance maintainability and focus on user management functionality.
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
package customer
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/asaskevich/govalidator"
|
||||
)
|
||||
|
||||
// init registers custom validators
|
||||
func init() {
|
||||
// Register custom validators
|
||||
govalidator.CustomTypeTagMap.Set("unix_timestamp", govalidator.CustomTypeValidator(func(i interface{}, context interface{}) bool {
|
||||
switch v := i.(type) {
|
||||
case int64:
|
||||
// Check if timestamp is reasonable (not too old, not in the future)
|
||||
now := time.Now().Unix()
|
||||
minTimestamp := now - (100 * 365 * 24 * 60 * 60) // 100 years ago
|
||||
maxTimestamp := now + (10 * 365 * 24 * 60 * 60) // 10 years in future
|
||||
return v >= minTimestamp && v <= maxTimestamp
|
||||
case *int64:
|
||||
if v == nil {
|
||||
return true // nil is valid for optional fields
|
||||
}
|
||||
now := time.Now().Unix()
|
||||
minTimestamp := now - (100 * 365 * 24 * 60 * 60) // 100 years ago
|
||||
maxTimestamp := now + (10 * 365 * 24 * 60 * 60) // 10 years in future
|
||||
return *v >= minTimestamp && *v <= maxTimestamp
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}))
|
||||
}
|
||||
Reference in New Issue
Block a user