60 lines
1.1 KiB
SQL
60 lines
1.1 KiB
SQL
-- name: CreateTransaction :one
|
|
INSERT INTO transactions (
|
|
amount,
|
|
branch_id,
|
|
cashier_id,
|
|
bet_id,
|
|
type,
|
|
payment_option,
|
|
full_name,
|
|
phone_number,
|
|
bank_code,
|
|
beneficiary_name,
|
|
account_name,
|
|
account_number,
|
|
reference_number,
|
|
number_of_outcomes,
|
|
branch_name,
|
|
branch_location,
|
|
company_id,
|
|
cashier_name
|
|
)
|
|
VALUES (
|
|
$1,
|
|
$2,
|
|
$3,
|
|
$4,
|
|
$5,
|
|
$6,
|
|
$7,
|
|
$8,
|
|
$9,
|
|
$10,
|
|
$11,
|
|
$12,
|
|
$13,
|
|
$14,
|
|
$15,
|
|
$16,
|
|
$17,
|
|
$18
|
|
)
|
|
RETURNING *;
|
|
-- name: GetAllTransactions :many
|
|
SELECT *
|
|
FROM transactions;
|
|
-- name: GetTransactionByID :one
|
|
SELECT *
|
|
FROM transactions
|
|
WHERE id = $1;
|
|
-- name: GetTransactionByBranch :many
|
|
SELECT *
|
|
FROM transactions
|
|
WHERE branch_id = $1;
|
|
-- name: UpdateTransactionVerified :exec
|
|
UPDATE transactions
|
|
SET verified = $2,
|
|
approved_by = $3,
|
|
approver_name = $4,
|
|
updated_at = CURRENT_TIMESTAMP
|
|
WHERE id = $1; |