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!){
|
||||
instrument(slug: $slug) {
|
||||
id
|
||||
title
|
||||
slug
|
||||
type
|
||||
contents
|
||||
...InstrumentParts
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
slug = kwargs.get('slug')
|
||||
room_id = kwargs.get('id')
|
||||
instrument_id = kwargs.get('id')
|
||||
|
||||
if room_id is not None:
|
||||
return get_object(BasicKnowledge, room_id)
|
||||
if instrument_id is not None:
|
||||
return get_object(BasicKnowledge, instrument_id)
|
||||
if slug is not None:
|
||||
return BasicKnowledge.objects.get(slug=slug)
|
||||
return None
|
||||
|
|
|
|||
Loading…
Reference in New Issue