Yimaru-BackEnd/db/query/transactions.sql

15 lines
485 B
SQL

-- name: CreateTransaction :one
INSERT INTO transactions (amount, transaction_type, wallet_id) VALUES ($1, $2, $3) RETURNING *;
-- name: GetAllTransactions :many
SELECT * FROM transactions;
-- name: GetTransactionsByWallet :many
SELECT * FROM transactions WHERE wallet_id = $1;
-- name: GetTransactionByID :one
SELECT * FROM transactions WHERE id = $1;
-- name: UpdateTransferVerification :exec
UPDATE transactions SET verified = $1, updated_at = CURRENT_TIMESTAMP WHERE id = $2;