Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
-- name: ListAttributes :many
|
||||
SELECT * FROM attributes
|
||||
WHERE company_id = $1
|
||||
ORDER BY name;
|
||||
|
||||
-- name: GetAttribute :one
|
||||
SELECT * FROM attributes
|
||||
WHERE id = $1 AND company_id = $2
|
||||
LIMIT 1;
|
||||
|
||||
-- name: CreateAttribute :one
|
||||
INSERT INTO attributes (company_id, attribute_key, name, value_type, unit, example, parent_key)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
RETURNING *;
|
||||
|
||||
-- name: UpdateAttribute :one
|
||||
UPDATE attributes
|
||||
SET name = COALESCE($3, name),
|
||||
value_type = COALESCE($4, value_type),
|
||||
unit = COALESCE($5, unit),
|
||||
example = COALESCE($6, example),
|
||||
updated_at = now()
|
||||
WHERE id = $1 AND company_id = $2
|
||||
RETURNING *;
|
||||
|
||||
-- name: DeleteAttribute :exec
|
||||
DELETE FROM attributes WHERE id = $1 AND company_id = $2;
|
||||
|
||||
-- name: ListCategoryAttributes :many
|
||||
SELECT ca.*, a.attribute_key, a.name AS attribute_name, a.value_type
|
||||
FROM category_attributes ca
|
||||
JOIN attributes a ON a.id = ca.attribute_id
|
||||
WHERE ca.company_id = $1 AND ca.category_unique_id = $2
|
||||
ORDER BY a.name;
|
||||
Reference in New Issue
Block a user