isl-api/sql/powerItem/query.sql
Annika Merris 1420b14565 Added Functionality To PowerItem Endpoint
TODO: Change "addMultiple" to not require a map. That only exists so I could import easily from my old project.
2024-01-28 13:57:25 -05:00

107 lines
1.9 KiB
SQL

-- GetAllItems finds all items.
-- name: GetAllItems :many
SELECT
id,
itemType,
iconURL,
itemName,
minItemPower,
maxItemPower,
rarity,
origin,
tooltip,
isEventItem
FROM
powerItem;
-- GetAllByType finds all items of a specific type.
-- name: GetAllByType :many
SELECT
id,
itemType,
iconURL,
itemName,
minItemPower,
maxItemPower,
rarity,
origin,
tooltip,
isEventItem
FROM
powerItem
WHERE
itemType = pggen.arg('itemType');
-- FindByID finds items by the ID
-- name: FindByID :one
SELECT
id,
itemType,
iconURL,
itemName,
minItemPower,
maxItemPower,
rarity,
origin,
tooltip,
isEventItem
FROM
powerItem
WHERE
id = pggen.arg('id');
-- AddNewItem inserts a new power item
-- name: AddNewItem :one
INSERT INTO
powerItem (
itemType,
iconURL,
itemName,
minItemPower,
maxItemPower,
rarity,
origin,
tooltip,
isEventItem
)
VALUES
(
pggen.arg('itemType'),
pggen.arg('iconUrl'),
pggen.arg('itemName'),
pggen.arg('minItemPower'),
pggen.arg('maxItemPower'),
pggen.arg('rarity'),
pggen.arg('origin'),
pggen.arg('tooltip'),
pggen.arg('isEventItem')
) RETURNING *;
-- AddNewItemWithID inserts a new power item
-- name: AddNewItemWithID :one
INSERT INTO
powerItem (
id,
itemType,
iconURL,
itemName,
minItemPower,
maxItemPower,
rarity,
origin,
tooltip,
isEventItem
)
VALUES
(
pggen.arg('id'),
pggen.arg('itemType'),
pggen.arg('iconUrl'),
pggen.arg('itemName'),
pggen.arg('minItemPower'),
pggen.arg('maxItemPower'),
pggen.arg('rarity'),
pggen.arg('origin'),
pggen.arg('tooltip'),
pggen.arg('isEventItem')
) RETURNING *;