({
accountId,
name,
scope,
}: {
accountId: string;
name: string;
scope?: string[];
})
| 33 | } |
| 34 | |
| 35 | static async create({ |
| 36 | accountId, |
| 37 | name, |
| 38 | scope, |
| 39 | }: { |
| 40 | accountId: string; |
| 41 | name: string; |
| 42 | scope?: string[]; |
| 43 | }) { |
| 44 | const { token, hash } = this.createKey(); |
| 45 | await prisma.apiKeys.create({ |
| 46 | data: { name, accountId, scope, hash }, |
| 47 | }); |
| 48 | return { token }; |
| 49 | } |
| 50 | |
| 51 | static async revoke({ id, accountId }: { id: string; accountId: string }) { |
| 52 | const apiKey = await prisma.apiKeys.findUnique({ where: { id } }); |
no test coverage detected