Skip to content

Commit ec8b2d6

Browse files
author
codemyjourney
committed
refacto
1 parent e65cf09 commit ec8b2d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/books/schema.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ class BookType(DjangoObjectType):
88
class Meta:
99
model = Book
1010

11+
1112
class Query(graphene.ObjectType):
1213
books = graphene.List(BookType)
1314

1415
def resolve_books(self, info):
1516
return Book.objects.all()
1617

18+
1719
class CreateBook(graphene.Mutation):
1820
book = graphene.Field(BookType)
1921

@@ -33,6 +35,7 @@ def mutate(self, info, title, author, description, url):
3335
book.save()
3436
return CreateBook(book=book)
3537

38+
3639
class UpdateBook(graphene.Mutation):
3740
book = graphene.Field(BookType)
3841

@@ -77,6 +80,7 @@ def mutate(self, info, book_id):
7780

7881
return DeleteBook(book_id=book_id)
7982

83+
8084
class CreateLike(graphene.Mutation):
8185
user = graphene.Field(UserType)
8286
book = graphene.Field(BookType)

0 commit comments

Comments
 (0)