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.

33 lines
1.1 KiB

  1. -- name: SelectChapter :one
  2. SELECT * FROM story_chapter WHERE id=$1::TEXT LIMIT 1;
  3. -- name: SelectChapters :many
  4. SELECT * FROM story_chapter WHERE (sqlx.arg(story_id)::TEXT == '' OR story_id = @story_id::TEXT) ORDER BY created_date LIMIT @limit_size;
  5. -- name: InsertChapter :exec
  6. INSERT INTO story_chapter (id, story_id, title, author, source, created_date, fictional_date, edited_date, comment_mode, comments_locked)
  7. VALUES (
  8. @id::TEXT, @story_id::TEXT, @title::TEXT, @author::TEXT, @source::TEXT,
  9. @created_date::TIMESTAMP, @fictional_date::TIMESTAMP, @edited_date::TIMESTAMP,
  10. @comment_mode::TEXT, @comments_locked::BOOLEAN
  11. );
  12. -- name: UpdateChapterStoryID :exec
  13. UPDATE story_chapter
  14. SET story_id = @story_id::TEXT
  15. WHERE id = @id;
  16. -- name: UpdateChapter :exec
  17. UPDATE story_chapter
  18. SET title = @title,
  19. source = @source,
  20. fictional_date = @fictional_date,
  21. comment_mode = @comment_mode,
  22. comments_locked = @comments_locked
  23. WHERE id = @id;
  24. -- name: DeleteChapter :exec
  25. DELETE FROM story_chapter WHERE id=$1;
  26. -- name: DeleteChaptersByStoryID :exec
  27. DELETE FROM story_chapter WHERE story_id=$1;