<commit_before>import { GraphQLInt, GraphQLObjectType, GraphQLString } from 'graphql';

import { Account, AccountFields } from '../interface/Account';

import { Host } from './Host';

export const Organization = new GraphQLObjectType({
  name: 'Organization',
  description: 'This represents an Organization account',
  interfaces: () => [Account],
  isTypeOf: collective => collective.type === 'ORGANIZATION',
  fields: () => {
    return {
      ...AccountFields,
      balance: {
        description: 'Amount of money in cents in the currency of the collective currently available to spend',
        deprecationReason: '2020/04/09 - Should not have been introduced. Use stats.balance.value',
        type: GraphQLInt,
        resolve(collective, _, req) {
          return req.loaders.Collective.balance.load(collective.id);
        },
      },
      email: {
        type: GraphQLString,
        resolve(orgCollective, args, req) {
          if (!req.remoteUser) {
            return null;
          }
          return (
            orgCollective && req.loaders.getOrgDetailsByCollectiveId.load(orgCollective.id).then(user => user.email)
          );
        },
      },
      location: {
        ...AccountFields.location,
        description: `
          Address. This field is public for hosts, otherwise:
            - Users can see the addresses of the collectives they're admin of
            - Hosts can see the address of organizations submitting expenses to their collectives
        `,
        async resolve(organization, _, req) {
          const canSeeLocation = req.remoteUser?.isAdmin(organization.id) || (await organization.isHost());
          if (canSeeLocation) {
            return organization.location;<commit_msg>fix: add AccountWithContributionsFields to Organizations<commit_after>import { GraphQLInt, GraphQLObjectType, GraphQLString } from 'graphql';

import { Account, AccountFields } from '../interface/Account';
import { AccountWithContributions, AccountWithContributionsFields } from '../interface/AccountWithContributions';

import { Host } from './Host';

export const Organization = new GraphQLObjectType({
  name: 'Organization',
  description: 'This represents an Organization account',
  interfaces: () => [Account, AccountWithContributions],
  isTypeOf: collective => collective.type === 'ORGANIZATION',
  fields: () => {
    return {
      ...AccountFields,
      ...AccountWithContributionsFields,
      balance: {
        description: 'Amount of money in cents in the currency of the collective currently available to spend',
        deprecationReason: '2020/04/09 - Should not have been introduced. Use stats.balance.value',
        type: GraphQLInt,
        resolve(collective, _, req) {
          return req.loaders.Collective.balance.load(collective.id);
        },
      },
      email: {
        type: GraphQLString,
        resolve(orgCollective, args, req) {
          if (!req.remoteUser) {
            return null;
          }
          return (
            orgCollective && req.loaders.getOrgDetailsByCollectiveId.load(orgCollective.id).then(user => user.email)
          );
        },
      },
      location: {
        ...AccountFields.location,
        description: `
          Address. This field is public for hosts, otherwise:
            - Users can see the addresses of the collectives they're admin of
            - Hosts can see the address of organizations submitting expenses to their collectives
        `,
        async resolve(organization, _, req) {
          const canSeeLocation = req.remoteUser?.isAdmin(organization.id) || (await organization.isHost());
          if (canSeeLocation) {
            return organization.location;
{'fraction_non_alphanumeric': 0.10210696920583469, 'fraction_numerical': 0.004321988114532685, 'mean_word_length': 2.619745845552297, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3940772', 'n_tokens_mistral': 958, 'n_tokens_neox': 928, 'n_words': 268}