Skip to content

Commit

Permalink
feat(hasura): update api
Browse files Browse the repository at this point in the history
  • Loading branch information
harisato committed Jul 11, 2023
1 parent 72c2c37 commit faa4d79
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
37 changes: 20 additions & 17 deletions hasura/metadata/query_collections.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,6 @@
}
}
}
- name: User - Like chapter
query: |
mutation UserLikeChapter ($chapter_id: Int = 10) {
insert_likes_one(object: {chapter_id:$chapter_id}) {
id
user_id
chapter_id
created_at
}
}
- name: User - Unlike chapter
query: |
mutation UserUnLikeChapter ($chapter_id: Int = 10, $_eq: Int = 10) {
delete_likes(where: {chapter_id:{_eq:$chapter_id}}) {
affected_rows
}
}
- name: User - Subscribe manga
query: |
mutation UserSubscribeManga ($manga_id: Int = 10) {
Expand Down Expand Up @@ -573,6 +556,9 @@
chapter_number
chapter_name
chapter_type
thumbnail_url
status
pushlish_date
chapter_languages(where: {language_id:{_eq:$language_id}}) {
language_id
detail
Expand All @@ -596,3 +582,20 @@
}
}
}
- name: User - Unlike chapter
query: |
mutation UserUnLikeChapter ($chapter_id: Int!) {
delete_likes(where: {chapter_id:{_eq:$chapter_id}}) {
affected_rows
}
}
- name: User - Like chapter
query: |
mutation UserLikeChapter ($chapter_id: Int!) {
insert_likes_one(object: {chapter_id:$chapter_id}) {
id
user_id
chapter_id
created_at
}
}
18 changes: 9 additions & 9 deletions hasura/metadata/rest_endpoints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,6 @@
- GET
name: Public - Get trending manga
url: public/trending
- comment: ""
definition:
query:
collection_name: allowed-queries
query_name: User - Like chapter
methods:
- POST
name: User - Like chapter
url: user/chapters/:$chapter_id/likes
- comment: ""
definition:
query:
Expand All @@ -340,6 +331,15 @@
- DELETE
name: User - Unlike chapter
url: user/chapters/:chapter_id/likes
- comment: ""
definition:
query:
collection_name: allowed-queries
query_name: User - Like chapter
methods:
- POST
name: User - Like chapter
url: user/chapters/:chapter_id/likes
- comment: ""
definition:
query:
Expand Down

0 comments on commit faa4d79

Please sign in to comment.