RezinaLMS-BackEnd/db/query/team_otps.sql
Yared Yemane 815ac1576e feat: split learner OTP and team password-reset link flows
Learners get email/SMS OTP codes via /user/sendResetCode; team members get reset links via new /team/sendResetCode and /team/resetPassword APIs, with admin panel integration docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-10 01:52:49 -07:00

23 lines
449 B
SQL

-- name: CreateTeamOtp :exec
INSERT INTO team_otps (
team_member_id,
sent_to,
medium,
otp_for,
otp,
expires_at
)
VALUES ($1, $2, $3, $4, $5, $6);
-- name: GetLatestTeamOtp :one
SELECT id, team_member_id, sent_to, medium, otp_for, otp, used, used_at, created_at, expires_at
FROM team_otps
WHERE team_member_id = $1
ORDER BY id DESC
LIMIT 1;
-- name: MarkTeamOtpAsUsed :exec
UPDATE team_otps
SET used = TRUE, used_at = $2
WHERE id = $1;