MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / get

Method get

packages/blog/index.ts:137–152  ·  view source on GitHub ↗
({ domainId }, did: ObjectId)

Source from the content-addressed store, hash-verified

135class BlogDetailHandler extends BlogHandler {
136 @param('did', Types.ObjectId)
137 async get({ domainId }, did: ObjectId) {
138 const dsdoc = this.user.hasPriv(PRIV.PRIV_USER_PROFILE)
139 ? await BlogModel.getStatus(did, this.user._id)
140 : null;
141 const udoc = await UserModel.getById(domainId, this.ddoc!.owner);
142 if (!dsdoc?.view) {
143 await Promise.all([
144 BlogModel.inc(did, 'views', 1),
145 BlogModel.setStatus(did, this.user._id, { view: true }),
146 ]);
147 }
148 this.response.template = 'blog_detail.html';
149 this.response.body = {
150 ddoc: this.ddoc, dsdoc, udoc,
151 };
152 }
153
154 async post() {
155 this.checkPriv(PRIV.PRIV_USER_PROFILE);

Callers

nothing calls this directly

Calls 6

hasPrivMethod · 0.80
getByIdMethod · 0.80
setStatusMethod · 0.80
getStatusMethod · 0.45
allMethod · 0.45
incMethod · 0.45

Tested by

no test coverage detected