Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F995984
special-filter.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
special-filter.ts
View Options
import
type
{
App
}
from
"../app/app"
;
import
type
Query
from
"../datastore/query"
;
import
type
{
QueryStage
}
from
"../datastore/query"
;
export
default
abstract
class
SpecialFilter
{
params
:
any
;
app
:
App
;
collection_name
:
string
;
constructor
(
collection_name
:
string
,
params
:
any
)
{
this
.
params
=
params
;
this
.
collection_name
=
collection_name
;
}
init
(
app
:
App
)
{
this
.
app
=
app
;
}
abstract
getFilteringQuery
()
:
Promise
<
Query
>
;
abstract
getNopassReason
()
:
string
;
getCollection
()
{
return
this
.
app
.
collections
[
this
.
collection_name
];
}
async
checkSingleResource
(
app
:
App
,
resource_id
:
string
)
{
const
documents
=
await
app
.
Datastore
.
aggregate
(
this
.
getCollection
().
name
,
[
{
$match
:
{
id
:
resource_id
}
},
...(
await
this
.
getFilteringQuery
()).
toPipeline
(),
]
as
QueryStage
[]
);
return
documents
.
length
?
SpecialFilter
.
pass
()
:
SpecialFilter
.
nopass
(
this
.
getNopassReason
());
}
static
pass
=
async
()
=>
({
passed
:
true
});
static
nopass
=
async
(
reason
:
string
)
=>
({
passed
:
false
,
reason
});
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Dec 24, 05:03 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557025
Default Alt Text
special-filter.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment