Beispiel #1
0
class Query:
    contact = DjangoObjectField(ContactType)
    communication = DjangoObjectField(CommunicationType)
    contact_list = DjangoPaginatedListObjectField(
        ContactListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
    communication_list = DjangoPaginatedListObjectField(
        CommunicationListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
Beispiel #2
0
class Query:
    organization = DjangoObjectField(OrganizationType)
    organization_list = DjangoPaginatedListObjectField(
        OrganizationListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
    organization_kind = DjangoObjectField(OrganizationKindObjectType)
    organization_kind_list = DjangoPaginatedListObjectField(
        OrganizationKindListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
Beispiel #3
0
class Query:
    resource = DjangoObjectField(ResourceType)
    resource_list = DjangoPaginatedListObjectField(
        ResourceListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
    resource_group = DjangoObjectField(ResourceGroupType)
    resource_group_list = DjangoPaginatedListObjectField(
        ResourceGroupListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
Beispiel #4
0
class Query:
    figure = DjangoObjectField(FigureType)
    figure_list = DjangoPaginatedListObjectField(
        FigureListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
    source_preview = DjangoObjectField(SourcePreviewType)
    entry = DjangoObjectField(EntryType)
    entry_list = DjangoPaginatedListObjectField(
        EntryListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
Beispiel #5
0
class UserType(DjangoObjectType):
    class Meta:
        model = User
        exclude_fields = ('password',)

    review_entries = DjangoPaginatedListObjectField(EntryListType,
                                                    pagination=PageGraphqlPagination(
                                                        page_size_query_param='pageSize'
                                                    ), accessor='review_entries')
    created_entry = DjangoPaginatedListObjectField(EntryListType,
                                                   pagination=PageGraphqlPagination(
                                                       page_size_query_param='pageSize'
                                                   ), accessor='created_entry')
    role = Field(graphene.String)
Beispiel #6
0
class OrganizationType(DjangoObjectType):
    class Meta:
        model = Organization

    contacts = DjangoPaginatedListObjectField(
        ContactListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
Beispiel #7
0
class OrganizationKindObjectType(DjangoObjectType):
    class Meta:
        model = OrganizationKind

    organizations = DjangoPaginatedListObjectField(
        OrganizationListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
Beispiel #8
0
class ResourceGroupType(DjangoObjectType):
    class Meta:
        model = ResourceGroup

    resources = DjangoPaginatedListObjectField(
        ResourceListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
Beispiel #9
0
class CrisisType(DjangoObjectType):
    class Meta:
        model = Crisis

    crisis_type = graphene.Field(CrisisTypeGrapheneEnum)
    events = DjangoPaginatedListObjectField(
        EventListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
Beispiel #10
0
class Query(object):
    me = Field(UserType)
    users = DjangoPaginatedListObjectField(UserListType)

    def resolve_me(self, info, **kwargs):
        if info.context.user.is_authenticated:
            return info.context.user
        return None
Beispiel #11
0
class ContactType(DjangoObjectType):
    class Meta:
        model = Contact

    designation = graphene.Field(DesignationGrapheneEnum)
    gender = graphene.Field(GenderGrapheneEnum)
    communications = DjangoPaginatedListObjectField(
        CommunicationListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
Beispiel #12
0
class EntryType(DjangoObjectType):
    class Meta:
        model = Entry

    created_by = graphene.Field('apps.users.schema.UserType')
    last_modified_by = graphene.Field('apps.users.schema.UserType')
    figures = DjangoPaginatedListObjectField(
        FigureListType,
        pagination=PageGraphqlPagination(page_size_query_param='perPage'))
    reviewers = CustomDjangoListField('apps.users.schema.UserType')
    total_figures = graphene.Field(graphene.Int)
Beispiel #13
0
class Query:
    trigger_list = DjangoFilterListField(TriggerType)
    sub_type_trigger_list = DjangoFilterListField(TriggerSubObjectType)
    violence_list = DjangoFilterListField(ViolenceType)
    actor_list = DjangoFilterListField(ActorType)
    disaster_category_list = DjangoFilterListField(DisasterCategoryType)
    disaster_sub_category_list = DjangoFilterListField(DisasterSubCategoryType)
    disaster_type_list = DjangoFilterListField(DisasterTypeObjectType)
    disaster_sub_type_list = DjangoFilterListField(DisasterSubObjectType)

    event = DjangoObjectField(EventType)
    event_list = DjangoPaginatedListObjectField(
        EventListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
Beispiel #14
0
class CountryType(DjangoObjectType):
    class Meta:
        model = Country

    last_summary = graphene.Field(SummaryType)
    last_contextual_update = graphene.Field(ContextualUpdateType)
    contacts = DjangoPaginatedListObjectField(
        ContactListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'),
        accessor='contacts')
    operating_contacts = DjangoPaginatedListObjectField(
        ContactListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'),
        accessor='operating_contacts')
    contextual_updates = DjangoPaginatedListObjectField(
        ContextualUpdateListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'),
        accessor='contextual_updates')
    summaries = DjangoPaginatedListObjectField(
        SummaryListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'),
        accessor='summaries')
    crises = graphene.Dynamic(lambda: DjangoPaginatedListObjectField(
        get_type('apps.crisis.schema.CrisisListType'),
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'),
        accessor='crises'))
    entries = graphene.Dynamic(lambda: DjangoPaginatedListObjectField(
        get_type('apps.entry.schema.EntryListType'),
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'),
        accessor='entries'))

    @staticmethod
    def get_queryset(queryset, info):
        # graphene_django/fields.py:57 demands we implement this method
        # so that we can filter based on request, but we do not need
        return queryset
Beispiel #15
0
class Query:
    crisis = DjangoObjectField(CrisisType)
    crisis_list = DjangoPaginatedListObjectField(
        CrisisListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))
Beispiel #16
0
class Query:
    country = DjangoObjectField(CountryType)
    country_list = DjangoPaginatedListObjectField(
        CountryListType,
        pagination=PageGraphqlPagination(page_size_query_param='pageSize'))