forked from teamhanko/hanko
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce hanko profile element and related api changes (teamha…
…nko#495) * feat: introduce hanko profile element and related api changes
- Loading branch information
Showing
254 changed files
with
13,813 additions
and
4,003 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
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
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,31 @@ | ||
package dto | ||
|
||
import ( | ||
"github.com/gofrs/uuid" | ||
"github.com/teamhanko/hanko/backend/persistence/models" | ||
) | ||
|
||
type EmailResponse struct { | ||
ID uuid.UUID `json:"id"` | ||
Address string `json:"address"` | ||
IsVerified bool `json:"is_verified"` | ||
IsPrimary bool `json:"is_primary"` | ||
} | ||
|
||
type EmailCreateRequest struct { | ||
Address string `json:"address"` | ||
} | ||
|
||
type EmailUpdateRequest struct { | ||
IsPrimary *bool `json:"is_primary"` | ||
} | ||
|
||
// FromEmailModel Converts the DB model to a DTO object | ||
func FromEmailModel(email *models.Email) *EmailResponse { | ||
return &EmailResponse{ | ||
ID: email.ID, | ||
Address: email.Address, | ||
IsVerified: email.Verified, | ||
IsPrimary: email.IsPrimary(), | ||
} | ||
} |
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
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,28 @@ | ||
package dto | ||
|
||
import ( | ||
"github.com/gofrs/uuid" | ||
"github.com/teamhanko/hanko/backend/persistence/models" | ||
"time" | ||
) | ||
|
||
type CreateUserResponse struct { | ||
ID uuid.UUID `json:"id"` // deprecated | ||
UserID uuid.UUID `json:"user_id"` | ||
EmailID uuid.UUID `json:"email_id"` | ||
} | ||
|
||
type GetUserResponse struct { | ||
ID uuid.UUID `json:"id"` | ||
Email *string `json:"email,omitempty"` | ||
WebauthnCredentials []models.WebauthnCredential `json:"webauthn_credentials"` // deprecated | ||
UpdatedAt time.Time `json:"updated_at"` | ||
CreatedAt time.Time `json:"created_at"` | ||
} | ||
|
||
type UserInfoResponse struct { | ||
ID uuid.UUID `json:"id"` | ||
EmailID uuid.UUID `json:"email_id"` | ||
Verified bool `json:"verified"` | ||
HasWebauthnCredential bool `json:"has_webauthn_credential"` | ||
} |
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,34 @@ | ||
package dto | ||
|
||
import ( | ||
"github.com/gofrs/uuid" | ||
"github.com/teamhanko/hanko/backend/persistence/models" | ||
"time" | ||
) | ||
|
||
type WebauthnCredentialUpdateRequest struct { | ||
Name *string `json:"name"` | ||
} | ||
|
||
type WebauthnCredentialResponse struct { | ||
ID string `json:"id"` | ||
Name *string `json:"name,omitempty"` | ||
PublicKey string `json:"public_key"` | ||
AttestationType string `json:"attestation_type"` | ||
AAGUID uuid.UUID `json:"aaguid"` | ||
CreatedAt time.Time `json:"created_at"` | ||
Transports []string `json:"transports"` | ||
} | ||
|
||
// FromWebauthnCredentialModel Converts the DB model to a DTO object | ||
func FromWebauthnCredentialModel(c *models.WebauthnCredential) *WebauthnCredentialResponse { | ||
return &WebauthnCredentialResponse{ | ||
ID: c.ID, | ||
Name: c.Name, | ||
PublicKey: c.PublicKey, | ||
AttestationType: c.AttestationType, | ||
AAGUID: c.AAGUID, | ||
CreatedAt: c.CreatedAt, | ||
Transports: c.Transports.GetNames(), | ||
} | ||
} |
Oops, something went wrong.