Add instrument query by id
This commit is contained in:
parent
01ab01a9e9
commit
8765de9603
|
|
@ -0,0 +1,14 @@
|
||||||
|
fragment InstrumentParts on InstrumentNode {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
slug
|
||||||
|
bookmarks {
|
||||||
|
uuid
|
||||||
|
note {
|
||||||
|
id
|
||||||
|
text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type
|
||||||
|
contents
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
|
#import "./fragments/instrumentParts.gql"
|
||||||
query InstrumentQuery($slug: String!){
|
query InstrumentQuery($slug: String!){
|
||||||
instrument(slug: $slug) {
|
instrument(slug: $slug) {
|
||||||
id
|
...InstrumentParts
|
||||||
title
|
|
||||||
slug
|
|
||||||
type
|
|
||||||
contents
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
#import "./fragments/instrumentParts.gql"
|
||||||
|
query InstrumentQuery($id: ID!){
|
||||||
|
instrument(id: $id) {
|
||||||
|
...InstrumentParts
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,10 +23,10 @@ class BasicKnowledgeQuery(object):
|
||||||
|
|
||||||
def resolve_instrument(self, info, **kwargs):
|
def resolve_instrument(self, info, **kwargs):
|
||||||
slug = kwargs.get('slug')
|
slug = kwargs.get('slug')
|
||||||
room_id = kwargs.get('id')
|
instrument_id = kwargs.get('id')
|
||||||
|
|
||||||
if room_id is not None:
|
if instrument_id is not None:
|
||||||
return get_object(BasicKnowledge, room_id)
|
return get_object(BasicKnowledge, instrument_id)
|
||||||
if slug is not None:
|
if slug is not None:
|
||||||
return BasicKnowledge.objects.get(slug=slug)
|
return BasicKnowledge.objects.get(slug=slug)
|
||||||
return None
|
return None
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue