added repo method CheckLeadTargetOwner
This commit is contained in:
parent
54f47a2cf8
commit
a39660f6e1
@ -3,11 +3,12 @@ package account
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/google/uuid"
|
|
||||||
"gitea.pena/SQuiz/common/dal/sqlcgen"
|
"gitea.pena/SQuiz/common/dal/sqlcgen"
|
||||||
"gitea.pena/SQuiz/common/model"
|
"gitea.pena/SQuiz/common/model"
|
||||||
"gitea.pena/SQuiz/common/pj_errors"
|
"gitea.pena/SQuiz/common/pj_errors"
|
||||||
|
"github.com/google/uuid"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -456,3 +457,18 @@ func (r *AccountRepository) UpdateLeadTarget(ctx context.Context, req model.Lead
|
|||||||
InviteLink: row.Invitelink,
|
InviteLink: row.Invitelink,
|
||||||
}, nil
|
}, 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