Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F8929164
collection-field-subject.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
collection-field-subject.js
View Options
"use strict"
;
const
locreq
=
require
(
"locreq"
)(
__dirname
);
const
Promise
=
require
(
"bluebird"
);
const
merge
=
require
(
"merge"
);
const
Subject
=
locreq
(
"lib/subject/subject.js"
);
const
Errors
=
locreq
(
"lib/response/error.js"
);
const
CollectionFieldSubject
=
function
(
collection
,
resource_id
,
field_name
){
this
.
name
=
"CollectionFieldSubject"
;
this
.
collection
=
collection
;
this
.
resource_id
=
resource_id
;
this
.
field_name
=
field_name
;
this
.
field_type
=
collection
[
field_name
].
type
;
};
CollectionFieldSubject
.
prototype
=
Object
.
create
(
Subject
.
prototype
);
CollectionFieldSubject
.
prototype
.
perform_action
=
function
(
context
,
action_name
,
params
){
params
=
params
||
{};
merge
(
params
,
{
resource_id
:
this
.
resource_id
,
field_name
:
this
.
field_name
,
collection
:
this
.
collection
,
});
if
(
this
.
field_type
.
actions
[
action_name
]){
return
Promise
.
resolve
(
this
.
field_type
.
actions
[
action_name
](
context
,
params
));
}
else
{
throw
new
Errors
.
DeveloperError
(
`Unknown action: '
${
action_name
}
'`
);
}
};
CollectionFieldSubject
.
prototype
.
get_child_subject
=
function
(
key
){
const
self
=
this
;
return
Promise
.
try
(
function
(){
return
self
.
field_type
.
get_child_subject
(
key
);
});
};
module
.
exports
=
CollectionFieldSubject
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Sep 20, 21:54 (5 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
935900
Default Alt Text
collection-field-subject.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment