diff --git a/src/db/agent-group-members.ts b/src/db/agent-group-members.ts index 29a5a2c..d2b6c8f 100644 --- a/src/db/agent-group-members.ts +++ b/src/db/agent-group-members.ts @@ -12,9 +12,7 @@ export function addMember(row: AgentGroupMember): void { } export function removeMember(userId: string, agentGroupId: string): void { - getDb() - .prepare('DELETE FROM agent_group_members WHERE user_id = ? AND agent_group_id = ?') - .run(userId, agentGroupId); + getDb().prepare('DELETE FROM agent_group_members WHERE user_id = ? AND agent_group_id = ?').run(userId, agentGroupId); } export function getMembers(agentGroupId: string): AgentGroupMember[] { diff --git a/src/db/db-v2.test.ts b/src/db/db-v2.test.ts index 8054981..7eb84e3 100644 --- a/src/db/db-v2.test.ts +++ b/src/db/db-v2.test.ts @@ -269,7 +269,9 @@ describe('messaging group agents', () => { }); createMessagingGroupAgent({ ...mga(), id: 'mga-2', messaging_group_id: 'mg-2' }); - const dests = getDestinations('ag-1').map((d) => d.local_name).sort(); + const dests = getDestinations('ag-1') + .map((d) => d.local_name) + .sort(); expect(dests).toEqual(['gen', 'gen-2']); }); }); diff --git a/src/db/user-dms.ts b/src/db/user-dms.ts index b6a549f..c788662 100644 --- a/src/db/user-dms.ts +++ b/src/db/user-dms.ts @@ -14,9 +14,9 @@ export function upsertUserDm(row: UserDm): void { } export function getUserDm(userId: string, channelType: string): UserDm | undefined { - return getDb() - .prepare('SELECT * FROM user_dms WHERE user_id = ? AND channel_type = ?') - .get(userId, channelType) as UserDm | undefined; + return getDb().prepare('SELECT * FROM user_dms WHERE user_id = ? AND channel_type = ?').get(userId, channelType) as + | UserDm + | undefined; } export function getUserDmsForUser(userId: string): UserDm[] { diff --git a/src/delivery.ts b/src/delivery.ts index c631864..0bc3d2f 100644 --- a/src/delivery.ts +++ b/src/delivery.ts @@ -19,12 +19,7 @@ import { getSession, createPendingApproval, } from './db/sessions.js'; -import { - getAgentGroup, - createAgentGroup, - updateAgentGroup, - getAgentGroupByFolder, -} from './db/agent-groups.js'; +import { getAgentGroup, createAgentGroup, updateAgentGroup, getAgentGroupByFolder } from './db/agent-groups.js'; import { createDestination, getDestinationByName, hasDestination, normalizeName } from './db/agent-destinations.js'; import { getMessagingGroup, getMessagingGroupByPlatform } from './db/messaging-groups.js'; import { pickApprovalDelivery, pickApprover } from './access.js'; @@ -382,9 +377,7 @@ async function deliverMessage( if (msg.channel_type && msg.platform_id) { const mg = getMessagingGroupByPlatform(msg.channel_type, msg.platform_id); if (!mg) { - throw new Error( - `unknown messaging group for ${msg.channel_type}/${msg.platform_id} (message ${msg.id})`, - ); + throw new Error(`unknown messaging group for ${msg.channel_type}/${msg.platform_id} (message ${msg.id})`); } const isOriginChat = session.messaging_group_id === mg.id; if (!isOriginChat && !hasDestination(session.agent_group_id, 'channel', mg.id)) { diff --git a/src/router.ts b/src/router.ts index 400d04c..56754e0 100644 --- a/src/router.ts +++ b/src/router.ts @@ -208,10 +208,7 @@ function extractAndUpsertUser(event: InboundEvent): string | null { return userId; } -function enforceAccess( - userId: string | null, - agentGroupId: string, -): { allowed: boolean; reason: string } { +function enforceAccess(userId: string | null, agentGroupId: string): { allowed: boolean; reason: string } { if (!userId) return { allowed: false, reason: 'unknown_user' }; const decision = canAccessAgentGroup(userId, agentGroupId); if (decision.allowed) return { allowed: true, reason: decision.reason };