From 611556f99ced0ac53e5910422a73ae87a8588d15 Mon Sep 17 00:00:00 2001 From: Diptesh Choudhuri Date: Mon, 16 Oct 2023 18:12:21 +0530 Subject: [PATCH] refactor(backend): change order of funcs --- backend/persistence/user_persister.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/backend/persistence/user_persister.go b/backend/persistence/user_persister.go index 74d57ff7f..07b3def40 100644 --- a/backend/persistence/user_persister.go +++ b/backend/persistence/user_persister.go @@ -28,19 +28,6 @@ func NewUserPersister(db *pop.Connection) UserPersister { return &userPersister{db: db} } -func (p *userPersister) All() ([]models.User, error) { - users := []models.User{} - err := p.db.EagerPreload("Emails", "Emails.PrimaryEmail", "Emails.Identity", "WebauthnCredentials").All(&users) - if err != nil && errors.Is(err, sql.ErrNoRows) { - return users, nil - } - if err != nil { - return nil, fmt.Errorf("failed to fetch users: %w", err) - } - - return users, nil -} - func (p *userPersister) Get(id uuid.UUID) (*models.User, error) { user := models.User{} err := p.db.EagerPreload("Emails", "Emails.PrimaryEmail", "Emails.Identity", "WebauthnCredentials").Find(&user, id) @@ -126,6 +113,19 @@ func (p *userPersister) List(page int, perPage int, userId uuid.UUID, email stri return users, nil } +func (p *userPersister) All() ([]models.User, error) { + users := []models.User{} + err := p.db.EagerPreload("Emails", "Emails.PrimaryEmail", "Emails.Identity", "WebauthnCredentials").All(&users) + if err != nil && errors.Is(err, sql.ErrNoRows) { + return users, nil + } + if err != nil { + return nil, fmt.Errorf("failed to fetch users: %w", err) + } + + return users, nil +} + func (p *userPersister) Count(userId uuid.UUID, email string) (int, error) { query := p.db. Q().