diff --git a/services/platform-service/src/modules/licenses/routes.ts b/services/platform-service/src/modules/licenses/routes.ts index b7f89932..62379720 100644 --- a/services/platform-service/src/modules/licenses/routes.ts +++ b/services/platform-service/src/modules/licenses/routes.ts @@ -177,6 +177,23 @@ export async function licenseRoutes(app: FastifyInstance) { return updated; }); + // Revoke license + app.post('/licenses/revoke', async req => { + const { key } = req.body as { key: string }; + if (!key) throw new BadRequestError('key is required'); + const productId = getRequestProductId(req); + const license = await repo.getByKey(key, productId); + if (!license) throw new NotFoundError('License not found'); + if (license.status === 'revoked') return license; + + const updated = await repo.update(license.id, license.userId, { + status: 'revoked', + deviceIds: [], + }); + if (!updated) throw new NotFoundError('License update failed'); + return updated; + }); + // Status app.get('/licenses/status/:key', async req => { const { key } = req.params as { key: string };