-
Notifications
You must be signed in to change notification settings - Fork 872
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: return complete user in admin API
add username, identities and password credential to the return object when calling /users/{user_id} from the admin API
- Loading branch information
1 parent
951c061
commit d3fb41b
Showing
6 changed files
with
136 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package admin | ||
|
||
import ( | ||
"github.com/gofrs/uuid" | ||
"github.com/teamhanko/hanko/backend/persistence/models" | ||
"time" | ||
) | ||
|
||
type Identity struct { | ||
ID uuid.UUID `json:"id"` | ||
ProviderID string `json:"provider_id"` | ||
ProviderName string `json:"provider_name"` | ||
EmailID uuid.UUID `json:"email_id"` | ||
CreatedAt time.Time `json:"created_at"` | ||
UpdatedAt time.Time `json:"updated_at"` | ||
} | ||
|
||
func FromIdentityModel(model models.Identity) Identity { | ||
return Identity{ | ||
ID: model.ID, | ||
ProviderID: model.ProviderID, | ||
ProviderName: model.ProviderName, | ||
EmailID: model.EmailID, | ||
CreatedAt: model.CreatedAt, | ||
UpdatedAt: model.UpdatedAt, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package admin | ||
|
||
import ( | ||
"github.com/gofrs/uuid" | ||
"time" | ||
) | ||
|
||
type PasswordCredential struct { | ||
ID uuid.UUID `json:"id"` | ||
CreatedAt time.Time `json:"created_at"` | ||
UpdatedAt time.Time `json:"updated_at"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package admin | ||
|
||
import ( | ||
"github.com/gofrs/uuid" | ||
"github.com/teamhanko/hanko/backend/persistence/models" | ||
"time" | ||
) | ||
|
||
type Username struct { | ||
ID uuid.UUID `json:"id"` | ||
Username string `json:"username"` | ||
CreatedAt time.Time `json:"created_at"` | ||
UpdatedAt time.Time `json:"updated_at"` | ||
} | ||
|
||
// FromEmailModel Converts the DB model to a DTO object | ||
func FromUsernameModel(model *models.Username) *Username { | ||
return &Username{ | ||
ID: model.ID, | ||
Username: model.Username, | ||
CreatedAt: model.CreatedAt, | ||
UpdatedAt: model.UpdatedAt, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters