<commit_before>// go.campaign.routing (models)
// ============================
// Models for campaign routing screen.

// We use the state machine models as a base to make use of any
// custom/overriden functionality the models provide over Backbone.Model,
// seeing as the models for campaign routing are of a state machine nature.
var stateMachine = go.components.stateMachine,
    EndpointModel = stateMachine.EndpointModel,
    ConnectionModel = stateMachine.ConnectionModel,
    StateModel = stateMachine.StateModel,
    StateMachineModel = stateMachine.StateMachineModel;

(function(exports) {
  var RoutingEndpointModel = EndpointModel.extend({
    idAttribute: 'uuid'
  });

  var RoutingEntryModel = ConnectionModel.extend({
    idAttribute: 'uuid'
  });

  var ChannelModel = StateModel.extend({
    idAttribute: 'uuid',

    relations: [{
      type: Backbone.HasMany,
      key: 'endpoints',
      relatedModel: EndpointModel
    }]
  });

  var RoutingBlockModel = StateModel.extend({
    idAttribute: 'uuid',

    relations: [{
      type: Backbone.HasMany,
      key: 'conversation_endpoints',
      relatedModel: EndpointModel
    }, {
      type: Backbone.HasMany,
      key: 'channel_endpoints',
      relatedModel: EndpointModel
    }]
  });

  var ConversationModel = StateModel.extend({
    idAttribute: 'uuid',

    relations: [{
      type: Backbone.HasMany,
      key: 'endpoints',
      relatedModel: EndpointModel
    }]
  });

  var CampaignRoutingModel = StateMachineModel.extend({
    idAttribute: 'uuid',

    relations: [{
      type: Backbone.HasMany,
      key: 'channels',
      relatedModel: ChannelModel
    }, {
      type: Backbone.HasMany,
      key: 'routing_blocks',
      relatedModel: RoutingBlockModel
    }, {
      type: Backbone.HasMany,
      key: 'conversations',
      relatedModel: ConversationModel
    }, {
      type: Backbone.HasMany,
      key: 'routing_entries',
      relatedModel: RoutingEntryModel
    }]
  });

  _.extend(exports, {
    CampaignRoutingModel: CampaignRoutingModel,

    ChannelModel: ChannelModel,
    RoutingBlockModel: RoutingBlockModel,
    ConversationModel: ConversationModel,

    RoutingEntryModel: RoutingEntryModel,
    RoutingEndpointModel: RoutingEndpointModel
  });
})(go.campaign.routing);
<commit_msg>CampaignRoutingModel attr name change: uuid -> campaign_id<commit_after>// go.campaign.routing (models)
// ============================
// Models for campaign routing screen.

// We use the state machine models as a base to make use of any
// custom/overriden functionality the models provide over Backbone.Model,
// seeing as the models for campaign routing are of a state machine nature.
var stateMachine = go.components.stateMachine,
    EndpointModel = stateMachine.EndpointModel,
    ConnectionModel = stateMachine.ConnectionModel,
    StateModel = stateMachine.StateModel,
    StateMachineModel = stateMachine.StateMachineModel;

(function(exports) {
  var RoutingEndpointModel = EndpointModel.extend({
    idAttribute: 'uuid'
  });

  var RoutingEntryModel = ConnectionModel.extend({
    idAttribute: 'uuid'
  });

  var ChannelModel = StateModel.extend({
    idAttribute: 'uuid',

    relations: [{
      type: Backbone.HasMany,
      key: 'endpoints',
      relatedModel: EndpointModel
    }]
  });

  var RoutingBlockModel = StateModel.extend({
    idAttribute: 'uuid',

    relations: [{
      type: Backbone.HasMany,
      key: 'conversation_endpoints',
      relatedModel: EndpointModel
    }, {
      type: Backbone.HasMany,
      key: 'channel_endpoints',
      relatedModel: EndpointModel
    }]
  });

  var ConversationModel = StateModel.extend({
    idAttribute: 'uuid',

    relations: [{
      type: Backbone.HasMany,
      key: 'endpoints',
      relatedModel: EndpointModel
    }]
  });

  var CampaignRoutingModel = StateMachineModel.extend({
    idAttribute: 'campaign_id',

    relations: [{
      type: Backbone.HasMany,
      key: 'channels',
      relatedModel: ChannelModel
    }, {
      type: Backbone.HasMany,
      key: 'routing_blocks',
      relatedModel: RoutingBlockModel
    }, {
      type: Backbone.HasMany,
      key: 'conversations',
      relatedModel: ConversationModel
    }, {
      type: Backbone.HasMany,
      key: 'routing_entries',
      relatedModel: RoutingEntryModel
    }]
  });

  _.extend(exports, {
    CampaignRoutingModel: CampaignRoutingModel,

    ChannelModel: ChannelModel,
    RoutingBlockModel: RoutingBlockModel,
    ConversationModel: ConversationModel,

    RoutingEntryModel: RoutingEntryModel,
    RoutingEndpointModel: RoutingEndpointModel
  });
})(go.campaign.routing);

{'fraction_non_alphanumeric': 0.11151855047454702, 'fraction_numerical': 0.0, 'mean_word_length': 3.333644859813084, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3518693', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1302, 'n_words': 305}