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.

36 lines
1.1 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. edited_date = @edited_date,
  16. character_name = @character_name,
  17. character_id = @character_id
  18. WHERE id = @id;
  19. -- name: SelectComments :many
  20. SELECT * FROM story_comment
  21. WHERE (@chapter_id = '' OR chapter_id = @chapter_id)
  22. LIMIT NULLIF(@limit_size::INT, 0);
  23. -- name: DeleteComment :exec
  24. DELETE FROM story_comment WHERE id = $1;
  25. -- name: DeleteCommentsByChapterID :exec
  26. DELETE FROM story_comment WHERE chapter_id = $1;
  27. -- name: DeleteCommentsByStoryID :exec
  28. DELETE FROM story_comment
  29. WHERE chapter_id IN (
  30. SELECT id FROM story_chapter WHERE story_id = $1
  31. );