Merged
Conversation
|
@Divineifed1 is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
yusuftomilola
approved these changes
Oct 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces a new API Keys Module that allows companies to securely generate, manage, and authenticate API keys for integrating with AssetsUp’s backend services.
Key Features
API Key Entity (api_keys table) with fields: id, key, companyId, status, expiryDate, timestamps.
Endpoints for key management:
POST /api-keys → Generate a new API key for a company.
DELETE /api-keys → Revoke (disable) an existing API key.
GET /api-keys/:companyId → List all API keys for a given company.
Service logic for:
Secure random API key generation (crypto.randomBytes)
Validation of active and non-expired keys
Revocation and listing of keys
Middleware (ApiKeyMiddleware) to validate API keys via the x-api-key header for protected routes.
Company relation added to allow each company to own multiple API keys.
Technical Details
Module: ApiKeysModule
Files added:
api-key.entity.ts
dto/create-api-key.dto.ts
dto/revoke-api-key.dto.ts
providers/api-keys.service.ts
api-keys.controller.ts
middleware/api-key.middleware.ts
api-keys.module.ts
Integrated with existing Company entity through TypeORM relations.