Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F995362
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.js"
;
import
type
Query
from
"../datastore/query.js"
;
import
type
{
QueryStage
}
from
"../datastore/query.js"
;
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
Mon, Dec 23, 01:45 (5 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
556795
Default Alt Text
special-filter.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment