Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>
).toEqual(`["etag","ilike","%etagValue%"]`);
});
).toEqual(`["etag","ilike","%etagValue%"]`);
});
+ it("should add 'contains' rule", () => {
+ expect(
+ filters.addContains("properties.someProp", "someValue").getFilters()
+ ).toEqual(`["properties.someProp","contains","someValue"]`);
+ });
+
it("should add 'is_a' rule", () => {
expect(
filters.addIsA("etag", "etagValue").getFilters()
it("should add 'is_a' rule", () => {
expect(
filters.addIsA("etag", "etagValue").getFilters()
return this.addCondition(field, "ilike", value, "%", "%", resourcePrefix);
}
return this.addCondition(field, "ilike", value, "%", "%", resourcePrefix);
}
+ public addContains(field: string, value?: string, resourcePrefix?: string) {
+ return this.addCondition(field, "contains", value, "", "", resourcePrefix);
+ }
+
public addIsA(field: string, value?: string | string[], resourcePrefix?: string) {
return this.addCondition(field, "is_a", value, "", "", resourcePrefix);
}
public addIsA(field: string, value?: string | string[], resourcePrefix?: string) {
return this.addCondition(field, "is_a", value, "", "", resourcePrefix);
}
data.properties.forEach(p => {
if (p.value) {
filter
data.properties.forEach(p => {
if (p.value) {
filter
- .addILike(`properties.${p.key}`, p.value, GroupContentsResourcePrefix.PROJECT)
- .addILike(`properties.${p.key}`, p.value, GroupContentsResourcePrefix.COLLECTION);
+ .addContains(`properties.${p.key}`, p.value, GroupContentsResourcePrefix.PROJECT)
+ .addContains(`properties.${p.key}`, p.value, GroupContentsResourcePrefix.COLLECTION);
}
filter.addExists(p.key);
});
}
filter.addExists(p.key);
});