(teamId, userData, body)
| 460 | } |
| 461 | |
| 462 | async createApiKey(teamId, userData, body) { |
| 463 | try { |
| 464 | const token = jwt.sign({ |
| 465 | id: userData.id, |
| 466 | email: userData.email, |
| 467 | }, settings.encryptionKey, { expiresIn: "9999 years" }); |
| 468 | |
| 469 | return await db.Apikey.create({ |
| 470 | name: body.name, |
| 471 | team_id: teamId, |
| 472 | token, |
| 473 | }); |
| 474 | } catch (e) { |
| 475 | return Promise.reject(e); |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | getApiKeys(teamId) { |
| 480 | return db.Apikey.findAll({ where: { team_id: teamId } }) |