Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7189095
collections-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
collections-subject.js
View Options
"use strict"
;
const
locreq
=
require
(
"locreq"
)(
__dirname
);
const
Promise
=
require
(
"bluebird"
);
const
Errors
=
locreq
(
"lib/response/error.js"
);
const
Subject
=
locreq
(
"lib/subject/subject.js"
);
const
CollectionSubject
=
locreq
(
"lib/subject/subject-types/collection-subject.js"
);
const
CollectionsSubject
=
function
(
app
)
{
this
.
resource_collections
=
null
;
this
.
_initialize_resource_collections
=
function
()
{
this
.
resource_collections
=
{};
const
collections
=
app
.
ChipManager
.
get_chips_by_type
(
"collection"
);
for
(
const
collection_name
in
collections
)
{
const
collection
=
collections
[
collection_name
];
this
.
resource_collections
[
collection_name
]
=
new
CollectionSubject
(
app
,
collection
);
}
};
this
.
get_child_subject
=
function
(
key
)
{
if
(
this
.
resource_collections
===
null
||
this
.
resource_collections
[
key
]
===
undefined
)
{
this
.
_initialize_resource_collections
();
}
if
(
this
.
resource_collections
[
key
]
===
undefined
)
{
throw
new
Errors
.
BadSubjectPath
(
`Unknown collection: '
${
key
}
'.`
);
}
return
Promise
.
resolve
(
this
.
resource_collections
[
key
]);
};
this
.
perform_action
=
function
(
context
,
action_name
,
args
)
{
throw
new
Errors
.
BadSubjectAction
(
"This subject does not provide any actions."
);
};
};
CollectionsSubject
.
prototype
=
Object
.
create
(
Subject
.
prototype
);
CollectionsSubject
.
subject_name
=
"collections"
;
module
.
exports
=
CollectionsSubject
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jul 8, 08:44 (2 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
804541
Default Alt Text
collections-subject.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment