(
domainId: string, tid: ObjectId,
title: string, content: string,
_dag: string, pin = 0, description: string,
)
| 214 | @param('pin', Types.UnsignedInt) |
| 215 | @param('description', Types.Content) |
| 216 | async post( |
| 217 | domainId: string, tid: ObjectId, |
| 218 | title: string, content: string, |
| 219 | _dag: string, pin = 0, description: string, |
| 220 | ) { |
| 221 | if ((!!this.tdoc?.pin) !== (!!pin)) this.checkPerm(PERM.PERM_PIN_TRAINING); |
| 222 | const dag = await _parseDagJson(domainId, _dag); |
| 223 | const pids = training.getPids(dag); |
| 224 | assert(pids.length, new ValidationError('dag', null, 'Please specify at least one problem')); |
| 225 | if (!tid) { |
| 226 | tid = await training.add(domainId, title, content, this.user._id, dag, description, pin); |
| 227 | } else { |
| 228 | await training.edit(domainId, tid, { |
| 229 | title, content, dag, description, pin, |
| 230 | }); |
| 231 | } |
| 232 | this.response.body = { tid }; |
| 233 | this.response.redirect = this.url('training_detail', { tid }); |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | export class TrainingFilesHandler extends Handler { |
nothing calls this directly
no test coverage detected