mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 09:56:44 +00:00 
			
		
		
		
	
		
			
	
	
		
			25 lines
		
	
	
		
			509 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
		
		
			
		
	
	
			25 lines
		
	
	
		
			509 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
|   | 'use strict'; | ||
|  | 
 | ||
|  | /** | ||
|  |  * Module dependencies | ||
|  |  */ | ||
|  | 
 | ||
|  | // Public node modules.
 | ||
|  | const _ = require('lodash'); | ||
|  | 
 | ||
|  | /** | ||
|  |  * Helper which returns a boolean. True if the type | ||
|  |  * of the relation is `manyToOne`. | ||
|  |  * | ||
|  |  * @param {Object} currentModel | ||
|  |  * @param {Object} association | ||
|  |  * | ||
|  |  * @return {boolean} | ||
|  |  */ | ||
|  | 
 | ||
|  | module.exports = function isManyToOneAssociation(currentModel, association) { | ||
|  |   return _.findWhere(strapi.models[association.model] && strapi.models[association.model].associations, { | ||
|  |     collection: currentModel | ||
|  |   }); | ||
|  | }; |