Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7188379
IsReferencedByResourcesMatching.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
IsReferencedByResourcesMatching.ts
View Options
import
*
as
assert
from
"assert"
;
import
{
Query
}
from
"../../../main"
;
import
SpecialFilter
from
"../../../chip-types/special-filter"
;
type
Params
=
{
referencing_collection
:
string
;
referencing_field
:
string
;
field_to_check
:
string
;
allowed_values
:
any
[];
nopass_reason
:
string
;
};
export
default
class
IsReferencedByResourcesMatching
extends
SpecialFilter
{
constructor
(
collection
:
string
,
public
params
:
Params
)
{
super
(
collection
,
params
);
const
{
allowed_values
,
nopass_reason
}
=
params
;
assert
.
ok
(
params
);
assert
.
ok
(
Array
.
isArray
(
allowed_values
));
assert
.
ok
(
typeof
nopass_reason
===
"string"
);
}
async
getFilteringQuery
()
{
const
query
=
new
Query
();
const
lookup_id
=
query
.
lookup
({
from
:
this
.
getCollection
().
name
,
localField
:
"id"
,
foreignField
:
this
.
params
.
referencing_field
,
});
query
.
match
({
[
`
${
lookup_id
}
.
${
this
.
params
.
field_to_check
}
`
]
:
{
$in
:
this
.
params
.
allowed_values
,
},
});
return
query
;
}
getNopassReason
()
{
return
this
.
params
.
nopass_reason
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Jul 8, 08:10 (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
802942
Default Alt Text
IsReferencedByResourcesMatching.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment