| 113 | } |
| 114 | |
| 115 | class BlogUserHandler extends BlogHandler { |
| 116 | @param('uid', Types.Int) |
| 117 | @param('page', Types.PositiveInt, true) |
| 118 | async get(domainId: string, uid: number, page = 1) { |
| 119 | const [ddocs, dpcount] = await this.ctx.db.paginate( |
| 120 | BlogModel.getMulti({ owner: uid }), |
| 121 | page, |
| 122 | 10, |
| 123 | ); |
| 124 | const udoc = await UserModel.getById(domainId, uid); |
| 125 | this.response.template = 'blog_main.html'; |
| 126 | this.response.body = { |
| 127 | ddocs, |
| 128 | dpcount, |
| 129 | udoc, |
| 130 | page, |
| 131 | }; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | class BlogDetailHandler extends BlogHandler { |
| 136 | @param('did', Types.ObjectId) |