public RelatedAttrFilterQuery( IJsonApiContext jsonApiContext, FilterQuery filterQuery) { _jsonApiContext = jsonApiContext; var relationshipArray = filterQuery.Attribute.Split('.'); var relationship = GetRelationship(relationshipArray[0]); if (relationship == null) { throw new JsonApiException(400, $"{relationshipArray[1]} is not a valid relationship on {relationshipArray[0]}."); } var attribute = GetAttribute(relationship, relationshipArray[1]); if (attribute == null) { throw new JsonApiException(400, $"'{filterQuery.Attribute}' is not a valid attribute."); } if (attribute.IsFilterable == false) { throw new JsonApiException(400, $"Filter is not allowed for attribute '{attribute.PublicAttributeName}'."); } FilteredRelationship = relationship; FilteredAttribute = attribute; PropertyValue = filterQuery.Value; FilterOperation = GetFilterOperation(filterQuery.Operation); }
public BaseFilterQuery( IJsonApiContext jsonApiContext, FilterQuery filterQuery) : base(jsonApiContext, filterQuery) { PropertyValue = filterQuery.Value; FilterOperation = GetFilterOperation(filterQuery.Operation); }
public AttrFilterQuery( IJsonApiContext jsonApiContext, FilterQuery filterQuery) { _jsonApiContext = jsonApiContext; var attribute = GetAttribute(filterQuery.Attribute); FilteredAttribute = attribute ?? throw new JsonApiException(400, $"'{filterQuery.Attribute}' is not a valid attribute."); PropertyValue = filterQuery.Value; FilterOperation = GetFilterOperation(filterQuery.Operation); }
public AttrFilterQuery( IJsonApiContext jsonApiCopntext, FilterQuery filterQuery) { _jsonApiContext = jsonApiCopntext; var attribute = GetAttribute(filterQuery.Key); FilteredAttribute = attribute ?? throw new JsonApiException("400", $"{filterQuery.Key} is not a valid property."); PropertyValue = filterQuery.Value; FilterOperation = GetFilterOperation(filterQuery.Operation); }
public AttrFilterQuery( IJsonApiContext jsonApiContext, FilterQuery filterQuery) : base(jsonApiContext, filterQuery) { if (Attribute == null) { throw new JsonApiException(400, $"'{filterQuery.Attribute}' is not a valid attribute."); } if (Attribute.IsFilterable == false) { throw new JsonApiException(400, $"Filter is not allowed for attribute '{Attribute.PublicAttributeName}'."); } }
public RelatedAttrFilterQuery( IJsonApiContext jsonApiContext, FilterQuery filterQuery) : base(jsonApiContext, filterQuery) { if (Relationship == null) { throw new JsonApiException(400, $"{filterQuery.Relationship} is not a valid relationship on {jsonApiContext.RequestEntity.EntityName}."); } if (Attribute == null) { throw new JsonApiException(400, $"'{filterQuery.Attribute}' is not a valid attribute."); } if (Attribute.IsFilterable == false) { throw new JsonApiException(400, $"Filter is not allowed for attribute '{Attribute.PublicAttributeName}'."); } }
public AttrFilterQuery( IJsonApiContext jsonApiContext, FilterQuery filterQuery) { _jsonApiContext = jsonApiContext; var attribute = GetAttribute(filterQuery.Attribute); if (attribute == null) { throw new JsonApiException(400, $"'{filterQuery.Attribute}' is not a valid attribute."); } if (attribute.IsFilterable == false) { throw new JsonApiException(400, $"Filter is not allowed for attribute '{attribute.PublicAttributeName}'."); } FilteredAttribute = attribute; PropertyValue = filterQuery.Value; FilterOperation = GetFilterOperation(filterQuery.Operation); }
public RelatedAttrFilterQuery( IJsonApiContext jsonApiCopntext, FilterQuery filterQuery) { _jsonApiContext = jsonApiCopntext; var relationshipArray = filterQuery.Key.Split('.'); var relationship = GetRelationship(relationshipArray[0]); if (relationship == null) { throw new JsonApiException("400", $"{relationshipArray[0]} is not a valid relationship."); } var attribute = GetAttribute(relationship, relationshipArray[1]); FilteredRelationship = relationship; FilteredAttribute = attribute ?? throw new JsonApiException("400", $"{relationshipArray[1]} is not a valid attribute on {relationshipArray[0]}."); PropertyValue = filterQuery.Value; FilterOperation = GetFilterOperation(filterQuery.Operation); }