Refactor User Management API and Update Documentation
- Changed API tags from "Admin-Users" to "Admin-Authorization" for better clarity in user management endpoints. - Removed unused endpoints for retrieving users by company ID and role, streamlining the user management functionality. - Updated user entity and forms to reflect new example values for improved clarity in API documentation. - Enhanced pagination handling in user listing responses, ensuring consistent metadata structure. - Updated API documentation to reflect changes in endpoint structure and response formats, improving clarity for API consumers.
This commit is contained in:
+16
-18
@@ -28,20 +28,18 @@ const (
|
||||
// User represents a system user (admin/manager/operator)
|
||||
type User struct {
|
||||
mongo.Model `bson:",inline"`
|
||||
FullName string `bson:"full_name" json:"full_name"`
|
||||
Username string `bson:"username" json:"username"`
|
||||
Email string `bson:"email" json:"email"`
|
||||
Password string `bson:"password" json:"-"` // Never serialize password
|
||||
Role UserRole `bson:"role" json:"role"`
|
||||
Status UserStatus `bson:"status" json:"status"`
|
||||
Department *string `bson:"department,omitempty" json:"department,omitempty"`
|
||||
Position *string `bson:"position,omitempty" json:"position,omitempty"`
|
||||
Phone *string `bson:"phone,omitempty" json:"phone,omitempty"`
|
||||
ProfileImage *string `bson:"profile_image,omitempty" json:"profile_image,omitempty"`
|
||||
IsVerified bool `bson:"is_verified" json:"is_verified"`
|
||||
LastLoginAt *int64 `bson:"last_login_at,omitempty" json:"last_login_at,omitempty"` // Unix timestamp
|
||||
CreatedBy *string `bson:"created_by,omitempty" json:"created_by,omitempty"`
|
||||
UpdatedBy *string `bson:"updated_by,omitempty" json:"updated_by,omitempty"`
|
||||
FullName string `bson:"full_name"`
|
||||
Username string `bson:"username"`
|
||||
Email string `bson:"email"`
|
||||
Password string `bson:"password" json:"-"`
|
||||
Role UserRole `bson:"role"`
|
||||
Status UserStatus `bson:"status"`
|
||||
Department *string `bson:"department"`
|
||||
Position *string `bson:"position"`
|
||||
Phone *string `bson:"phone"`
|
||||
ProfileImage *string `bson:"profile_image"`
|
||||
IsVerified bool `bson:"is_verified"`
|
||||
LastLoginAt *int64 `bson:"last_login_at"`
|
||||
}
|
||||
|
||||
// SetID sets the user ID (implements IDSetter interface)
|
||||
@@ -54,22 +52,22 @@ func (u *User) GetID() string {
|
||||
return u.ID.Hex()
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the created timestamp (implements Timestampable interface)
|
||||
// SetCreatedAt sets the created timestamp (implements Timestamp interface)
|
||||
func (u *User) SetCreatedAt(timestamp int64) {
|
||||
u.CreatedAt = timestamp
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the updated timestamp (implements Timestampable interface)
|
||||
// SetUpdatedAt sets the updated timestamp (implements Timestamp interface)
|
||||
func (u *User) SetUpdatedAt(timestamp int64) {
|
||||
u.UpdatedAt = timestamp
|
||||
}
|
||||
|
||||
// GetCreatedAt returns the created timestamp (implements Timestampable interface)
|
||||
// GetCreatedAt returns the created timestamp (implements Timestamp interface)
|
||||
func (u *User) GetCreatedAt() int64 {
|
||||
return u.CreatedAt
|
||||
}
|
||||
|
||||
// GetUpdatedAt returns the updated timestamp (implements Timestampable interface)
|
||||
// GetUpdatedAt returns the updated timestamp (implements Timestamp interface)
|
||||
func (u *User) GetUpdatedAt() int64 {
|
||||
return u.UpdatedAt
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user