{"size": 939, "ext": "js", "max_stars_repo_path": "www/app/modules/administrative/models/shipment.js", "max_stars_repo_name": "marwahan/test-os", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "www/app/modules/administrative/models/shipment.js", "max_issues_repo_name": "marwahan/test-os", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "www/app/modules/administrative/models/shipment.js", "max_forks_repo_name": "marwahan/test-os", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.3783783784, "max_line_length": 73, "alphanum_fraction": 0.6080937167}

angular.module('os.administrative.models.shipment', ['os.common.models'])
  .factory('Shipment', function(osModel, $http) {
    var Shipment = osModel('shipments');

    Shipment.prototype.getType = function() {
      return 'shipment';
    }

    Shipment.prototype.getDisplayName = function() {
      return this.name;
    }

    Shipment.prototype.$saveProps = function() {
      this.request = !!this.request ? {id: this.request.id} : undefined;
      angular.forEach(this.shipmentItems, function(shipmentItem) {
        shipmentItem.specimen = {
          id: shipmentItem.specimen.id,
          storageLocation: shipmentItem.specimen.storageLocation
        };
      });

      return this;
    }
    
    Shipment.prototype.generateReport = function() {
      return $http.get(Shipment.url() + this.$id() + "/report").then(
        function(resp) {
          return resp.data;
        }
      );
    }

    return Shipment;
  }
);
