* 设置应用开放的能力
(
ctx: TcContext<{
appId: string;
capability: string[];
}>
)
| 272 | * 设置应用开放的能力 |
| 273 | */ |
| 274 | async setAppCapability( |
| 275 | ctx: TcContext<{ |
| 276 | appId: string; |
| 277 | capability: string[]; |
| 278 | }> |
| 279 | ) { |
| 280 | const { appId, capability } = ctx.params; |
| 281 | const { userId } = ctx.meta; |
| 282 | |
| 283 | const openapp = await this.adapter.model.findAppByIdAndOwner(appId, userId); |
| 284 | if (!openapp) { |
| 285 | throw new Error('Not found openapp'); |
| 286 | } |
| 287 | |
| 288 | await openapp |
| 289 | .updateOne({ |
| 290 | capability: filterAvailableAppCapability(_.uniq(capability)), |
| 291 | }) |
| 292 | .exec(); |
| 293 | |
| 294 | await this.cleanAppInfoCache(appId); |
| 295 | |
| 296 | return true; |
| 297 | } |
| 298 | |
| 299 | /** |
| 300 | * 设置OAuth的设置信息 |
nothing calls this directly
no test coverage detected