Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7317400
value-not-existing-in-collection.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
880 B
Referenced Files
None
Subscribers
None
value-not-existing-in-collection.ts
View Options
import
ValueExistingInCollection
from
"./value-existing-in-collection"
;
import
{
Context
,
Field
}
from
"../../../main"
;
export
default
class
ValueNotExistingInCollection
extends
ValueExistingInCollection
{
getTypeName
=
()
=>
"value-not-existing-in-collection"
;
async
isProperValue
(
context
:
Context
,
new_value
:
unknown
,
old_value
:
unknown
)
{
const
field
=
this
.
getField
(
context
.
app
);
await
field
.
checkValue
(
context
,
new_value
,
old_value
,
null
);
if
(
this
.
include_forbidden
)
{
context
=
new
this
.
app
.
SuperContext
();
}
const
sealious_response
=
await
field
.
collection
.
list
(
context
)
.
filter
({
[
field
.
name
]
:
new_value
})
.
fetch
();
if
(
!
sealious_response
.
empty
)
{
return
Field
.
invalid
(
context
.
app
.
i18n
(
"invalid_non_existing_value"
,
[
field
.
collection
.
name
,
field
.
name
,
new_value
,
])
);
}
return
Field
.
valid
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sun, Jul 13, 04:41 (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
778480
Default Alt Text
value-not-existing-in-collection.ts (880 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment