Commit cfb22358 authored by Lynn Foster's avatar Lynn Foster
Browse files

first batch for DisCO for Kendraio

parent 578571d0
......@@ -47,7 +47,7 @@ class Query(graphene.AbstractType):
return formatAgentList(EconomicAgent.objects.all())
def resolve_user_is_authorized_to_create(self, args, context, info):
context_agent_id = args.get('contest_agent_id')
context_agent_id = args.get('context_agent_id')
user_agent = AgentUser.objects.filter(user=self.user).first().agent
return user_agent.is_authorized(context_agent_id=context_agent_id)
......
......@@ -1851,6 +1851,19 @@ query ($token: String) {
}
}
query ($token: String) {
viewer(token: $token) {
resourceClassification (id: 62) {
name
id
generatePlanFromWorkflowRecipe {
id
name
}
}
}
}
query ($token: String) {
viewer(token: $token) {
agent(id: 146) {
......
......@@ -4,6 +4,12 @@
import graphene
from graphene_django.types import DjangoObjectType
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from valuenetwork.api.schemas.Auth import _authUser
import datetime
import valuenetwork.api.types as types
from valuenetwork.valueaccounting.models import EconomicResource as EconomicResourceProxy, EconomicResourceType, Facet as FacetProxy, FacetValue as FacetValueProxy
......@@ -54,15 +60,33 @@ class ResourceClassification(DjangoObjectType):
class Meta:
model = EconomicResourceType
only_fields = ('id', 'name', 'unit')
only_fields = ('id', 'name', 'unit', 'context_agent')
classification_resources = graphene.List(lambda: EconomicResource)
classification_facets = graphene.List(lambda: Facet)
generate_plan_from_workflow_recipe = graphene.Field(lambda: types.Plan)
#classification_facet_values = graphene.List(lambda: FacetValue)
def resolve_classification_resources(self, args, context, info):
return self.resources.all()
def resolve_classification_facets(self, args, context, info):
rtfvs = self.facets.all()
facets = []
for rtfv in rtfvs:
if rtfv.facet_value.facet not in facets:
facets.append(rtfv.facet_value.facet)
return facets
# This is a shameless hack!!!
def resolve_generate_plan_from_workflow_recipe(self, args, context, *rargs):
token = rargs[0].variable_values['token']
context.user = _authUser(token)
return self.generate_staged_work_order("test disco order", datetime.date.today(), context.user)
#def resolve_classification_facet_values(self, args, context, info):
# return self.facets.all() #TODO in process, not working yet
......
......@@ -7321,7 +7321,10 @@ class Process(models.Model):
 
@property #ValueFlows
def is_started(self):
return self.started
if self.started is not null:
return true
else:
return false
 
@property #ValueFlows
def note(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment