GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.0 KiB

  1. -- name: SelectComment :one
  2. SELECT * FROM story_comment WHERE id=$1;
  3. -- name: InsertComment :exec
  4. INSERT INTO story_comment (id, chapter_id, character_id, subject, author, character_name, source, created_date, fictional_date, edited_date)
  5. VALUES (
  6. @id, @chapter_id, @character_id,
  7. @subject, @author, @character_name, @source,
  8. @created_date, @fictional_date, @edited_date
  9. );
  10. -- name: UpdateComment :exec
  11. UPDATE story_comment
  12. SET subject = @subject,
  13. source = @source,
  14. fictional_date = @fictional_date,
  15. character_name = @character_name,
  16. character_id = @character_id
  17. WHERE id = @id;
  18. -- name: SelectComments :many
  19. SELECT * FROM story_comment
  20. WHERE (@chapter_id = '' OR chapter_id = @chapter_id)
  21. LIMIT NULLIF(@limit_size::INT, 0);
  22. -- name: DeleteComment :exec
  23. DELETE FROM story_comment WHERE id = $1;
  24. -- name: DeleteCommentsByChapterID :exec
  25. DELETE FROM story_comment WHERE chapter_id = $1;
  26. -- name: DeleteCommentsByStoryID :exec
  27. DELETE FROM story_comment
  28. WHERE chapter_id IN (
  29. SELECT id FROM story_chapter WHERE story_id = $1
  30. );