Skip to content

feat(api-keys): add api key expiration - #222

Merged
mijinummi merged 2 commits into
MD-Creative-Production:mainfrom
rabsqueen:feat/108-api-key-entity
Aug 20, 2026
Merged

feat(api-keys): add api key expiration#222
mijinummi merged 2 commits into
MD-Creative-Production:mainfrom
rabsqueen:feat/108-api-key-entity

Conversation

@rabsqueen

Copy link
Copy Markdown
Contributor

Summary

Implements #108 by completing the API key entity with expiration support
while preserving the existing ownership and revocation relationships.

Changes

  • Added optional expiresAt field to ApiKey.
  • Added an index on expiresAt for efficient expiration queries.
  • Preserved the existing User -> ApiKey ownership relationship.
  • Preserved cascading deletion when an owning user is deleted.
  • Preserved unique API key and key hash constraints.
  • Generated the corresponding Prisma migration.

API Key Entity

The ApiKey entity now supports:

  • Ownership through userId.
  • Unique API key identification.
  • Hashed key storage.
  • Optional expiration.
  • Revocation tracking.
  • Last-used tracking.
  • Creation timestamp.

Database

Generated Prisma migration:

add_api_key_expiration

Validation

  • npx prisma validate
  • npx prisma format
  • npx prisma generate
  • npx prisma migrate status
  • npm run format:check
  • npm run lint
  • npm run typecheck
  • npm test
  • npm run build

Closes #108

@mijinummi
mijinummi merged commit 0b0cae0 into MD-Creative-Production:main Aug 20, 2026
10 of 13 checks passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Aug 20, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create API Key Entity

2 participants