Device Token Repository
Component Detail
Data Layer
low complexity
backend
0
Dependencies
2
Dependents
1
Entities
0
Integrations
Description
Data access layer for the device_tokens table. Provides CRUD operations for storing and querying FCM/APNs tokens per user with platform metadata. Used by both the registration service and the push notification service to resolve target tokens before dispatch.
device-token-repository
Responsibilities
- Insert or update device token records (upsert by userId + deviceId)
- Retrieve all active tokens for a given userId
- Delete token records on logout or token invalidation
- Query tokens filtered by platform (ios/android) for targeted sends
Interfaces
upsert(record: DeviceTokenRecord) → Promise<void>
findByUserId(userId: string) → Promise<DeviceTokenRecord[]>
findByUserIds(userIds: string[]) → Promise<DeviceTokenRecord[]>
deleteByDeviceId(userId: string, deviceId: string) → Promise<void>
deleteAllForUser(userId: string) → Promise<void>
Relationships
Dependents (2)
Components that depend on this component