feat: add pagination for users & verification_requests

This commit is contained in:
Lakhan Samani
2022-01-25 10:57:40 +05:30
parent 8df8010b22
commit 9bd185a9c6
19 changed files with 962 additions and 100 deletions

View File

@@ -1,5 +1,7 @@
package models
import "github.com/authorizerdev/authorizer/server/graph/model"
// VerificationRequest model for db
type VerificationRequest struct {
Key string `json:"_key,omitempty" bson:"_key"` // for arangodb
@@ -11,3 +13,15 @@ type VerificationRequest struct {
UpdatedAt int64 `gorm:"autoUpdateTime" json:"updated_at" bson:"updated_at"`
Email string `gorm:"uniqueIndex:idx_email_identifier" json:"email" bson:"email"`
}
func (v *VerificationRequest) AsAPIVerificationRequest() *model.VerificationRequest {
return &model.VerificationRequest{
ID: v.ID,
Token: &v.Token,
Identifier: &v.Identifier,
Expires: &v.ExpiresAt,
CreatedAt: &v.CreatedAt,
UpdatedAt: &v.UpdatedAt,
Email: &v.Email,
}
}