ch some
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
2026-09-04 19:33:26 +05:00
parent 28509eb4ca
commit d1a6fcaadc
102 changed files with 2089 additions and 1957 deletions

View File

@@ -8,6 +8,7 @@ import (
"online-back/internal/identity/userbranch"
"online-back/pkg/client/postgresql"
"online-back/pkg/logging"
"online-back/pkg/repository/genericrepo"
"github.com/jackc/pgx/v4"
)
@@ -61,21 +62,10 @@ func (r *repository) GetByID(ctx context.Context, id int64) (userbranch.UserBran
}
func (r *repository) Delete(ctx context.Context, id int64) error {
tag, err := r.client.Exec(ctx, `DELETE FROM branch_user WHERE id = $1`, id)
if err != nil {
return err
}
if tag.RowsAffected() == 0 {
return pgx.ErrNoRows
}
return nil
return genericrepo.Delete(ctx, r.client, "branch_user", id)
}
type scannable interface {
Scan(dest ...interface{}) error
}
func scanUserBranch(row scannable) (userbranch.UserBranchDTO, error) {
func scanUserBranch(row genericrepo.Scanner) (userbranch.UserBranchDTO, error) {
var item userbranch.UserBranchDTO
var branchNameJSON []byte