pronounsfu/backend/db/queries/queries.member.sql

32 lines
804 B
MySQL
Raw Normal View History

2023-01-04 13:41:29 -08:00
-- name: GetMemberByID :one
SELECT * FROM members
WHERE id = pggen.arg('id');
-- name: GetMemberByName :one
SELECT * FROM members
WHERE user_id = pggen.arg('user_id') AND (
id = pggen.arg('member_ref')
OR name = pggen.arg('member_ref')
);
-- name: GetMembers :many
SELECT * FROM members
WHERE user_id = pggen.arg('user_id')
ORDER BY name, id;
-- name: UpdateMemberNamesPronouns :one
UPDATE members SET
names = pggen.arg('names'),
pronouns = pggen.arg('pronouns')
WHERE id = pggen.arg('id')
RETURNING *;
-- name: GetMemberFields :many
SELECT * FROM member_fields WHERE member_id = pggen.arg('member_id') ORDER BY id ASC;
-- name: InsertMemberField :one
INSERT INTO member_fields
(member_id, name, entries) VALUES
(pggen.arg('member_id'), pggen.arg('name'), pggen.arg('entries'))
RETURNING *;