feat: split worker login device limits by type
This commit is contained in:
@@ -41,9 +41,9 @@ export async function createWorkerSessionRecord(
|
||||
)
|
||||
const activeResult = await client.query<WorkerSessionRow>(
|
||||
`SELECT * FROM worker_sessions
|
||||
WHERE worker_id = $1 AND status = 'active' AND expires_at > $2
|
||||
WHERE worker_id = $1 AND device_type = $2 AND status = 'active' AND expires_at > $3
|
||||
ORDER BY last_seen_at DESC, id DESC`,
|
||||
[input.workerId, input.now],
|
||||
[input.workerId, input.deviceType, input.now],
|
||||
)
|
||||
const activeSessions = activeResult.rows
|
||||
if (activeSessions.length >= input.maxDevices) {
|
||||
|
||||
Reference in New Issue
Block a user