MCPcopy
hub / github.com/PatchMon/PatchMon / userToAdminResponse

Function userToAdminResponse

server-source-code/internal/handler/users.go:539–555  ·  view source on GitHub ↗
(u *models.User)

Source from the content-addressed store, hash-verified

537}
538
539func userToAdminResponse(u *models.User) map[string]interface{} {
540 res := map[string]interface{}{
541 "id": u.ID, "username": u.Username, "email": u.Email, "role": u.Role,
542 "is_active": u.IsActive, "created_at": u.CreatedAt, "updated_at": u.UpdatedAt,
543 }
544 if u.FirstName != nil {
545 res["first_name"] = *u.FirstName
546 }
547 if u.LastName != nil {
548 res["last_name"] = *u.LastName
549 }
550 if u.LastLogin != nil {
551 res["last_login"] = u.LastLogin.Format(time.RFC3339)
552 }
553 res["avatar_url"] = u.AvatarURL
554 return res
555}

Callers 3

ListMethod · 0.85
CreateMethod · 0.85
UpdateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected