added repo method CheckLeadTargetOwner
This commit is contained in:
parent
54f47a2cf8
commit
a39660f6e1
@ -3,11 +3,12 @@ package account
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/google/uuid"
|
||||
"gitea.pena/SQuiz/common/dal/sqlcgen"
|
||||
"gitea.pena/SQuiz/common/model"
|
||||
"gitea.pena/SQuiz/common/pj_errors"
|
||||
"github.com/google/uuid"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@ -456,3 +457,18 @@ func (r *AccountRepository) UpdateLeadTarget(ctx context.Context, req model.Lead
|
||||
InviteLink: row.Invitelink,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *AccountRepository) CheckLeadTargetOwner(ctx context.Context, accountID string, leadID int64) (bool, error) {
|
||||
id, err := r.queries.CheckLeadTargetOwner(ctx, sqlcgen.CheckLeadTargetOwnerParams{
|
||||
Accountid: accountID,
|
||||
ID: leadID,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
return accountID == id, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user