Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

8.8 KB
Raw Blame
-- Fixture for importance-filter pagination tests.
--
-- Two inbox links. On each link the most-recent threads are not important and
-- the important threads are older, so an importance match cannot be satisfied
-- by taking the most-recent threads alone.
--
-- Link 1 (a1111111…): 3 recent non-important + 4 older important inbox threads.
-- Link 2 (b2222222…): 2 important inbox threads.

INSERT INTO email_links (id, macro_id, fusionauth_user_id, email_address, provider, is_sync_active, created_at, updated_at)
VALUES
    ('a1111111-1111-1111-1111-111111111111', 'macro|[email protected]', 'fa1', '[email protected]', 'GMAIL', true, NOW(), NOW()),
    ('b2222222-2222-2222-2222-222222222222', 'macro2', 'fa2', '[email protected]', 'GMAIL', true, NOW(), NOW());

INSERT INTO email_contacts (id, link_id, email_address, name, created_at, updated_at)
VALUES
    ('c0000001-0000-0000-0000-000000000001', 'a1111111-1111-1111-1111-111111111111', '[email protected]', 'Sender One', NOW(), NOW()),
    ('c0000002-0000-0000-0000-000000000002', 'b2222222-2222-2222-2222-222222222222', '[email protected]', 'Sender Two', NOW(), NOW());

-- Per-link labels. CATEGORY_PERSONAL is a priority label (important);
-- CATEGORY_PROMOTIONS is a depriority label (not important when no priority).
INSERT INTO email_labels (id, link_id, provider_label_id, name, message_list_visibility, label_list_visibility, type, created_at)
VALUES
    ('1a000001-0000-0000-0000-000000000001', 'a1111111-1111-1111-1111-111111111111', 'INBOX', 'INBOX', 'Show', 'LabelShow', 'System', NOW()),
    ('1a000002-0000-0000-0000-000000000002', 'a1111111-1111-1111-1111-111111111111', 'TRASH', 'TRASH', 'Hide', 'LabelHide', 'System', NOW()),
    ('1a000003-0000-0000-0000-000000000003', 'a1111111-1111-1111-1111-111111111111', 'CATEGORY_PERSONAL', 'CATEGORY_PERSONAL', 'Show', 'LabelShow', 'System', NOW()),
    ('1a000004-0000-0000-0000-000000000004', 'a1111111-1111-1111-1111-111111111111', 'CATEGORY_PROMOTIONS', 'CATEGORY_PROMOTIONS', 'Show', 'LabelShow', 'System', NOW()),
    ('1b000001-0000-0000-0000-000000000001', 'b2222222-2222-2222-2222-222222222222', 'INBOX', 'INBOX', 'Show', 'LabelShow', 'System', NOW()),
    ('1b000002-0000-0000-0000-000000000002', 'b2222222-2222-2222-2222-222222222222', 'TRASH', 'TRASH', 'Hide', 'LabelHide', 'System', NOW()),
    ('1b000003-0000-0000-0000-000000000003', 'b2222222-2222-2222-2222-222222222222', 'CATEGORY_PERSONAL', 'CATEGORY_PERSONAL', 'Show', 'LabelShow', 'System', NOW()),
    ('1b000004-0000-0000-0000-000000000004', 'b2222222-2222-2222-2222-222222222222', 'CATEGORY_PROMOTIONS', 'CATEGORY_PROMOTIONS', 'Show', 'LabelShow', 'System', NOW());

INSERT INTO email_threads (
    id, provider_id, link_id, inbox_visible, is_read,
    latest_inbound_message_ts, latest_outbound_message_ts, latest_non_spam_message_ts,
    created_at, updated_at
)
VALUES
    -- Link 1: 3 most-recent non-important inbox threads
    ('2a000001-0000-0000-0000-000000000001', 'na1', 'a1111111-1111-1111-1111-111111111111', true, false, '2024-02-10 10:00:00+00', NULL, '2024-02-10 10:00:00+00', NOW(), NOW()),
    ('2a000002-0000-0000-0000-000000000002', 'na2', 'a1111111-1111-1111-1111-111111111111', true, false, '2024-02-09 10:00:00+00', NULL, '2024-02-09 10:00:00+00', NOW(), NOW()),
    ('2a000003-0000-0000-0000-000000000003', 'na3', 'a1111111-1111-1111-1111-111111111111', true, false, '2024-02-08 10:00:00+00', NULL, '2024-02-08 10:00:00+00', NOW(), NOW()),
    -- Link 1: 4 older important inbox threads
    ('2a000004-0000-0000-0000-000000000004', 'ia1', 'a1111111-1111-1111-1111-111111111111', true, false, '2024-02-07 10:00:00+00', NULL, '2024-02-07 10:00:00+00', NOW(), NOW()),
    ('2a000005-0000-0000-0000-000000000005', 'ia2', 'a1111111-1111-1111-1111-111111111111', true, false, '2024-02-06 10:00:00+00', NULL, '2024-02-06 10:00:00+00', NOW(), NOW()),
    ('2a000006-0000-0000-0000-000000000006', 'ia3', 'a1111111-1111-1111-1111-111111111111', true, false, '2024-02-05 10:00:00+00', NULL, '2024-02-05 10:00:00+00', NOW(), NOW()),
    ('2a000007-0000-0000-0000-000000000007', 'ia4', 'a1111111-1111-1111-1111-111111111111', true, false, '2024-02-04 10:00:00+00', NULL, '2024-02-04 10:00:00+00', NOW(), NOW()),
    -- Link 2: 2 important inbox threads
    ('2b000001-0000-0000-0000-000000000001', 'ib1', 'b2222222-2222-2222-2222-222222222222', true, false, '2024-02-03 10:00:00+00', NULL, '2024-02-03 10:00:00+00', NOW(), NOW()),
    ('2b000002-0000-0000-0000-000000000002', 'ib2', 'b2222222-2222-2222-2222-222222222222', true, false, '2024-02-02 10:00:00+00', NULL, '2024-02-02 10:00:00+00', NOW(), NOW());

INSERT INTO email_messages (
    id, thread_id, link_id, provider_id, from_contact_id,
    subject, snippet, internal_date_ts,
    is_draft, is_sent, is_starred, is_read,
    created_at, updated_at
)
VALUES
    ('3a000001-0000-0000-0000-000000000001', '2a000001-0000-0000-0000-000000000001', 'a1111111-1111-1111-1111-111111111111', 'na1', 'c0000001-0000-0000-0000-000000000001', 'Promo 1', 'promo', '2024-02-10 10:00:00+00', false, false, false, false, NOW(), NOW()),
    ('3a000002-0000-0000-0000-000000000002', '2a000002-0000-0000-0000-000000000002', 'a1111111-1111-1111-1111-111111111111', 'na2', 'c0000001-0000-0000-0000-000000000001', 'Promo 2', 'promo', '2024-02-09 10:00:00+00', false, false, false, false, NOW(), NOW()),
    ('3a000003-0000-0000-0000-000000000003', '2a000003-0000-0000-0000-000000000003', 'a1111111-1111-1111-1111-111111111111', 'na3', 'c0000001-0000-0000-0000-000000000001', 'Promo 3', 'promo', '2024-02-08 10:00:00+00', false, false, false, false, NOW(), NOW()),
    ('3a000004-0000-0000-0000-000000000004', '2a000004-0000-0000-0000-000000000004', 'a1111111-1111-1111-1111-111111111111', 'ia1', 'c0000001-0000-0000-0000-000000000001', 'Important 1', 'important', '2024-02-07 10:00:00+00', false, false, false, false, NOW(), NOW()),
    ('3a000005-0000-0000-0000-000000000005', '2a000005-0000-0000-0000-000000000005', 'a1111111-1111-1111-1111-111111111111', 'ia2', 'c0000001-0000-0000-0000-000000000001', 'Important 2', 'important', '2024-02-06 10:00:00+00', false, false, false, false, NOW(), NOW()),
    ('3a000006-0000-0000-0000-000000000006', '2a000006-0000-0000-0000-000000000006', 'a1111111-1111-1111-1111-111111111111', 'ia3', 'c0000001-0000-0000-0000-000000000001', 'Important 3', 'important', '2024-02-05 10:00:00+00', false, false, false, false, NOW(), NOW()),
    ('3a000007-0000-0000-0000-000000000007', '2a000007-0000-0000-0000-000000000007', 'a1111111-1111-1111-1111-111111111111', 'ia4', 'c0000001-0000-0000-0000-000000000001', 'Important 4', 'important', '2024-02-04 10:00:00+00', false, false, false, false, NOW(), NOW()),
    ('3b000001-0000-0000-0000-000000000001', '2b000001-0000-0000-0000-000000000001', 'b2222222-2222-2222-2222-222222222222', 'ib1', 'c0000002-0000-0000-0000-000000000002', 'Important 5', 'important', '2024-02-03 10:00:00+00', false, false, false, false, NOW(), NOW()),
    ('3b000002-0000-0000-0000-000000000002', '2b000002-0000-0000-0000-000000000002', 'b2222222-2222-2222-2222-222222222222', 'ib2', 'c0000002-0000-0000-0000-000000000002', 'Important 6', 'important', '2024-02-02 10:00:00+00', false, false, false, false, NOW(), NOW());

INSERT INTO email_message_labels (message_id, label_id)
VALUES
    -- Non-important: INBOX + CATEGORY_PROMOTIONS (depriority, no priority label)
    ('3a000001-0000-0000-0000-000000000001', '1a000001-0000-0000-0000-000000000001'),
    ('3a000001-0000-0000-0000-000000000001', '1a000004-0000-0000-0000-000000000004'),
    ('3a000002-0000-0000-0000-000000000002', '1a000001-0000-0000-0000-000000000001'),
    ('3a000002-0000-0000-0000-000000000002', '1a000004-0000-0000-0000-000000000004'),
    ('3a000003-0000-0000-0000-000000000003', '1a000001-0000-0000-0000-000000000001'),
    ('3a000003-0000-0000-0000-000000000003', '1a000004-0000-0000-0000-000000000004'),
    -- Important: INBOX + CATEGORY_PERSONAL (priority label)
    ('3a000004-0000-0000-0000-000000000004', '1a000001-0000-0000-0000-000000000001'),
    ('3a000004-0000-0000-0000-000000000004', '1a000003-0000-0000-0000-000000000003'),
    ('3a000005-0000-0000-0000-000000000005', '1a000001-0000-0000-0000-000000000001'),
    ('3a000005-0000-0000-0000-000000000005', '1a000003-0000-0000-0000-000000000003'),
    ('3a000006-0000-0000-0000-000000000006', '1a000001-0000-0000-0000-000000000001'),
    ('3a000006-0000-0000-0000-000000000006', '1a000003-0000-0000-0000-000000000003'),
    ('3a000007-0000-0000-0000-000000000007', '1a000001-0000-0000-0000-000000000001'),
    ('3a000007-0000-0000-0000-000000000007', '1a000003-0000-0000-0000-000000000003'),
    ('3b000001-0000-0000-0000-000000000001', '1b000001-0000-0000-0000-000000000001'),
    ('3b000001-0000-0000-0000-000000000001', '1b000003-0000-0000-0000-000000000003'),
    ('3b000002-0000-0000-0000-000000000002', '1b000001-0000-0000-0000-000000000001'),
    ('3b000002-0000-0000-0000-000000000002', '1b000003-0000-0000-0000-000000000003');