Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(calls): unattended call filter (#2715)
Will Hutchinsone51a4b28dc58
diff --git a/js/app/bun.lock b/js/app/bun.lockindex 7f76cdbc2a..a265db8541 100644--- a/js/app/bun.lock+++ b/js/app/bun.lock@@ -662,7 +662,7 @@"@ibm-cloud/openapi-ruleset-utilities": ["@ibm-cloud/[email protected]", "", {}, "sha512-AoFbSarOqFBYH+1TZ9Ahkm2IWYSi5v0pBk88fpV+5b3qGJukypX8PwvCWADjuyIccKg48/F73a6hTTkBzDQ2UA=="],- "@inkibra/tauri-plugins": ["@inkibra/tauri-plugins@github:macro-inc/tauri-plugins#6152009", { "dependencies": { "react": "^18.3.1", "react-dom": "^18.3.1" } }, "macro-inc-tauri-plugins-6152009", "sha512-XLN+niDA9BkzrxiZqBjYf+DL4TLoMIcI80ypCowacVfrfAjWt0qLwLkzWVUXjD7k3v0DB/G+BP4OLJNkGygHIw=="],+ "@inkibra/tauri-plugins": ["@inkibra/tauri-plugins@github:macro-inc/tauri-plugins#6152009", { "dependencies": { "react": "^18.3.1", "react-dom": "^18.3.1" } }, "macro-inc-tauri-plugins-6152009"],"@internationalized/date": ["@internationalized/[email protected]", "", { "dependencies": { "@swc/helpers": "^0.5.0" } }, "sha512-jLxQjefH9VI5P9UQuqB6qNKnvFt1Ky1TPIzHGsIlCi7sZZoMR8SdYbBGRvM0y+Jtb+ez4ieBzmiAUcpmPYpyOw=="],@@ -2350,7 +2350,7 @@"pathval": ["[email protected]", "", {}, "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA=="],- "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6", "sha512-HDFaPbCxLG2GHpf1smUG97nku5aPGBGaCcIbK05dGdp07TBLUlDcXsM4WcE82mO5W4RBPIBVYobX5N/6M6NFrA=="],+ "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6"],"performance-now": ["[email protected]", "", {}, "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="],diff --git a/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts b/js/app/packages/app/component/app-sidebar/soup-filter-presets.tsindex 844a4b0eec..0b05ea88af 100644--- a/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts+++ b/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts@@ -304,6 +304,13 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {queryFilters: QUERY_FILTERS.calls,clientFilters: { and: ['calls'] },}),+ unattended: () => ({+ queryFilters: {+ ...QUERY_FILTERS.calls,+ call_filters: { attended: false },+ },+ clientFilters: { and: ['calls'] },+ }),},},folders: {diff --git a/js/app/packages/app/component/next-soup/filters/query-filters.ts b/js/app/packages/app/component/next-soup/filters/query-filters.tsindex 42b0fd5b3e..b5fcd7c4dc 100644--- a/js/app/packages/app/component/next-soup/filters/query-filters.ts+++ b/js/app/packages/app/component/next-soup/filters/query-filters.ts@@ -31,6 +31,14 @@ function isValueFilteredOut(return !values.includes(value);}+function isAttendedFilteredOut(+ attendedFilter: boolean | null | undefined,+ itemAttended: boolean+): boolean {+ if (attendedFilter !== true && attendedFilter !== false) return false;+ return itemAttended !== attendedFilter;+}+// TODO: this only supports the subset of soup filters needed for cache matching.export function filterSoupItemByRequestBody(item: SoupApiItem,@@ -68,7 +76,8 @@ export function filterSoupItemByRequestBody(.with({ tag: 'callRecord' },({ data }) =>- !isIdFilteredOut(body.call_filters?.channel_ids, data.channelId)+ !isIdFilteredOut(body.call_filters?.channel_ids, data.channelId) &&+ !isAttendedFilteredOut(body.call_filters?.attended, data.attended)).exhaustive();}diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsxindex b4d3c01907..ac57e0293d 100644--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx@@ -17,7 +17,14 @@ import ChevronDownIcon from '@icon/regular/caret-down.svg';/** Views that have tab definitions. Shared between VIEW_TAB_LISTS and VIEW_TAB_PRESETS. */export type TabbedListView = Extract<ListView,- 'inbox' | 'agents' | 'mail' | 'documents' | 'tasks' | 'channels' | 'folders'+ | 'inbox'+ | 'agents'+ | 'mail'+ | 'documents'+ | 'tasks'+ | 'channels'+ | 'calls'+ | 'folders'>;/** Tab definitions for each list view. */@@ -57,6 +64,10 @@ export const VIEW_TAB_LISTS: Record<TabbedListView, TabItem[]> = {{ value: 'people', label: 'People' },{ value: 'teams', label: 'Teams' },],+ calls: [+ { value: 'all', label: 'All' },+ { value: 'unattended', label: 'Unattended' },+ ],folders: [{ value: 'owned', label: 'Owned' },{ value: 'all', label: 'All' },diff --git a/js/app/packages/entity/src/components/Badges.tsx b/js/app/packages/entity/src/components/Badges.tsxindex acc369f09f..35896b5872 100644--- a/js/app/packages/entity/src/components/Badges.tsx+++ b/js/app/packages/entity/src/components/Badges.tsx@@ -36,3 +36,17 @@ export function ImportantBadge() {</Badge>);}++export function AttendanceBadge(props: { attended: boolean }) {+ return (+ <Badge+ class={+ props.attended+ ? 'text-ink-extra-muted border-edge-muted px-2'+ : 'text-accent-30 border-edge-muted px-2'+ }+ >+ {props.attended ? 'attended' : 'unattended'}+ </Badge>+ );+}diff --git a/js/app/packages/entity/src/composed/ListEntity.tsx b/js/app/packages/entity/src/composed/ListEntity.tsxindex 8c5c15e143..0b8cad8288 100644--- a/js/app/packages/entity/src/composed/ListEntity.tsx+++ b/js/app/packages/entity/src/composed/ListEntity.tsx@@ -1,5 +1,6 @@import './ListEntity.css';import { EntityRow, EntityRowContext } from '@app/component/mobile/EntityRow';+import { useMaybeSoupView } from '@app/component/next-soup/soup-view/soup-view-context';import { useSplitPanel } from '@app/component/split-layout/layoutUtils';import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';import {@@ -40,7 +41,7 @@ import {Switch,useContext,} from 'solid-js';-import { DraftBadge, SharedBadge } from '../components/Badges';+import { AttendanceBadge, DraftBadge, SharedBadge } from '../components/Badges';import { MultiSelectCheckbox } from '../components/MultiSelectCheckbox';import { ProjectBreadCrumb } from '../components/ProjectBreadCrumb';import { UnreadIndicator } from '../components/UnreadIndicator';@@ -364,6 +365,7 @@ function NarrowLayout(props: LayoutProps) {}function NarrowInboxLayout(props: LayoutProps) {+ const soupView = useMaybeSoupView();const isDirectMessage = () =>isChannelEntity(props.entity) &&props.entity.channelType === 'direct_message';@@ -580,13 +582,16 @@ function NarrowInboxLayout(props: LayoutProps) {<span class="text-ink-muted text-xs truncate">{entity().channelName ?? 'Call'}</span>- <span class="text-ink-extra-muted text-xs">+ <span class="text-ink-extra-muted text-xs flex items-center gap-2"><Showwhen={entity().durationMs}fallback={entity().isActive ? 'In progress' : 'No duration'}>{(ms) => formatCallDuration(ms())}</Show>+ <Show when={soupView?.activeTab() === 'all'}>+ <AttendanceBadge attended={entity().attended} />+ </Show></span></Entity.Slot>)}@@ -605,6 +610,7 @@ function WideLayout(props: LayoutProps) {HTMLElement | undefined>();const chars = useCharacterCount(emailSnippetContainerRef);+ const soupView = useMaybeSoupView();return (<Entity.Layout@@ -768,6 +774,13 @@ function WideLayout(props: LayoutProps) {<Show when={props.isShared}><SharedBadge ownerId={props.entity.ownerId} /></Show>+ <Show when={isCallEntity(props.entity) && props.entity}>+ {(entity) => (+ <Show when={soupView?.activeTab() === 'all'}>+ <AttendanceBadge attended={entity().attended} />+ </Show>+ )}+ </Show><Show when={isTaskEntity(props.entity) && props.entity}>{(entity) => <Entity.Properties entity={entity()} />}</Show>diff --git a/js/app/packages/entity/src/types/entity.ts b/js/app/packages/entity/src/types/entity.tsindex ba629628fc..ce678b9437 100644--- a/js/app/packages/entity/src/types/entity.ts+++ b/js/app/packages/entity/src/types/entity.ts@@ -123,6 +123,7 @@ export type CallEntity = EntityBase & {channelId: string;channelName?: string;isActive: boolean;+ attended: boolean;durationMs?: number;participantIds: string[];};diff --git a/js/app/packages/queries/soup/transform-utils.ts b/js/app/packages/queries/soup/transform-utils.tsindex e3dbb73dce..3e4a457092 100644--- a/js/app/packages/queries/soup/transform-utils.ts+++ b/js/app/packages/queries/soup/transform-utils.ts@@ -456,6 +456,7 @@ export const mapSoupPageToEntityList: (updatedAt: item.data.endedAt ?? item.data.startedAt,sortTs: item.data.endedAt ?? item.data.startedAt,isActive: item.data.isActive,+ attended: item.data.attended,durationMs: item.data.durationMs ?? undefined,participantIds: item.data.participants.map((p) => p.userId),} satisfies CallEntity;diff --git a/js/app/packages/service-clients/service-search/generated/models/callFilters.ts b/js/app/packages/service-clients/service-search/generated/models/callFilters.tsindex 48edd2553a..c61c581a29 100644--- a/js/app/packages/service-clients/service-search/generated/models/callFilters.ts+++ b/js/app/packages/service-clients/service-search/generated/models/callFilters.ts@@ -4,11 +4,16 @@* search_service* OpenAPI spec version: 0.1.0*/+import type { CallFiltersAttended } from './callFiltersAttended';/*** Filters for call records.*/export interface CallFilters {+ /** Filter by whether the requesting user attended the call.+`None` = no filter, `Some(true)` = only calls the user joined,+`Some(false)` = only calls the user did not join. */+ attended?: CallFiltersAttended;/** Channel IDs to filter calls by. Empty to include all calls. */channel_ids?: string[];}diff --git a/js/app/packages/service-clients/service-search/generated/models/callFiltersAttended.ts b/js/app/packages/service-clients/service-search/generated/models/callFiltersAttended.tsnew file mode 100644index 0000000000..7d0676951f--- /dev/null+++ b/js/app/packages/service-clients/service-search/generated/models/callFiltersAttended.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * search_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Filter by whether the requesting user attended the call.+`None` = no filter, `Some(true)` = only calls the user joined,+`Some(false)` = only calls the user did not join.+ */+export type CallFiltersAttended = boolean | null;diff --git a/js/app/packages/service-clients/service-search/generated/models/index.ts b/js/app/packages/service-clients/service-search/generated/models/index.tsindex 2e37211230..76044097e9 100644--- a/js/app/packages/service-clients/service-search/generated/models/index.ts+++ b/js/app/packages/service-clients/service-search/generated/models/index.ts@@ -6,6 +6,7 @@*/export * from './callFilters';+export * from './callFiltersAttended';export * from './channelFilters';export * from './channelFiltersImportance';export * from './channelFiltersOrgId';diff --git a/js/app/packages/service-clients/service-search/openapi.json b/js/app/packages/service-clients/service-search/openapi.jsonindex e9f1b80919..e6f7d65297 100644--- a/js/app/packages/service-clients/service-search/openapi.json+++ b/js/app/packages/service-clients/service-search/openapi.json@@ -177,6 +177,10 @@"type": "object","description": "Filters for call records.","properties": {+ "attended": {+ "type": ["boolean", "null"],+ "description": "Filter by whether the requesting user attended the call.\n`None` = no filter, `Some(true)` = only calls the user joined,\n`Some(false)` = only calls the user did not join."+ },"channel_ids": {"type": "array","items": {diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/callFilters.ts b/js/app/packages/service-clients/service-storage/generated/schemas/callFilters.tsindex fce0a43ce1..3747fcade1 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/callFilters.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/callFilters.ts@@ -4,11 +4,16 @@* document_storage_service* OpenAPI spec version: 0.1.0*/+import type { CallFiltersAttended } from './callFiltersAttended';/*** Filters for call records.*/export interface CallFilters {+ /** Filter by whether the requesting user attended the call.+`None` = no filter, `Some(true)` = only calls the user joined,+`Some(false)` = only calls the user did not join. */+ attended?: CallFiltersAttended;/** Channel IDs to filter calls by. Empty to include all calls. */channel_ids?: string[];}diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/callFiltersAttended.ts b/js/app/packages/service-clients/service-storage/generated/schemas/callFiltersAttended.tsnew file mode 100644index 0000000000..6f70255135--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/callFiltersAttended.ts@@ -0,0 +1,13 @@+/**+ * Generated by orval v7.13.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Filter by whether the requesting user attended the call.+`None` = no filter, `Some(true)` = only calls the user joined,+`Some(false)` = only calls the user did not join.+ */+export type CallFiltersAttended = boolean | null;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts b/js/app/packages/service-clients/service-storage/generated/schemas/index.tsindex 21b91e08de..7a000c3fe6 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/index.ts@@ -78,6 +78,7 @@ export * from './basicDocumentUpdatedAt';export * from './bomPart';export * from './callActiveResponse';export * from './callFilters';+export * from './callFiltersAttended';export * from './callRecord';export * from './callRecordChannelName';export * from './callRecordDurationMs';diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupCallRecord.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupCallRecord.tsindex 5d1864b196..e0aed7a156 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/soupCallRecord.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/soupCallRecord.ts@@ -14,6 +14,9 @@ import type { SoupCallRecordParticipant } from './soupCallRecordParticipant';and transcript — fields that are irrelevant for the soup feed.*/export interface SoupCallRecord {+ /** Whether the requesting user attended this call (i.e. appears in the+`call_participants` / `call_record_participants` table). */+ attended: boolean;/** The call identifier. */callId: string;/** The channel this call belongs to. */diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.tsindex a6909bf534..3b5048dca8 100644--- a/js/app/packages/service-clients/service-storage/generated/zod.ts+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts@@ -4712,6 +4712,11 @@ export const getItemsSoupResponse = zod.object({zod.object({data: zod.object({+ attended: zod+ .boolean()+ .describe(+ 'Whether the requesting user attended this call (i.e. appears in the\n`call_participants` / `call_record_participants` table).'+ ),callId: zod.string().uuid().describe('The call identifier.'),channelId: zod.string()@@ -4791,6 +4796,12 @@ export const postItemsSoupBody = zod.object({call_filters: zod.object({+ attended: zod+ .boolean()+ .nullish()+ .describe(+ 'Filter by whether the requesting user attended the call.\n`None` = no filter, `Some(true)` = only calls the user joined,\n`Some(false)` = only calls the user did not join.'+ ),channel_ids: zod.array(zod.string()).optional()@@ -6388,6 +6399,11 @@ export const postItemsSoupResponse = zod.object({zod.object({data: zod.object({+ attended: zod+ .boolean()+ .describe(+ 'Whether the requesting user attended this call (i.e. appears in the\n`call_participants` / `call_record_participants` table).'+ ),callId: zod.string().uuid().describe('The call identifier.'),channelId: zod.string()@@ -7724,6 +7740,11 @@ export const postItemsSoupAstResponse = zod.object({zod.object({data: zod.object({+ attended: zod+ .boolean()+ .describe(+ 'Whether the requesting user attended this call (i.e. appears in the\n`call_participants` / `call_record_participants` table).'+ ),callId: zod.string().uuid().describe('The call identifier.'),channelId: zod.string()diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.jsonindex 740e0940d8..fb0277b015 100644--- a/js/app/packages/service-clients/service-storage/openapi.json+++ b/js/app/packages/service-clients/service-storage/openapi.json@@ -5892,6 +5892,10 @@"type": "object","description": "Filters for call records.","properties": {+ "attended": {+ "type": ["boolean", "null"],+ "description": "Filter by whether the requesting user attended the call.\n`None` = no filter, `Some(true)` = only calls the user joined,\n`Some(false)` = only calls the user did not join."+ },"channel_ids": {"type": "array","items": {@@ -10482,9 +10486,14 @@"createdBy","startedAt","isActive",+ "attended","participants"],"properties": {+ "attended": {+ "type": "boolean",+ "description": "Whether the requesting user attended this call (i.e. appears in the\n`call_participants` / `call_record_participants` table)."+ },"callId": {"type": "string","format": "uuid",diff --git a/rust/cloud-storage/call/.sqlx/query-ff145480985a4aa38e3b7c9394dfb9eb8724cdab4a668bc88f1d5fdcae4fa689.json b/rust/cloud-storage/call/.sqlx/query-98e00e0037837e450a38491da828ff7403ad803c5dfb3bcf1345167fa756211a.jsonsimilarity index 59%rename from rust/cloud-storage/call/.sqlx/query-ff145480985a4aa38e3b7c9394dfb9eb8724cdab4a668bc88f1d5fdcae4fa689.jsonrename to rust/cloud-storage/call/.sqlx/query-98e00e0037837e450a38491da828ff7403ad803c5dfb3bcf1345167fa756211a.jsonindex 1c9bfc5c7c..97d26f67f9 100644--- a/rust/cloud-storage/call/.sqlx/query-ff145480985a4aa38e3b7c9394dfb9eb8724cdab4a668bc88f1d5fdcae4fa689.json+++ b/rust/cloud-storage/call/.sqlx/query-98e00e0037837e450a38491da828ff7403ad803c5dfb3bcf1345167fa756211a.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n created_at as \"started_at!\",\n NULL::timestamptz as \"ended_at\",\n NULL::bigint as \"duration_ms\",\n egress_id,\n recording_key,\n true as \"is_active!\"\n FROM calls c\n WHERE EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = c.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n )\n AND ($3::bool IS FALSE OR c.channel_id = ANY($4))\n UNION ALL\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n started_at as \"started_at!\",\n ended_at as \"ended_at\",\n duration_ms as \"duration_ms\",\n egress_id,\n recording_key,\n false as \"is_active!\"\n FROM call_records cr\n WHERE EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = cr.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n )\n AND ($3::bool IS FALSE OR cr.channel_id = ANY($4))\n ORDER BY \"started_at!\" DESC\n LIMIT $2\n ",+ "query": "\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n created_at as \"started_at!\",\n NULL::timestamptz as \"ended_at\",\n NULL::bigint as \"duration_ms\",\n egress_id,\n recording_key,\n true as \"is_active!\"\n FROM calls c\n WHERE EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = c.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n )\n AND ($3::bool IS FALSE OR c.channel_id = ANY($4))\n AND ($5::bool IS NULL OR EXISTS (\n SELECT 1 FROM call_participants cp\n WHERE cp.call_id = c.id AND cp.user_id = $1\n ) = $5)\n UNION ALL\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n started_at as \"started_at!\",\n ended_at as \"ended_at\",\n duration_ms as \"duration_ms\",\n egress_id,\n recording_key,\n false as \"is_active!\"\n FROM call_records cr\n WHERE EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = cr.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n )\n AND ($3::bool IS FALSE OR cr.channel_id = ANY($4))\n AND ($5::bool IS NULL OR EXISTS (\n SELECT 1 FROM call_record_participants crp\n WHERE crp.call_record_id = cr.id AND crp.user_id = $1\n ) = $5)\n ORDER BY \"started_at!\" DESC\n LIMIT $2\n ","describe": {"columns": [{@@ -59,7 +59,8 @@"Text","Int8","Bool",- "UuidArray"+ "UuidArray",+ "Bool"]},"nullable": [@@ -75,5 +76,5 @@null]},- "hash": "ff145480985a4aa38e3b7c9394dfb9eb8724cdab4a668bc88f1d5fdcae4fa689"+ "hash": "98e00e0037837e450a38491da828ff7403ad803c5dfb3bcf1345167fa756211a"}diff --git a/rust/cloud-storage/call/.sqlx/query-bc5d15913b03fd0396e76b5551960bfde660e446ff82c8f14a5e4d17ae03dfc3.json b/rust/cloud-storage/call/.sqlx/query-bc5d15913b03fd0396e76b5551960bfde660e446ff82c8f14a5e4d17ae03dfc3.jsondeleted file mode 100644index 20d2ab0b0b..0000000000--- a/rust/cloud-storage/call/.sqlx/query-bc5d15913b03fd0396e76b5551960bfde660e446ff82c8f14a5e4d17ae03dfc3.json+++ /dev/null@@ -1,14 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n DELETE FROM call_records WHERE id = $1\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": []- },- "hash": "bc5d15913b03fd0396e76b5551960bfde660e446ff82c8f14a5e4d17ae03dfc3"-}diff --git a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs b/rust/cloud-storage/call/src/outbound/pg_call_repo.rsindex d337cf3256..2d593dcf47 100644--- a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs+++ b/rust/cloud-storage/call/src/outbound/pg_call_repo.rs@@ -35,6 +35,7 @@ fn extract_channel_ids(filter: &LiteralTree<CallLiteral>) -> Vec<Uuid> {fn collect_channel_ids(expr: &Expr<CallLiteral>, ids: &mut Vec<Uuid>) {match expr {Expr::Literal(CallLiteral::ChannelId(id)) => ids.push(*id),+ Expr::Literal(CallLiteral::Attended(_)) => {}Expr::And(a, b) | Expr::Or(a, b) => {collect_channel_ids(a, ids);collect_channel_ids(b, ids);@@ -43,6 +44,24 @@ fn collect_channel_ids(expr: &Expr<CallLiteral>, ids: &mut Vec<Uuid>) {}}+/// Extract the `attended` literal from a call filter AST, if any.+///+/// `ExpandFrame::expand_ast` only emits at most one `Attended` literal, so we+/// return the first one we find during a simple traversal.+fn extract_attended(filter: &LiteralTree<CallLiteral>) -> Option<bool> {+ let expr = filter.as_ref()?;+ find_attended(expr)+}++fn find_attended(expr: &Expr<CallLiteral>) -> Option<bool> {+ match expr {+ Expr::Literal(CallLiteral::Attended(b)) => Some(*b),+ Expr::Literal(CallLiteral::ChannelId(_)) => None,+ Expr::And(a, b) | Expr::Or(a, b) => find_attended(a).or_else(|| find_attended(b)),+ Expr::Not(inner) => find_attended(inner).map(|b| !b),+ }+}+/// Postgres implementation of [`CallRepository`].pub struct PgCallRepo {pool: PgPool,@@ -686,6 +705,7 @@ impl CallRepository for PgCallRepo {// large for the soup feed).let channel_ids = extract_channel_ids(filter);let has_channel_filter = !channel_ids.is_empty();+ let attended = extract_attended(filter);let rows = sqlx::query!(r#"@@ -708,6 +728,10 @@ impl CallRepository for PgCallRepo {AND ccp.left_at IS NULL)AND ($3::bool IS FALSE OR c.channel_id = ANY($4))+ AND ($5::bool IS NULL OR EXISTS (+ SELECT 1 FROM call_participants cp+ WHERE cp.call_id = c.id AND cp.user_id = $1+ ) = $5)UNION ALLSELECTid as "call_id!",@@ -728,6 +752,10 @@ impl CallRepository for PgCallRepo {AND ccp.left_at IS NULL)AND ($3::bool IS FALSE OR cr.channel_id = ANY($4))+ AND ($5::bool IS NULL OR EXISTS (+ SELECT 1 FROM call_record_participants crp+ WHERE crp.call_record_id = cr.id AND crp.user_id = $1+ ) = $5)ORDER BY "started_at!" DESCLIMIT $2"#,@@ -735,6 +763,7 @@ impl CallRepository for PgCallRepo {limit as i64,has_channel_filter,&channel_ids,+ attended,).fetch_all(&self.pool).await?;diff --git a/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rs b/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rsindex 1ab2669a2f..2d54df38ec 100644--- a/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rs+++ b/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rs@@ -1,14 +1,20 @@-use std::{ops::Deref, sync::LazyLock};+use std::{ops::Deref, sync::Arc, sync::LazyLock};use crate::domain::models::TranscriptSegmentRequest;use crate::domain::ports::CallRepository;use crate::outbound::pg_call_repo::PgCallRepo;use chrono::Utc;+use filter_ast::Expr;+use item_filters::ast::{LiteralTree, call::CallLiteral};use macro_db_migrator::MACRO_DB_MIGRATIONS;use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};use sqlx::{Pool, Postgres};use uuid::Uuid;+fn attended_filter(b: bool) -> LiteralTree<CallLiteral> {+ Some(Arc::new(Expr::Literal(CallLiteral::Attended(b))))+}+const CH1: Uuid = Uuid::from_u128(0x00000000_0000_0000_0000_000000000c01);const CH2: Uuid = Uuid::from_u128(0x00000000_0000_0000_0000_000000000c02);const CALL1: Uuid = Uuid::from_u128(0x00000000_0000_0000_0000_0000000ca110);@@ -649,6 +655,82 @@ async fn get_call_records_by_user_includes_channel_member_not_in_call(Ok(())}+#[sqlx::test(+ fixtures(path = "../../../fixtures", scripts("call_repo")),+ migrator = "MACRO_DB_MIGRATIONS"+)]+async fn get_call_records_by_user_attended_true_returns_only_joined(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = repo(pool);+ let filter = attended_filter(true);++ // user-a is a participant in both CALL1 and CALL_ARCHIVED.+ let user_a_records = repo+ .get_call_records_by_user(USER_A.deref().copied(), 10, &filter)+ .await?;+ assert_eq!(user_a_records.len(), 2);+ assert!(user_a_records.iter().any(|r| r.call_id == CALL1));+ assert!(user_a_records.iter().any(|r| r.call_id == CALL_ARCHIVED));++ // user-c is a channel member but did not join any call.+ let user_c_records = repo+ .get_call_records_by_user(USER_C.deref().copied(), 10, &filter)+ .await?;+ assert!(+ user_c_records.is_empty(),+ "user-c attended none of the calls"+ );+ Ok(())+}++#[sqlx::test(+ fixtures(path = "../../../fixtures", scripts("call_repo")),+ migrator = "MACRO_DB_MIGRATIONS"+)]+async fn get_call_records_by_user_attended_false_returns_only_not_joined(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = repo(pool);+ let filter = attended_filter(false);++ // user-a joined every call, so attended=false should return nothing.+ let user_a_records = repo+ .get_call_records_by_user(USER_A.deref().copied(), 10, &filter)+ .await?;+ assert!(+ user_a_records.is_empty(),+ "user-a attended every fixture call"+ );++ // user-c joined none of the calls, so both should appear.+ let user_c_records = repo+ .get_call_records_by_user(USER_C.deref().copied(), 10, &filter)+ .await?;+ assert_eq!(user_c_records.len(), 2);+ assert!(user_c_records.iter().any(|r| r.call_id == CALL1));+ assert!(user_c_records.iter().any(|r| r.call_id == CALL_ARCHIVED));+ Ok(())+}++#[sqlx::test(+ fixtures(path = "../../../fixtures", scripts("call_repo")),+ migrator = "MACRO_DB_MIGRATIONS"+)]+async fn get_call_records_by_user_attended_none_returns_all(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = repo(pool);++ // Sanity-check the default path: without the attended filter, the query+ // still returns every call the channel member can see.+ let records = repo+ .get_call_records_by_user(USER_A.deref().copied(), 10, &None)+ .await?;+ assert_eq!(records.len(), 2);+ Ok(())+}+// -- delete_call_record -------------------------------------------------------#[sqlx::test(diff --git a/rust/cloud-storage/item_filters/src/ast/call.rs b/rust/cloud-storage/item_filters/src/ast/call.rsindex 098bfe2685..e0ec9fa3ae 100644--- a/rust/cloud-storage/item_filters/src/ast/call.rs+++ b/rust/cloud-storage/item_filters/src/ast/call.rs@@ -9,19 +9,26 @@ use crate::{CallFilters, ast::ExpandErr};pub enum CallLiteral {/// filter by the channel a call belongs toChannelId(Uuid),+ /// whether the requesting user attended the call+ Attended(bool),}impl ExpandFrame<CallLiteral> for CallFilters {type Err = ExpandErr;fn expand_ast(filter_request: CallFilters) -> Result<Option<Expr<CallLiteral>>, Self::Err> {- let CallFilters { channel_ids } = filter_request;+ let CallFilters {+ channel_ids,+ attended,+ } = filter_request;let channel_ids = channel_ids.iter().map(|s| Uuid::parse_str(s)).try_expand(|r| r.map(CallLiteral::ChannelId), Expr::or)?;- Ok([channel_ids].into_iter().fold_with(Expr::and))+ let attended = attended.map(|b| Expr::Literal(CallLiteral::Attended(b)));++ Ok([channel_ids, attended].into_iter().fold_with(Expr::and))}}diff --git a/rust/cloud-storage/item_filters/src/ast/tests.rs b/rust/cloud-storage/item_filters/src/ast/tests.rsindex a9a66e6f22..f6fdbfdfad 100644--- a/rust/cloud-storage/item_filters/src/ast/tests.rs+++ b/rust/cloud-storage/item_filters/src/ast/tests.rs@@ -1,7 +1,7 @@use std::str::FromStr;use super::*;-use crate::PropertyFilter;+use crate::{CallFilters, PropertyFilter};use cool_asserts::assert_matches;use model_file_type::FileType;use serde_json::json;@@ -798,3 +798,54 @@ fn entity_type_ast_deserialization_rejects_invalid() {"direct AST deserialization should reject invalid entity type");}++#[test]+fn it_expands_call_filter_with_attended_only() {+ let f = CallFilters {+ channel_ids: vec![],+ attended: Some(true),+ };+ let ast = CallFilters::expand_ast(f)+ .unwrap()+ .expect("attended filter should expand to a literal");+ let json = serde_json::to_value(&ast).unwrap();+ let exp = json!({ "l": { "Attended": true } });+ assert_eq!(json, exp);+}++#[test]+fn it_expands_call_filter_with_attended_false() {+ let f = CallFilters {+ channel_ids: vec![],+ attended: Some(false),+ };+ let ast = CallFilters::expand_ast(f).unwrap().unwrap();+ let json = serde_json::to_value(&ast).unwrap();+ let exp = json!({ "l": { "Attended": false } });+ assert_eq!(json, exp);+}++#[test]+fn it_expands_call_filter_with_channel_and_attended_as_and() {+ let channel_id = Uuid::new_v4();+ let f = CallFilters {+ channel_ids: vec![channel_id.to_string()],+ attended: Some(true),+ };+ let ast = CallFilters::expand_ast(f).unwrap().unwrap();+ let json = serde_json::to_value(&ast).unwrap();+ let exp = json!({+ "&": [+ { "l": { "ChannelId": channel_id } },+ { "l": { "Attended": true } }+ ]+ });+ assert_eq!(json, exp);+}++#[test]+fn it_expands_call_filter_without_attended_is_none_when_empty() {+ let f = CallFilters::default();+ let ast = CallFilters::expand_ast(f).unwrap();+ assert!(ast.is_none(), "empty filter should expand to None");+}diff --git a/rust/cloud-storage/item_filters/src/lib.rs b/rust/cloud-storage/item_filters/src/lib.rsindex 6638861f52..e00210f583 100644--- a/rust/cloud-storage/item_filters/src/lib.rs+++ b/rust/cloud-storage/item_filters/src/lib.rs@@ -284,12 +284,20 @@ pub struct CallFilters {/// Channel IDs to filter calls by. Empty to include all calls.#[serde(default, skip_serializing_if = "Vec::is_empty")]pub channel_ids: Vec<String>,+ /// Filter by whether the requesting user attended the call.+ /// `None` = no filter, `Some(true)` = only calls the user joined,+ /// `Some(false)` = only calls the user did not join.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub attended: Option<bool>,}impl IsEmpty for CallFilters {fn is_empty(&self) -> bool {- let CallFilters { channel_ids } = self;- channel_ids.is_empty()+ let CallFilters {+ channel_ids,+ attended,+ } = self;+ channel_ids.is_empty() && attended.is_none()}}diff --git a/rust/cloud-storage/models_soup/src/call_record.rs b/rust/cloud-storage/models_soup/src/call_record.rsindex faca4ba30e..47e44bf2e0 100644--- a/rust/cloud-storage/models_soup/src/call_record.rs+++ b/rust/cloud-storage/models_soup/src/call_record.rs@@ -37,12 +37,19 @@ pub struct SoupCallRecord {pub channel_name: Option<String>,/// Whether the call is currently active.pub is_active: bool,+ /// Whether the requesting user attended this call (i.e. appears in the+ /// `call_participants` / `call_record_participants` table).+ pub attended: bool,/// Participants in the call.pub participants: Vec<SoupCallRecordParticipant>,}-impl From<call::domain::models::CallRecord> for SoupCallRecord {- fn from(record: call::domain::models::CallRecord) -> Self {+impl SoupCallRecord {+ /// Build a `SoupCallRecord` from a domain `CallRecord` in the context of a+ /// specific viewer: `attended` is set by checking whether `user_id` appears+ /// in `record.participants`.+ pub fn from_record_for_user(record: call::domain::models::CallRecord, user_id: &str) -> Self {+ let attended = record.participants.iter().any(|p| p.user_id == user_id);SoupCallRecord {call_id: record.call_id,channel_id: record.channel_id,@@ -52,6 +59,7 @@ impl From<call::domain::models::CallRecord> for SoupCallRecord {duration_ms: record.duration_ms,channel_name: record.channel_name,is_active: record.is_active,+ attended,participants: record.participants.into_iter()@@ -64,3 +72,6 @@ impl From<call::domain::models::CallRecord> for SoupCallRecord {}}}++#[cfg(test)]+mod test;diff --git a/rust/cloud-storage/models_soup/src/call_record/test.rs b/rust/cloud-storage/models_soup/src/call_record/test.rsnew file mode 100644index 0000000000..c135436799--- /dev/null+++ b/rust/cloud-storage/models_soup/src/call_record/test.rs@@ -0,0 +1,55 @@+use super::*;+use call::domain::models::{CallRecord, CallRecordParticipant};+use chrono::Utc;+use uuid::Uuid;++fn record_with_participants(user_ids: &[&str]) -> CallRecord {+ let now = Utc::now();+ CallRecord {+ call_id: Uuid::now_v7(),+ channel_id: Uuid::now_v7(),+ room_name: "room".to_string(),+ created_by: "macro|[email protected]".to_string(),+ started_at: now,+ ended_at: None,+ duration_ms: None,+ egress_id: None,+ recording_key: None,+ recording_url: None,+ channel_name: None,+ is_active: true,+ participants: user_ids+ .iter()+ .map(|u| CallRecordParticipant {+ user_id: u.to_string(),+ joined_at: now,+ left_at: None,+ })+ .collect(),+ transcript: Vec::new(),+ }+}++#[test]+fn from_record_for_user_sets_attended_true_when_user_is_participant() {+ let record = record_with_participants(&["macro|[email protected]", "macro|[email protected]"]);+ let soup = SoupCallRecord::from_record_for_user(record, "macro|[email protected]");+ assert!(soup.attended);+ assert_eq!(soup.participants.len(), 2);+}++#[test]+fn from_record_for_user_sets_attended_false_when_user_not_participant() {+ let record = record_with_participants(&["macro|[email protected]", "macro|[email protected]"]);+ let soup = SoupCallRecord::from_record_for_user(record, "macro|[email protected]");+ assert!(!soup.attended);+ assert_eq!(soup.participants.len(), 2);+}++#[test]+fn from_record_for_user_attended_false_when_no_participants() {+ let record = record_with_participants(&[]);+ let soup = SoupCallRecord::from_record_for_user(record, "macro|[email protected]");+ assert!(!soup.attended);+ assert!(soup.participants.is_empty());+}diff --git a/rust/cloud-storage/soup/.sqlx/query-03313f689cbc216503f0372eca83b82f58a55d5c030892b6889eb77e76dbae2e.json b/rust/cloud-storage/soup/.sqlx/query-03313f689cbc216503f0372eca83b82f58a55d5c030892b6889eb77e76dbae2e.jsonnew file mode 100644index 0000000000..d852429fbd--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-03313f689cbc216503f0372eca83b82f58a55d5c030892b6889eb77e76dbae2e.json@@ -0,0 +1,122 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n t.id,\n t.provider_id,\n t.inbox_visible,\n t.is_read,\n t.effective_ts AS \"sort_ts!\",\n t.created_at AS \"created_at!\",\n t.updated_at AS \"updated_at!\",\n t.project_id,\n t.viewed_at AS \"viewed_at?\",\n lmp.subject AS \"name?\",\n lmp.snippet AS \"snippet?\",\n lmp.is_draft,\n (\n SELECT EXISTS (\n SELECT 1\n FROM email_messages m_imp\n JOIN email_message_labels ml ON m_imp.id = ml.message_id\n JOIN email_labels l ON ml.label_id = l.id\n WHERE m_imp.thread_id = t.id\n AND l.name = 'IMPORTANT'\n AND l.link_id = t.link_id\n )\n ) AS \"is_important!\",\n c.email_address AS \"sender_email?\",\n COALESCE(lmp.from_name, c.name) AS \"sender_name?\",\n c.sfs_photo_url as \"sender_photo_url?\",\n el.macro_id AS \"owner_id!\"\n FROM (\n -- Step 1: Find the latest starred timestamp for each thread, calculate the\n -- effective sort key, then sort and limit the results.\n SELECT\n t.id,\n t.provider_id,\n t.link_id,\n t.inbox_visible,\n t.is_read,\n t.project_id,\n lspt.latest_starred_ts AS created_at,\n lspt.latest_starred_ts AS updated_at,\n uh.updated_at AS viewed_at,\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, lspt.latest_starred_ts)\n ELSE lspt.latest_starred_ts\n END AS effective_ts\n FROM (\n -- This sub-subquery efficiently finds the latest starred timestamp for every thread.\n SELECT m.thread_id, MAX(m.internal_date_ts) as latest_starred_ts\n FROM email_messages m\n WHERE m.link_id = $1 AND m.is_starred = TRUE\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml\n JOIN email_labels l ON ml.label_id = l.id\n WHERE ml.message_id = m.id AND l.name = 'TRASH' AND l.link_id = $1\n )\n GROUP BY m.thread_id\n ) lspt\n JOIN email_threads t ON lspt.thread_id = t.id\n LEFT JOIN email_user_history uh ON uh.thread_id = t.id AND uh.link_id = t.link_id\n WHERE\n (($3::timestamptz IS NULL) OR (\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, lspt.latest_starred_ts)\n ELSE lspt.latest_starred_ts\n END, t.id\n ) < ($3::timestamptz, $4::uuid))\n ORDER BY effective_ts DESC, t.updated_at DESC\n LIMIT $2\n ) AS t\n -- Step 2: For EACH of the limited threads from above, find the full details of its latest starred message.\n CROSS JOIN LATERAL (\n SELECT\n m.subject,\n m.snippet,\n m.from_contact_id,\n m.from_name,\n m.is_draft\n FROM email_messages m\n WHERE m.thread_id = t.id\n AND m.is_starred = TRUE\n AND m.is_draft = FALSE\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml\n JOIN email_labels l ON ml.label_id = l.id\n WHERE ml.message_id = m.id AND l.name = 'TRASH' AND l.link_id = t.link_id\n )\n ORDER BY m.internal_date_ts DESC\n LIMIT 1\n ) AS lmp\n -- Step 3: Join to get the sender's details.\n LEFT JOIN email_contacts c ON lmp.from_contact_id = c.id\n JOIN email_links el ON t.link_id = el.id\n ORDER BY t.effective_ts DESC, t.updated_at DESC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "inbox_visible",+ "type_info": "Bool"+ },+ {+ "ordinal": 3,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "sort_ts!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "project_id",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "viewed_at?",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "name?",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "snippet?",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 12,+ "name": "is_important!",+ "type_info": "Bool"+ },+ {+ "ordinal": 13,+ "name": "sender_email?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 14,+ "name": "sender_name?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 15,+ "name": "sender_photo_url?",+ "type_info": "Text"+ },+ {+ "ordinal": 16,+ "name": "owner_id!",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int8",+ "Timestamptz",+ "Uuid",+ "Text"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ false,+ null,+ null,+ null,+ true,+ false,+ true,+ true,+ false,+ null,+ false,+ null,+ true,+ false+ ]+ },+ "hash": "03313f689cbc216503f0372eca83b82f58a55d5c030892b6889eb77e76dbae2e"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-03a323aefdba22727c6789b28d90d7200e795a4591812dab4c4e7718c5512055.json b/rust/cloud-storage/soup/.sqlx/query-03a323aefdba22727c6789b28d90d7200e795a4591812dab4c4e7718c5512055.jsonnew file mode 100644index 0000000000..83caec4173--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-03a323aefdba22727c6789b28d90d7200e795a4591812dab4c4e7718c5512055.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH RECURSIVE project_hierarchy AS (\n SELECT p.id as project_id\n FROM email_threads t\n JOIN \"Project\" p ON t.project_id = p.id AND p.\"deletedAt\" IS NULL\n WHERE t.id = $1\n UNION ALL\n SELECT parent.id as project_id\n FROM project_hierarchy ph\n JOIN \"Project\" parent ON parent.id = (\n SELECT \"parentId\" FROM \"Project\" WHERE id = ph.project_id AND \"parentId\" IS NOT NULL AND \"deletedAt\" IS NULL\n )\n )\n SELECT DISTINCT user_id FROM \"UserItemAccess\"\n WHERE item_id IN (\n SELECT $2\n UNION\n SELECT project_id FROM project_hierarchy\n )\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Text"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "03a323aefdba22727c6789b28d90d7200e795a4591812dab4c4e7718c5512055"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-06a72bfcfbcc5f5bbed6cd093436309607f9375d2ba7b151e9dc1a8493f88e44.json b/rust/cloud-storage/soup/.sqlx/query-06a72bfcfbcc5f5bbed6cd093436309607f9375d2ba7b151e9dc1a8493f88e44.jsonnew file mode 100644index 0000000000..4c5afc274a--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-06a72bfcfbcc5f5bbed6cd093436309607f9375d2ba7b151e9dc1a8493f88e44.json@@ -0,0 +1,14 @@+{+ "db_name": "PostgreSQL",+ "query": "\n DELETE FROM notification_user_device_registration\n WHERE device_endpoint = $1\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": []+ },+ "hash": "06a72bfcfbcc5f5bbed6cd093436309607f9375d2ba7b151e9dc1a8493f88e44"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-0893292d05dc339bc516ddc4e2e27ee0f730dd38e1d82bd2a049d38cb7abb275.json b/rust/cloud-storage/soup/.sqlx/query-0893292d05dc339bc516ddc4e2e27ee0f730dd38e1d82bd2a049d38cb7abb275.jsonnew file mode 100644index 0000000000..34779cb42e--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-0893292d05dc339bc516ddc4e2e27ee0f730dd38e1d82bd2a049d38cb7abb275.json@@ -0,0 +1,58 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n d.id,\n d.name,\n d.owner,\n d.\"fileType\" as \"file_type\",\n d.\"projectId\" as \"project_id\",\n d.\"createdAt\"::timestamptz as \"created_at!\",\n d.\"updatedAt\"::timestamptz as \"updated_at!\"\n FROM\n \"Document\" d\n WHERE\n d.id = $1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "name",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "owner",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "file_type",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "project_id",+ "type_info": "Text"+ },+ {+ "ordinal": 5,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ true,+ true,+ null,+ null+ ]+ },+ "hash": "0893292d05dc339bc516ddc4e2e27ee0f730dd38e1d82bd2a049d38cb7abb275"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-0e0422c73b3bdb5c60680cec7581ac905f34c70bd295694a120e8dd7891e3853.json b/rust/cloud-storage/soup/.sqlx/query-0e0422c73b3bdb5c60680cec7581ac905f34c70bd295694a120e8dd7891e3853.jsonnew file mode 100644index 0000000000..625a77c4c3--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-0e0422c73b3bdb5c60680cec7581ac905f34c70bd295694a120e8dd7891e3853.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE email_threads\n SET project_id = $2, updated_at = NOW()\n WHERE id = $1\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Text"+ ]+ },+ "nullable": []+ },+ "hash": "0e0422c73b3bdb5c60680cec7581ac905f34c70bd295694a120e8dd7891e3853"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-137986b2287f8a7e8d9023d6f9bfee888a6e18170f84df631df81e3e84158348.json b/rust/cloud-storage/soup/.sqlx/query-137986b2287f8a7e8d9023d6f9bfee888a6e18170f84df631df81e3e84158348.jsonnew file mode 100644index 0000000000..cbf66c3866--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-137986b2287f8a7e8d9023d6f9bfee888a6e18170f84df631df81e3e84158348.json@@ -0,0 +1,34 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n u.id as user_profile_id,\n mui.first_name,\n mui.last_name\n FROM macro_user_info mui\n JOIN \"User\" u ON mui.macro_user_id = u.macro_user_id\n WHERE u.id = ANY($1)\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_profile_id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "first_name",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "last_name",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "TextArray"+ ]+ },+ "nullable": [+ false,+ true,+ true+ ]+ },+ "hash": "137986b2287f8a7e8d9023d6f9bfee888a6e18170f84df631df81e3e84158348"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-1435acbba365796ddcb6ddbef86f4ebf664cffc44082996f6b60a60373c28f75.json b/rust/cloud-storage/soup/.sqlx/query-1435acbba365796ddcb6ddbef86f4ebf664cffc44082996f6b60a60373c28f75.jsonnew file mode 100644index 0000000000..d2b084cf10--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-1435acbba365796ddcb6ddbef86f4ebf664cffc44082996f6b60a60373c28f75.json@@ -0,0 +1,17 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO entity_properties (id, entity_id, entity_type, property_definition_id, values)\n SELECT \n u.id,\n u.entity_id,\n 'TASK'::property_entity_type,\n u.property_definition_id,\n u.values\n FROM UNNEST(\n $1::UUID[],\n $2::TEXT[],\n $3::UUID[],\n $4::JSONB[]\n ) AS u(id, entity_id, property_definition_id, values)\n ON CONFLICT (entity_id, entity_type, property_definition_id)\n DO UPDATE SET \n values = EXCLUDED.values,\n updated_at = NOW()\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "UuidArray",+ "TextArray",+ "UuidArray",+ "JsonbArray"+ ]+ },+ "nullable": []+ },+ "hash": "1435acbba365796ddcb6ddbef86f4ebf664cffc44082996f6b60a60373c28f75"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-16fe6d8422135f9b01d5acb48576c9ebeea62fe8b80747ddcf9c5fdeee1a6c7e.json b/rust/cloud-storage/soup/.sqlx/query-16fe6d8422135f9b01d5acb48576c9ebeea62fe8b80747ddcf9c5fdeee1a6c7e.jsonnew file mode 100644index 0000000000..08f519fb97--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-16fe6d8422135f9b01d5acb48576c9ebeea62fe8b80747ddcf9c5fdeee1a6c7e.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO email_message_labels (message_id, label_id)\n SELECT\n unnested_message_id,\n l.id\n FROM\n UNNEST($1::uuid[]) AS t(unnested_message_id)\n CROSS JOIN\n email_labels l\n WHERE\n l.link_id = $2 AND l.provider_label_id = $3\n ON CONFLICT (message_id, label_id) DO NOTHING\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "UuidArray",+ "Uuid",+ "Text"+ ]+ },+ "nullable": []+ },+ "hash": "16fe6d8422135f9b01d5acb48576c9ebeea62fe8b80747ddcf9c5fdeee1a6c7e"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-183fbda8d590393f7f3faa763c2cb6344b42556f949b59a0f8f77a01ec8572c4.json b/rust/cloud-storage/soup/.sqlx/query-183fbda8d590393f7f3faa763c2cb6344b42556f949b59a0f8f77a01ec8572c4.jsonnew file mode 100644index 0000000000..3a8125cf5d--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-183fbda8d590393f7f3faa763c2cb6344b42556f949b59a0f8f77a01ec8572c4.json@@ -0,0 +1,64 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n ea.message_id,\n ea.id,\n ea.provider_attachment_id,\n ea.filename,\n ea.mime_type,\n ea.size_bytes,\n eas.sfs_id as \"sfs_id?\",\n ea.content_id\n FROM email_attachments ea\n LEFT JOIN email_attachments_sfs eas ON ea.id = eas.attachment_id\n WHERE ea.message_id = ANY($1)\n ORDER BY ea.message_id, ea.filename NULLS LAST\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "message_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "provider_attachment_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "filename",+ "type_info": "Varchar"+ },+ {+ "ordinal": 4,+ "name": "mime_type",+ "type_info": "Varchar"+ },+ {+ "ordinal": 5,+ "name": "size_bytes",+ "type_info": "Int8"+ },+ {+ "ordinal": 6,+ "name": "sfs_id?",+ "type_info": "Uuid"+ },+ {+ "ordinal": 7,+ "name": "content_id",+ "type_info": "Varchar"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ true,+ true,+ true,+ false,+ true+ ]+ },+ "hash": "183fbda8d590393f7f3faa763c2cb6344b42556f949b59a0f8f77a01ec8572c4"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-1b324f7419bf6620c5eae611b237ee202fb2b3b011422dc27f351a2c3d10813c.json b/rust/cloud-storage/soup/.sqlx/query-1b324f7419bf6620c5eae611b237ee202fb2b3b011422dc27f351a2c3d10813c.jsonnew file mode 100644index 0000000000..8257f56f38--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-1b324f7419bf6620c5eae611b237ee202fb2b3b011422dc27f351a2c3d10813c.json@@ -0,0 +1,184 @@+{+ "db_name": "PostgreSQL",+ "query": "\nSELECT\n ep.id as entity_property_id,\n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id,\n ep.values as \"values: sqlx::types::JsonValue\",\n ep.created_at as entity_property_created_at,\n ep.updated_at as entity_property_updated_at,\n pd.organization_id as definition_organization_id,\n pd.user_id as definition_user_id,\n pd.display_name,\n pd.data_type as \"data_type: DataType\",\n pd.is_multi_select,\n pd.specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n pd.created_at as definition_created_at,\n pd.updated_at as definition_updated_at,\n pd.is_system as definition_is_system\nFROM entity_properties ep\nINNER JOIN property_definitions pd ON ep.property_definition_id = pd.id\nWHERE (ep.entity_id, ep.entity_type) IN (\n SELECT * FROM UNNEST($1::TEXT[], $2::property_entity_type[])\n)\n",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "entity_property_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "entity_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "entity_type: EntityType",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 3,+ "name": "property_definition_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 4,+ "name": "values: sqlx::types::JsonValue",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 5,+ "name": "entity_property_created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "entity_property_updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "definition_organization_id",+ "type_info": "Int4"+ },+ {+ "ordinal": 8,+ "name": "definition_user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 9,+ "name": "display_name",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "data_type: DataType",+ "type_info": {+ "Custom": {+ "name": "property_data_type",+ "kind": {+ "Enum": [+ "BOOLEAN",+ "DATE",+ "NUMBER",+ "STRING",+ "SELECT_NUMBER",+ "SELECT_STRING",+ "ENTITY",+ "LINK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 11,+ "name": "is_multi_select",+ "type_info": "Bool"+ },+ {+ "ordinal": 12,+ "name": "specific_entity_type: Option<EntityType>",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 13,+ "name": "definition_created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 14,+ "name": "definition_updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 15,+ "name": "definition_is_system",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "TextArray",+ {+ "Custom": {+ "name": "property_entity_type[]",+ "kind": {+ "Array": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ }+ }+ }+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ true,+ false,+ false,+ true,+ true,+ false,+ false,+ false,+ true,+ false,+ false,+ false+ ]+ },+ "hash": "1b324f7419bf6620c5eae611b237ee202fb2b3b011422dc27f351a2c3d10813c"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-21ac8784f90a5e311b658fe88195bdf9c83dfc84f0b5a8e8075a7153d7f41818.json b/rust/cloud-storage/soup/.sqlx/query-21ac8784f90a5e311b658fe88195bdf9c83dfc84f0b5a8e8075a7153d7f41818.jsonnew file mode 100644index 0000000000..cf7c2c61a1--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-21ac8784f90a5e311b658fe88195bdf9c83dfc84f0b5a8e8075a7153d7f41818.json@@ -0,0 +1,95 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n id,\n link_id,\n provider_label_id,\n name,\n created_at,\n message_list_visibility as \"message_list_visibility: _\",\n label_list_visibility as \"label_list_visibility: _\",\n type as \"type_: _\"\n FROM email_labels\n WHERE link_id = $1\n ORDER BY name\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "provider_label_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "name",+ "type_info": "Varchar"+ },+ {+ "ordinal": 4,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "message_list_visibility: _",+ "type_info": {+ "Custom": {+ "name": "email_message_list_visibility_enum",+ "kind": {+ "Enum": [+ "Show",+ "Hide"+ ]+ }+ }+ }+ },+ {+ "ordinal": 6,+ "name": "label_list_visibility: _",+ "type_info": {+ "Custom": {+ "name": "email_label_list_visibility_enum",+ "kind": {+ "Enum": [+ "LabelShow",+ "LabelShowIfUnread",+ "LabelHide"+ ]+ }+ }+ }+ },+ {+ "ordinal": 7,+ "name": "type_: _",+ "type_info": {+ "Custom": {+ "name": "email_label_type_enum",+ "kind": {+ "Enum": [+ "System",+ "User"+ ]+ }+ }+ }+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ false,+ false+ ]+ },+ "hash": "21ac8784f90a5e311b658fe88195bdf9c83dfc84f0b5a8e8075a7153d7f41818"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-270cd8ae6b47508cb7e4e920bd76cb0f6177d685bddedb06f1892d0014af6f01.json b/rust/cloud-storage/soup/.sqlx/query-270cd8ae6b47508cb7e4e920bd76cb0f6177d685bddedb06f1892d0014af6f01.jsonnew file mode 100644index 0000000000..01cece9642--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-270cd8ae6b47508cb7e4e920bd76cb0f6177d685bddedb06f1892d0014af6f01.json@@ -0,0 +1,33 @@+{+ "db_name": "PostgreSQL",+ "query": "\n DELETE FROM notification_user_device_registration\n WHERE device_token = $1 AND device_type = $2\n RETURNING device_endpoint\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "device_endpoint",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ {+ "Custom": {+ "name": "notification_device_type_option",+ "kind": {+ "Enum": [+ "ios",+ "android"+ ]+ }+ }+ }+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "270cd8ae6b47508cb7e4e920bd76cb0f6177d685bddedb06f1892d0014af6f01"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-29496c090bdffe2b771ad704687525136fcd17a1d3e680142e5d0f9e253af578.json b/rust/cloud-storage/soup/.sqlx/query-29496c090bdffe2b771ad704687525136fcd17a1d3e680142e5d0f9e253af578.jsonnew file mode 100644index 0000000000..918f0d6d3d--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-29496c090bdffe2b771ad704687525136fcd17a1d3e680142e5d0f9e253af578.json@@ -0,0 +1,28 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT message_id, send_time\n FROM email_scheduled_messages\n WHERE message_id = ANY($1) AND sent = false\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "message_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "send_time",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false+ ]+ },+ "hash": "29496c090bdffe2b771ad704687525136fcd17a1d3e680142e5d0f9e253af578"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-2c1ca56683bc4ff97f5b9768e6da72ee6558c2ea8bb9b58237370e3cb80d309c.json b/rust/cloud-storage/soup/.sqlx/query-2c1ca56683bc4ff97f5b9768e6da72ee6558c2ea8bb9b58237370e3cb80d309c.jsonnew file mode 100644index 0000000000..54b0e1cd14--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-2c1ca56683bc4ff97f5b9768e6da72ee6558c2ea8bb9b58237370e3cb80d309c.json@@ -0,0 +1,70 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n a.id,\n a.message_id,\n a.provider_attachment_id,\n a.filename,\n a.mime_type,\n a.size_bytes,\n a.content_id,\n a.created_at,\n m.thread_id\n FROM\n email_attachments a\n JOIN\n email_messages m ON a.message_id = m.id\n WHERE\n m.thread_id = ANY($1)\n ORDER BY\n a.created_at ASC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "message_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "provider_attachment_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "filename",+ "type_info": "Varchar"+ },+ {+ "ordinal": 4,+ "name": "mime_type",+ "type_info": "Varchar"+ },+ {+ "ordinal": 5,+ "name": "size_bytes",+ "type_info": "Int8"+ },+ {+ "ordinal": 6,+ "name": "content_id",+ "type_info": "Varchar"+ },+ {+ "ordinal": 7,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,+ "name": "thread_id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ true,+ true,+ true,+ true,+ false,+ false+ ]+ },+ "hash": "2c1ca56683bc4ff97f5b9768e6da72ee6558c2ea8bb9b58237370e3cb80d309c"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-2e5e76597cf6fe734978fef0762c7c86aeba3b076e8684a85696045ed3a4636e.json b/rust/cloud-storage/soup/.sqlx/query-2e5e76597cf6fe734978fef0762c7c86aeba3b076e8684a85696045ed3a4636e.jsonnew file mode 100644index 0000000000..7c3172354d--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-2e5e76597cf6fe734978fef0762c7c86aeba3b076e8684a85696045ed3a4636e.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n DELETE FROM email_scheduled_messages\n WHERE link_id = $1 AND message_id = $2\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "2e5e76597cf6fe734978fef0762c7c86aeba3b076e8684a85696045ed3a4636e"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-317f05707fdc73269f3017a3bb96d55b7327338bf5e52dfaad106b4b492cbb8e.json b/rust/cloud-storage/soup/.sqlx/query-317f05707fdc73269f3017a3bb96d55b7327338bf5e52dfaad106b4b492cbb8e.jsonnew file mode 100644index 0000000000..b17b203167--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-317f05707fdc73269f3017a3bb96d55b7327338bf5e52dfaad106b4b492cbb8e.json@@ -0,0 +1,98 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n un.user_id as owner_id,\n un.notification_id,\n n.event_item_id,\n n.event_item_type,\n un.sent,\n un.done,\n un.created_at::timestamptz as \"created_at!\",\n un.seen_at::timestamptz as viewed_at,\n un.created_at::timestamptz as \"updated_at!\",\n un.deleted_at::timestamptz,\n n.metadata as \"notification_metadata: serde_json::Value\",\n n.notification_event_type as notification_event_type,\n n.sender_id as sender_id\n FROM user_notification un\n JOIN notification n ON n.id = un.notification_id\n WHERE un.user_id = $1\n AND n.event_item_id = ANY($2)\n AND un.deleted_at IS NULL\n AND un.done = false\n AND (($4::timestamptz IS NULL)\n OR (un.created_at, un.notification_id) < ($4, $5))\n ORDER BY un.created_at DESC, un.notification_id DESC\n LIMIT $3\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "owner_id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "notification_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "event_item_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "event_item_type",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 5,+ "name": "done",+ "type_info": "Bool"+ },+ {+ "ordinal": 6,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "viewed_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "deleted_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 10,+ "name": "notification_metadata: serde_json::Value",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 11,+ "name": "notification_event_type",+ "type_info": "Varchar"+ },+ {+ "ordinal": 12,+ "name": "sender_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "TextArray",+ "Int8",+ "Timestamptz",+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ null,+ null,+ null,+ null,+ false,+ false,+ true+ ]+ },+ "hash": "317f05707fdc73269f3017a3bb96d55b7327338bf5e52dfaad106b4b492cbb8e"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-3293eab63193f1b3822a59e9a6a9621520f26e6ec8248abed103985281ef7ff1.json b/rust/cloud-storage/soup/.sqlx/query-3293eab63193f1b3822a59e9a6a9621520f26e6ec8248abed103985281ef7ff1.jsonnew file mode 100644index 0000000000..e4a18ac5f0--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-3293eab63193f1b3822a59e9a6a9621520f26e6ec8248abed103985281ef7ff1.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE user_notification\n SET done = $3\n WHERE user_id = $1 AND notification_id = ANY($2)\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "UuidArray",+ "Bool"+ ]+ },+ "nullable": []+ },+ "hash": "3293eab63193f1b3822a59e9a6a9621520f26e6ec8248abed103985281ef7ff1"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-3357165799ff1f7bf1de3891174668e0ab16c64bd9dfc905213681e6021474fa.json b/rust/cloud-storage/soup/.sqlx/query-3357165799ff1f7bf1de3891174668e0ab16c64bd9dfc905213681e6021474fa.jsonnew file mode 100644index 0000000000..6696253445--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-3357165799ff1f7bf1de3891174668e0ab16c64bd9dfc905213681e6021474fa.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT EXISTS(\n SELECT 1 FROM notification_message_receipt\n WHERE user_id = $1\n AND notification_id = $2\n AND failed = false\n ) as \"exists!\"\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "exists!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "Uuid"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "3357165799ff1f7bf1de3891174668e0ab16c64bd9dfc905213681e6021474fa"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-359a16ea19cd02675cf7f6ffb815f76ad39c5aca7b6503ae8e43ebd1cc5d733f.json b/rust/cloud-storage/soup/.sqlx/query-359a16ea19cd02675cf7f6ffb815f76ad39c5aca7b6503ae8e43ebd1cc5d733f.jsonnew file mode 100644index 0000000000..f99ce906c2--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-359a16ea19cd02675cf7f6ffb815f76ad39c5aca7b6503ae8e43ebd1cc5d733f.json@@ -0,0 +1,31 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO email_contacts (id, link_id, email_address, name)\n SELECT * FROM unnest($1::uuid[], $2::uuid[], $3::text[], $4::text[])\n ON CONFLICT (link_id, email_address) DO NOTHING\n RETURNING id, email_address\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "email_address",+ "type_info": "Varchar"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray",+ "UuidArray",+ "TextArray",+ "TextArray"+ ]+ },+ "nullable": [+ false,+ false+ ]+ },+ "hash": "359a16ea19cd02675cf7f6ffb815f76ad39c5aca7b6503ae8e43ebd1cc5d733f"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-35aa1ada3371fd09902d19b1218c2034a348d30889a11f28b98a9e4a0daf4525.json b/rust/cloud-storage/soup/.sqlx/query-35aa1ada3371fd09902d19b1218c2034a348d30889a11f28b98a9e4a0daf4525.jsonnew file mode 100644index 0000000000..0bc29e54eb--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-35aa1ada3371fd09902d19b1218c2034a348d30889a11f28b98a9e4a0daf4525.json@@ -0,0 +1,177 @@+{+ "db_name": "PostgreSQL",+ "query": "\nSELECT\n ep.id as entity_property_id,\n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id,\n ep.values as \"values: sqlx::types::JsonValue\",\n ep.created_at as entity_property_created_at,\n ep.updated_at as entity_property_updated_at,\n pd.organization_id as definition_organization_id,\n pd.user_id as definition_user_id,\n pd.display_name,\n pd.data_type as \"data_type: DataType\",\n pd.is_multi_select,\n pd.specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n pd.created_at as definition_created_at,\n pd.updated_at as definition_updated_at,\n pd.is_system as definition_is_system\nFROM entity_properties ep\nINNER JOIN property_definitions pd ON ep.property_definition_id = pd.id\nWHERE ep.entity_id = $1 AND ep.entity_type = $2\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "entity_property_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "entity_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "entity_type: EntityType",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 3,+ "name": "property_definition_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 4,+ "name": "values: sqlx::types::JsonValue",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 5,+ "name": "entity_property_created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "entity_property_updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "definition_organization_id",+ "type_info": "Int4"+ },+ {+ "ordinal": 8,+ "name": "definition_user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 9,+ "name": "display_name",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "data_type: DataType",+ "type_info": {+ "Custom": {+ "name": "property_data_type",+ "kind": {+ "Enum": [+ "BOOLEAN",+ "DATE",+ "NUMBER",+ "STRING",+ "SELECT_NUMBER",+ "SELECT_STRING",+ "ENTITY",+ "LINK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 11,+ "name": "is_multi_select",+ "type_info": "Bool"+ },+ {+ "ordinal": 12,+ "name": "specific_entity_type: Option<EntityType>",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 13,+ "name": "definition_created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 14,+ "name": "definition_updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 15,+ "name": "definition_is_system",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ true,+ false,+ false,+ true,+ true,+ false,+ false,+ false,+ true,+ false,+ false,+ false+ ]+ },+ "hash": "35aa1ada3371fd09902d19b1218c2034a348d30889a11f28b98a9e4a0daf4525"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-36dfcf982834f117d97d1ba332be6784c946f05120c7c228ff258389ceba97a1.json b/rust/cloud-storage/soup/.sqlx/query-36dfcf982834f117d97d1ba332be6784c946f05120c7c228ff258389ceba97a1.jsonnew file mode 100644index 0000000000..c07ec0acbe--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-36dfcf982834f117d97d1ba332be6784c946f05120c7c228ff258389ceba97a1.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO user_notification_type_preference (user_id, notification_event_type)\n VALUES ($1, $2)\n ON CONFLICT (user_id, notification_event_type) DO NOTHING\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Varchar"+ ]+ },+ "nullable": []+ },+ "hash": "36dfcf982834f117d97d1ba332be6784c946f05120c7c228ff258389ceba97a1"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-37b5168f739c490a3373c65eab35f247a34af0a8e659cbad61cb99e3094e5a60.json b/rust/cloud-storage/soup/.sqlx/query-37b5168f739c490a3373c65eab35f247a34af0a8e659cbad61cb99e3094e5a60.jsonnew file mode 100644index 0000000000..44d3a67e72--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-37b5168f739c490a3373c65eab35f247a34af0a8e659cbad61cb99e3094e5a60.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT EXISTS (\n SELECT 1\n FROM public.email_threads t\n JOIN public.email_links l ON l.id = t.link_id\n WHERE t.id = $1::uuid\n AND l.macro_id = $2\n ) AS \"exists!\"\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "exists!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Text"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "37b5168f739c490a3373c65eab35f247a34af0a8e659cbad61cb99e3094e5a60"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-37c7a9fd9f1156ce7de8a691fab1d33b9b50bd1e3525338b49991091df258321.json b/rust/cloud-storage/soup/.sqlx/query-37c7a9fd9f1156ce7de8a691fab1d33b9b50bd1e3525338b49991091df258321.jsonnew file mode 100644index 0000000000..cf6201e995--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-37c7a9fd9f1156ce7de8a691fab1d33b9b50bd1e3525338b49991091df258321.json@@ -0,0 +1,53 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n m.id,\n m.thread_id,\n m.provider_thread_id,\n m.headers_jsonb,\n m.is_sent,\n m.is_draft\n FROM email_messages m\n WHERE m.id = $1 AND m.link_id = $2\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "provider_thread_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "headers_jsonb",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 4,+ "name": "is_sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 5,+ "name": "is_draft",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ true,+ false,+ false+ ]+ },+ "hash": "37c7a9fd9f1156ce7de8a691fab1d33b9b50bd1e3525338b49991091df258321"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-3a7be99469ed150e0506efa786b672198a6d3419c6bd5548418520cd3e6a8e95.json b/rust/cloud-storage/soup/.sqlx/query-3a7be99469ed150e0506efa786b672198a6d3419c6bd5548418520cd3e6a8e95.jsonnew file mode 100644index 0000000000..60bfee0647--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-3a7be99469ed150e0506efa786b672198a6d3419c6bd5548418520cd3e6a8e95.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH RECURSIVE project_hierarchy AS (\n SELECT p.id as project_id\n FROM \"Document\" d\n JOIN \"Project\" p ON d.\"projectId\" = p.id AND p.\"deletedAt\" IS NULL\n WHERE d.id = $1 AND d.\"deletedAt\" IS NULL\n UNION ALL\n SELECT parent.id as project_id\n FROM project_hierarchy ph\n JOIN \"Project\" parent ON parent.id = (\n SELECT \"parentId\" FROM \"Project\" WHERE id = ph.project_id AND \"parentId\" IS NOT NULL AND \"deletedAt\" IS NULL\n )\n )\n SELECT access_level FROM (\n -- Source 1: Cast the AccessLevel enum to text.\n SELECT access_level::text FROM \"UserItemAccess\"\n WHERE user_id = $2 AND item_id IN (\n SELECT $1\n UNION\n SELECT project_id FROM project_hierarchy\n )\n UNION ALL\n -- Source 2: Select the publicAccessLevel (which is already text).\n SELECT \"publicAccessLevel\" as access_level\n FROM \"SharePermission\"\n WHERE \"isPublic\" = true AND \"publicAccessLevel\" IS NOT NULL AND id IN (\n SELECT \"sharePermissionId\" FROM \"DocumentPermission\" WHERE \"documentId\" = $1\n UNION\n SELECT \"sharePermissionId\" FROM \"ProjectPermission\" WHERE \"projectId\" IN (SELECT project_id FROM project_hierarchy)\n )\n ) as all_levels\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "access_level",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "Text"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "3a7be99469ed150e0506efa786b672198a6d3419c6bd5548418520cd3e6a8e95"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-3b147b8bcb7d08a87729fc68c562ea545e65d41bd61891ed3aad8eda3c4d90dd.json b/rust/cloud-storage/soup/.sqlx/query-3b147b8bcb7d08a87729fc68c562ea545e65d41bd61891ed3aad8eda3c4d90dd.jsonnew file mode 100644index 0000000000..3de2090f48--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-3b147b8bcb7d08a87729fc68c562ea545e65d41bd61891ed3aad8eda3c4d90dd.json@@ -0,0 +1,33 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO email_messages (\n id, provider_id, link_id, thread_id, provider_thread_id,\n replying_to_id, subject, from_contact_id, sent_at,\n has_attachments, is_read, is_starred, is_sent, is_draft,\n body_text, body_html_sanitized, body_macro, headers_jsonb,\n created_at, updated_at\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)\n ON CONFLICT (id) DO UPDATE SET\n provider_id = EXCLUDED.provider_id,\n thread_id = EXCLUDED.thread_id,\n provider_thread_id = EXCLUDED.provider_thread_id,\n replying_to_id = EXCLUDED.replying_to_id,\n subject = EXCLUDED.subject,\n from_contact_id = EXCLUDED.from_contact_id,\n sent_at = EXCLUDED.sent_at,\n has_attachments = EXCLUDED.has_attachments,\n is_read = EXCLUDED.is_read,\n is_starred = EXCLUDED.is_starred,\n is_sent = EXCLUDED.is_sent,\n is_draft = EXCLUDED.is_draft,\n body_text = EXCLUDED.body_text,\n body_html_sanitized = EXCLUDED.body_html_sanitized,\n body_macro = EXCLUDED.body_macro,\n headers_jsonb = EXCLUDED.headers_jsonb,\n updated_at = NOW()\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Text",+ "Uuid",+ "Uuid",+ "Text",+ "Uuid",+ "Text",+ "Uuid",+ "Timestamptz",+ "Bool",+ "Bool",+ "Bool",+ "Bool",+ "Bool",+ "Text",+ "Text",+ "Text",+ "Jsonb",+ "Timestamptz",+ "Timestamptz"+ ]+ },+ "nullable": []+ },+ "hash": "3b147b8bcb7d08a87729fc68c562ea545e65d41bd61891ed3aad8eda3c4d90dd"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-3b570b222c479d824a07d83d5af9bb51833195bf60052e04a1c754df22f57220.json b/rust/cloud-storage/soup/.sqlx/query-3b570b222c479d824a07d83d5af9bb51833195bf60052e04a1c754df22f57220.jsonnew file mode 100644index 0000000000..15557826d9--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-3b570b222c479d824a07d83d5af9bb51833195bf60052e04a1c754df22f57220.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n DELETE FROM email_scheduled_messages\n WHERE message_id = ANY($1) AND link_id = $2 AND sent = false\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "UuidArray",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "3b570b222c479d824a07d83d5af9bb51833195bf60052e04a1c754df22f57220"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-3e259ea5cbdcfae4334cb0125de6423fa95a0c127fbeba0a59d7096b0177c072.json b/rust/cloud-storage/soup/.sqlx/query-3e259ea5cbdcfae4334cb0125de6423fa95a0c127fbeba0a59d7096b0177c072.jsonnew file mode 100644index 0000000000..8ee9d7919b--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-3e259ea5cbdcfae4334cb0125de6423fa95a0c127fbeba0a59d7096b0177c072.json@@ -0,0 +1,52 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n p.id,\n p.name,\n p.\"userId\" as \"owner\",\n p.\"parentId\" as \"parent_id\",\n p.\"createdAt\"::timestamptz as \"created_at!\",\n p.\"updatedAt\"::timestamptz as \"updated_at!\"\n FROM\n \"Project\" p\n WHERE\n p.id = $1 AND p.\"deletedAt\" IS NULL\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "name",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "owner",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "parent_id",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ true,+ null,+ null+ ]+ },+ "hash": "3e259ea5cbdcfae4334cb0125de6423fa95a0c127fbeba0a59d7096b0177c072"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-3f3b5a5d8734e3748d4e29d64cfa89baff99dae621e7cbd7a10017beec9485c8.json b/rust/cloud-storage/soup/.sqlx/query-3f3b5a5d8734e3748d4e29d64cfa89baff99dae621e7cbd7a10017beec9485c8.jsonnew file mode 100644index 0000000000..5c152ecd5e--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-3f3b5a5d8734e3748d4e29d64cfa89baff99dae621e7cbd7a10017beec9485c8.json@@ -0,0 +1,50 @@+{+ "db_name": "PostgreSQL",+ "query": "\nSELECT\n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id\nFROM entity_properties ep\nWHERE ep.id = $1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "entity_id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "entity_type: EntityType",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 2,+ "name": "property_definition_id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ false+ ]+ },+ "hash": "3f3b5a5d8734e3748d4e29d64cfa89baff99dae621e7cbd7a10017beec9485c8"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-41682a8f6e1e2fb8836f76ca3ceab5fe676b45c9942ec0c99486c03e52733a47.json b/rust/cloud-storage/soup/.sqlx/query-41682a8f6e1e2fb8836f76ca3ceab5fe676b45c9942ec0c99486c03e52733a47.jsonnew file mode 100644index 0000000000..7eab7370d7--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-41682a8f6e1e2fb8836f76ca3ceab5fe676b45c9942ec0c99486c03e52733a47.json@@ -0,0 +1,38 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO property_options (\n id,\n property_definition_id,\n display_order,\n number_value,\n string_value\n )\n VALUES ($1, $2, $3, $4, $5)\n RETURNING id, created_at, updated_at\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 2,+ "name": "updated_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Int4",+ "Float8",+ "Text"+ ]+ },+ "nullable": [+ false,+ false,+ false+ ]+ },+ "hash": "41682a8f6e1e2fb8836f76ca3ceab5fe676b45c9942ec0c99486c03e52733a47"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-44682e65711eb45a1dbec725646b7b0e02ced66e66f2d985f3da2d3eb7ad8c60.json b/rust/cloud-storage/soup/.sqlx/query-44682e65711eb45a1dbec725646b7b0e02ced66e66f2d985f3da2d3eb7ad8c60.jsonnew file mode 100644index 0000000000..2bb459c23a--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-44682e65711eb45a1dbec725646b7b0e02ced66e66f2d985f3da2d3eb7ad8c60.json@@ -0,0 +1,28 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT ml.message_id, el.provider_label_id\n FROM email_message_labels ml\n JOIN email_labels el ON el.id = ml.label_id\n WHERE ml.message_id = ANY($1)\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "message_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_label_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false+ ]+ },+ "hash": "44682e65711eb45a1dbec725646b7b0e02ced66e66f2d985f3da2d3eb7ad8c60"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-45064c055927af781bc06e3a602a9efbefbd111110b9f0fab5cf029e70208c1e.json b/rust/cloud-storage/soup/.sqlx/query-45064c055927af781bc06e3a602a9efbefbd111110b9f0fab5cf029e70208c1e.jsonnew file mode 100644index 0000000000..ddaefc32ef--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-45064c055927af781bc06e3a602a9efbefbd111110b9f0fab5cf029e70208c1e.json@@ -0,0 +1,83 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH user_channels AS (\n SELECT DISTINCT c.*\n FROM comms_channels c\n INNER JOIN comms_channel_participants cp ON cp.channel_id = c.id\n WHERE cp.user_id = $1 AND cp.left_at IS NULL\n ),\n channel_participants_json AS (\n SELECT \n uc.id as channel_id,\n ARRAY_AGG(\n json_build_object(\n 'channel_id', cp.channel_id,\n 'user_id', cp.user_id,\n 'role', cp.role,\n 'joined_at', cp.joined_at,\n 'left_at', cp.left_at\n )\n ) as participants\n FROM user_channels uc\n JOIN comms_channel_participants cp ON cp.channel_id = uc.id\n WHERE cp.left_at IS NULL\n GROUP BY uc.id\n )\n SELECT \n uc.id as \"id!\",\n uc.name as \"name\",\n uc.channel_type as \"channel_type!: ChannelType\",\n uc.team_id,\n uc.org_id,\n uc.created_at as \"created_at!\",\n uc.updated_at as \"updated_at!\",\n uc.owner_id as \"owner_id!\",\n cpj.participants as \"participants_json?\"\n FROM user_channels uc\n LEFT JOIN channel_participants_json cpj ON cpj.channel_id = uc.id\n ORDER BY uc.created_at DESC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id!",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "name",+ "type_info": "Varchar"+ },+ {+ "ordinal": 2,+ "name": "channel_type!: ChannelType",+ "type_info": {+ "Custom": {+ "name": "comms_channel_type",+ "kind": {+ "Enum": [+ "public",+ "organization",+ "private",+ "direct_message",+ "team"+ ]+ }+ }+ }+ },+ {+ "ordinal": 3,+ "name": "team_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 4,+ "name": "org_id",+ "type_info": "Int8"+ },+ {+ "ordinal": 5,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "owner_id!",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "participants_json?",+ "type_info": "JsonArray"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ true,+ true,+ false,+ false,+ false,+ null+ ]+ },+ "hash": "45064c055927af781bc06e3a602a9efbefbd111110b9f0fab5cf029e70208c1e"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-45a55e0ea2f0cc2d7583ede119ffd4059933d25cca50775c74f1ef5a0224493c.json b/rust/cloud-storage/soup/.sqlx/query-45a55e0ea2f0cc2d7583ede119ffd4059933d25cca50775c74f1ef5a0224493c.jsonnew file mode 100644index 0000000000..58bc367329--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-45a55e0ea2f0cc2d7583ede119ffd4059933d25cca50775c74f1ef5a0224493c.json@@ -0,0 +1,52 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n m.thread_id,\n c.id, c.link_id, c.email_address, COALESCE(m.from_name, c.name) as \"name\", c.sfs_photo_url\n FROM email_messages m\n JOIN email_contacts c ON m.from_contact_id = c.id\n WHERE m.thread_id = ANY($1) AND m.from_contact_id IS NOT NULL\n ORDER BY m.created_at ASC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 3,+ "name": "email_address",+ "type_info": "Varchar"+ },+ {+ "ordinal": 4,+ "name": "name",+ "type_info": "Varchar"+ },+ {+ "ordinal": 5,+ "name": "sfs_photo_url",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ null,+ true+ ]+ },+ "hash": "45a55e0ea2f0cc2d7583ede119ffd4059933d25cca50775c74f1ef5a0224493c"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-48697f17a7121986cc770d6698fbca7bf107ae20dbadbf64a7799ab162b2feb4.json b/rust/cloud-storage/soup/.sqlx/query-48697f17a7121986cc770d6698fbca7bf107ae20dbadbf64a7799ab162b2feb4.jsonnew file mode 100644index 0000000000..3fdea7e232--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-48697f17a7121986cc770d6698fbca7bf107ae20dbadbf64a7799ab162b2feb4.json@@ -0,0 +1,95 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n un.user_id as owner_id,\n un.notification_id,\n n.event_item_id,\n n.event_item_type,\n un.sent,\n un.done,\n un.created_at::timestamptz as \"created_at!\",\n un.seen_at::timestamptz as viewed_at,\n un.created_at::timestamptz as \"updated_at!\",\n un.deleted_at::timestamptz,\n n.metadata as \"notification_metadata: serde_json::Value\",\n n.notification_event_type as notification_event_type,\n n.sender_id as sender_id\n FROM user_notification un\n JOIN notification n ON n.id = un.notification_id\n WHERE un.user_id = $1\n AND un.notification_id = $2\n AND un.deleted_at IS NULL\n LIMIT 1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "owner_id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "notification_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "event_item_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "event_item_type",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 5,+ "name": "done",+ "type_info": "Bool"+ },+ {+ "ordinal": 6,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "viewed_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "deleted_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 10,+ "name": "notification_metadata: serde_json::Value",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 11,+ "name": "notification_event_type",+ "type_info": "Varchar"+ },+ {+ "ordinal": 12,+ "name": "sender_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ null,+ null,+ null,+ null,+ false,+ false,+ true+ ]+ },+ "hash": "48697f17a7121986cc770d6698fbca7bf107ae20dbadbf64a7799ab162b2feb4"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-48df79c41ba4ec7fa2454ac962aee9ff97875c9e2335b46fe13b2bbdee721186.json b/rust/cloud-storage/soup/.sqlx/query-48df79c41ba4ec7fa2454ac962aee9ff97875c9e2335b46fe13b2bbdee721186.jsonnew file mode 100644index 0000000000..b38dcf84f8--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-48df79c41ba4ec7fa2454ac962aee9ff97875c9e2335b46fe13b2bbdee721186.json@@ -0,0 +1,52 @@+{+ "db_name": "PostgreSQL",+ "query": "SELECT id, link_id, email_address, email_domain, is_important, created_at\n FROM email_filters\n WHERE link_id = $1\n ORDER BY created_at DESC",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "email_address",+ "type_info": "Varchar"+ },+ {+ "ordinal": 3,+ "name": "email_domain",+ "type_info": "Varchar"+ },+ {+ "ordinal": 4,+ "name": "is_important",+ "type_info": "Bool"+ },+ {+ "ordinal": 5,+ "name": "created_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ true,+ false,+ false+ ]+ },+ "hash": "48df79c41ba4ec7fa2454ac962aee9ff97875c9e2335b46fe13b2bbdee721186"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-4afa79ca95bdbcebe9d3de7ebb204636419e6cf89e650a8716c40ab2e588aa5b.json b/rust/cloud-storage/soup/.sqlx/query-4afa79ca95bdbcebe9d3de7ebb204636419e6cf89e650a8716c40ab2e588aa5b.jsonnew file mode 100644index 0000000000..58618b2697--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-4afa79ca95bdbcebe9d3de7ebb204636419e6cf89e650a8716c40ab2e588aa5b.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "\n -- CTE to recursively find all parent projects, starting from the given project.\n WITH RECURSIVE project_hierarchy AS (\n -- Base case: Start with the project ID provided.\n SELECT id as project_id\n FROM \"Project\"\n WHERE id = $1 AND \"deletedAt\" IS NULL\n UNION ALL\n -- Recursive case: Find the parent of the project from the previous step.\n SELECT parent.id as project_id\n FROM project_hierarchy ph\n JOIN \"Project\" parent ON parent.id = (\n SELECT \"parentId\" FROM \"Project\" WHERE id = ph.project_id AND \"parentId\" IS NOT NULL AND \"deletedAt\" IS NULL\n )\n )\n -- The subquery now gathers all levels as plain text.\n SELECT access_level FROM (\n -- Source 1: Cast the AccessLevel enum to text.\n SELECT access_level::text FROM \"UserItemAccess\"\n WHERE user_id = $2 AND item_id IN (\n -- The hierarchy CTE includes the starting project, so this is all we need.\n SELECT project_id FROM project_hierarchy\n )\n UNION ALL\n -- Source 2: Select the publicAccessLevel (which is already text).\n SELECT \"publicAccessLevel\" as access_level\n FROM \"SharePermission\"\n WHERE \"isPublic\" = true AND \"publicAccessLevel\" IS NOT NULL AND id IN (\n -- We only need to check ProjectPermission for the items in the hierarchy.\n SELECT \"sharePermissionId\" FROM \"ProjectPermission\"\n WHERE \"projectId\" IN (SELECT project_id FROM project_hierarchy)\n )\n ) as all_levels\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "access_level",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "Text"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "4afa79ca95bdbcebe9d3de7ebb204636419e6cf89e650a8716c40ab2e588aa5b"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-4b75a017d1bfeb600d0b75c58220b27c51a57253d0d82c55793eb5b0852d476f.json b/rust/cloud-storage/soup/.sqlx/query-4b75a017d1bfeb600d0b75c58220b27c51a57253d0d82c55793eb5b0852d476f.jsonnew file mode 100644index 0000000000..a8c8857eae--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-4b75a017d1bfeb600d0b75c58220b27c51a57253d0d82c55793eb5b0852d476f.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE email_contacts\n SET name = data.name, updated_at = now()\n FROM (SELECT unnest($1::uuid[]) as id, unnest($2::text[]) as name) as data\n WHERE email_contacts.id = data.id\n AND email_contacts.name IS NULL\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "UuidArray",+ "TextArray"+ ]+ },+ "nullable": []+ },+ "hash": "4b75a017d1bfeb600d0b75c58220b27c51a57253d0d82c55793eb5b0852d476f"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-4c695b011d49ba7d5fce4b309875ed952dc386ac760444d7883c5a76718f15be.json b/rust/cloud-storage/soup/.sqlx/query-4c695b011d49ba7d5fce4b309875ed952dc386ac760444d7883c5a76718f15be.jsonnew file mode 100644index 0000000000..524cc25ec7--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-4c695b011d49ba7d5fce4b309875ed952dc386ac760444d7883c5a76718f15be.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH RECURSIVE project_hierarchy AS (\n SELECT p.id as project_id\n FROM \"Chat\" c\n JOIN \"Project\" p ON c.\"projectId\" = p.id AND p.\"deletedAt\" IS NULL\n WHERE c.id = $1 AND c.\"deletedAt\" IS NULL\n UNION ALL\n SELECT parent.id as project_id\n FROM project_hierarchy ph\n JOIN \"Project\" parent ON parent.id = (\n SELECT \"parentId\" FROM \"Project\" WHERE id = ph.project_id AND \"parentId\" IS NOT NULL AND \"deletedAt\" IS NULL\n )\n )\n SELECT access_level FROM (\n -- Source 1: Cast the AccessLevel enum to text.\n SELECT access_level::text FROM \"UserItemAccess\"\n WHERE user_id = $2 AND item_id IN (\n SELECT $1 -- The chat itself\n UNION\n SELECT project_id FROM project_hierarchy -- All parent projects\n )\n UNION ALL\n -- Source 2: Select the publicAccessLevel (which is already text).\n SELECT \"publicAccessLevel\" as access_level\n FROM \"SharePermission\"\n WHERE \"isPublic\" = true AND \"publicAccessLevel\" IS NOT NULL AND id IN (\n SELECT \"sharePermissionId\" FROM \"ChatPermission\" WHERE \"chatId\" = $1\n UNION\n SELECT \"sharePermissionId\" FROM \"ProjectPermission\" WHERE \"projectId\" IN (SELECT project_id FROM project_hierarchy)\n )\n ) as all_levels\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "access_level",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "Text"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "4c695b011d49ba7d5fce4b309875ed952dc386ac760444d7883c5a76718f15be"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-4cc88f2a38cb0722282ef262adefd9fcb0d4778c5dc308720710e8f5e9995911.json b/rust/cloud-storage/soup/.sqlx/query-4cc88f2a38cb0722282ef262adefd9fcb0d4778c5dc308720710e8f5e9995911.jsonnew file mode 100644index 0000000000..e243f96402--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-4cc88f2a38cb0722282ef262adefd9fcb0d4778c5dc308720710e8f5e9995911.json@@ -0,0 +1,57 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n mr.message_id,\n c.email_address,\n COALESCE(mr.name, c.name) as \"name\",\n c.sfs_photo_url,\n mr.recipient_type as \"recipient_type!: DbRecipientType\"\n FROM email_messages m\n JOIN email_message_recipients mr ON m.id = mr.message_id\n JOIN email_contacts c ON mr.contact_id = c.id\n WHERE m.id = ANY($1)\n ORDER BY mr.message_id, mr.recipient_type\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "message_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "email_address",+ "type_info": "Varchar"+ },+ {+ "ordinal": 2,+ "name": "name",+ "type_info": "Varchar"+ },+ {+ "ordinal": 3,+ "name": "sfs_photo_url",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "recipient_type!: DbRecipientType",+ "type_info": {+ "Custom": {+ "name": "email_recipient_type",+ "kind": {+ "Enum": [+ "TO",+ "CC",+ "BCC"+ ]+ }+ }+ }+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false,+ null,+ true,+ false+ ]+ },+ "hash": "4cc88f2a38cb0722282ef262adefd9fcb0d4778c5dc308720710e8f5e9995911"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-4e096eb7d3c507e3647685073fba7b3f36ef0e70c887db31f5cc5a8eb8ee1844.json b/rust/cloud-storage/soup/.sqlx/query-4e096eb7d3c507e3647685073fba7b3f36ef0e70c887db31f5cc5a8eb8ee1844.jsonnew file mode 100644index 0000000000..55fcda1121--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-4e096eb7d3c507e3647685073fba7b3f36ef0e70c887db31f5cc5a8eb8ee1844.json@@ -0,0 +1,14 @@+{+ "db_name": "PostgreSQL",+ "query": "\n DELETE FROM user_notification\n WHERE user_id = $1\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": []+ },+ "hash": "4e096eb7d3c507e3647685073fba7b3f36ef0e70c887db31f5cc5a8eb8ee1844"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-50318d6d13fb931307f2115b33d277b5298c45ed798719e792e722bd30615a95.json b/rust/cloud-storage/soup/.sqlx/query-50318d6d13fb931307f2115b33d277b5298c45ed798719e792e722bd30615a95.jsonnew file mode 100644index 0000000000..7a4d0490be--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-50318d6d13fb931307f2115b33d277b5298c45ed798719e792e722bd30615a95.json@@ -0,0 +1,73 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT id, macro_id, fusionauth_user_id, email_address, provider as \"provider: _\",\n is_sync_active, created_at, updated_at\n FROM email_links\n WHERE macro_id = $1\n LIMIT 1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "macro_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "fusionauth_user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "email_address",+ "type_info": "Varchar"+ },+ {+ "ordinal": 4,+ "name": "provider: _",+ "type_info": {+ "Custom": {+ "name": "email_user_provider_enum",+ "kind": {+ "Enum": [+ "GMAIL"+ ]+ }+ }+ }+ },+ {+ "ordinal": 5,+ "name": "is_sync_active",+ "type_info": "Bool"+ },+ {+ "ordinal": 6,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "updated_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ false,+ false+ ]+ },+ "hash": "50318d6d13fb931307f2115b33d277b5298c45ed798719e792e722bd30615a95"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-54e3755d63a676a7fa70da77321e618032f0130c73eb6b0ae985f07c5c6c448b.json b/rust/cloud-storage/soup/.sqlx/query-54e3755d63a676a7fa70da77321e618032f0130c73eb6b0ae985f07c5c6c448b.jsonnew file mode 100644index 0000000000..03a8dbf6bb--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-54e3755d63a676a7fa70da77321e618032f0130c73eb6b0ae985f07c5c6c448b.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH RECURSIVE project_hierarchy AS (\n SELECT p.id as project_id\n FROM \"Chat\" c\n JOIN \"Project\" p ON c.\"projectId\" = p.id AND p.\"deletedAt\" IS NULL\n WHERE c.id = $1 AND c.\"deletedAt\" IS NULL\n UNION ALL\n SELECT parent.id as project_id\n FROM project_hierarchy ph\n JOIN \"Project\" parent ON parent.id = (\n SELECT \"parentId\" FROM \"Project\" WHERE id = ph.project_id AND \"parentId\" IS NOT NULL AND \"deletedAt\" IS NULL\n )\n )\n SELECT DISTINCT user_id FROM \"UserItemAccess\"\n WHERE item_id IN (\n SELECT $1\n UNION\n SELECT project_id FROM project_hierarchy\n )\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "54e3755d63a676a7fa70da77321e618032f0130c73eb6b0ae985f07c5c6c448b"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-58b8b566779518776b13cabdb3498ac55b426b0493e769ea607618db7e246a71.json b/rust/cloud-storage/soup/.sqlx/query-58b8b566779518776b13cabdb3498ac55b426b0493e769ea607618db7e246a71.jsonnew file mode 100644index 0000000000..2a84c80297--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-58b8b566779518776b13cabdb3498ac55b426b0493e769ea607618db7e246a71.json@@ -0,0 +1,17 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO email_scheduled_messages (\n link_id, message_id, send_time, sent,\n created_at, updated_at\n )\n VALUES ($1, $2, $3, $4, NOW(), NOW())\n ON CONFLICT (link_id, message_id) DO UPDATE SET\n send_time = EXCLUDED.send_time,\n sent = EXCLUDED.sent,\n updated_at = NOW()\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Timestamptz",+ "Bool"+ ]+ },+ "nullable": []+ },+ "hash": "58b8b566779518776b13cabdb3498ac55b426b0493e769ea607618db7e246a71"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-59eb39577b1b566ef0a95f74f75904a62689388c0b28b77a02946952e6aa8b36.json b/rust/cloud-storage/soup/.sqlx/query-59eb39577b1b566ef0a95f74f75904a62689388c0b28b77a02946952e6aa8b36.jsonnew file mode 100644index 0000000000..bf8b77e46c--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-59eb39577b1b566ef0a95f74f75904a62689388c0b28b77a02946952e6aa8b36.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE email_messages m\n SET\n is_starred = $1,\n updated_at = NOW()\n WHERE\n m.id = ANY($2)\n AND m.link_id = $3\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Bool",+ "UuidArray",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "59eb39577b1b566ef0a95f74f75904a62689388c0b28b77a02946952e6aa8b36"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-5df7eb0451abdb0810c1329807dab9213313858eceaea2015c5e6d584d2f168d.json b/rust/cloud-storage/soup/.sqlx/query-5df7eb0451abdb0810c1329807dab9213313858eceaea2015c5e6d584d2f168d.jsonnew file mode 100644index 0000000000..cf67130e20--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-5df7eb0451abdb0810c1329807dab9213313858eceaea2015c5e6d584d2f168d.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO email_user_history (link_id, thread_id, created_at, updated_at)\n VALUES ($1, $2, NOW(), NOW())\n ON CONFLICT (link_id, thread_id)\n DO UPDATE SET\n updated_at = NOW()\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "5df7eb0451abdb0810c1329807dab9213313858eceaea2015c5e6d584d2f168d"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-5fabf029c6dd06505963dab2b60eccb8ea77088f535970dbcf5f80d57a9a4c5b.json b/rust/cloud-storage/soup/.sqlx/query-5fabf029c6dd06505963dab2b60eccb8ea77088f535970dbcf5f80d57a9a4c5b.jsonnew file mode 100644index 0000000000..c853ae04b7--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-5fabf029c6dd06505963dab2b60eccb8ea77088f535970dbcf5f80d57a9a4c5b.json@@ -0,0 +1,110 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT \n id,\n organization_id,\n user_id,\n display_name,\n data_type as \"data_type: DataType\",\n is_multi_select,\n specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n created_at,\n updated_at,\n is_system\n FROM property_definitions\n WHERE id = $1\n AND is_system = FALSE\n AND (\n user_id = $2\n OR ($3::int IS NOT NULL AND organization_id = $3)\n )\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "organization_id",+ "type_info": "Int4"+ },+ {+ "ordinal": 2,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "display_name",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "data_type: DataType",+ "type_info": {+ "Custom": {+ "name": "property_data_type",+ "kind": {+ "Enum": [+ "BOOLEAN",+ "DATE",+ "NUMBER",+ "STRING",+ "SELECT_NUMBER",+ "SELECT_STRING",+ "ENTITY",+ "LINK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 5,+ "name": "is_multi_select",+ "type_info": "Bool"+ },+ {+ "ordinal": 6,+ "name": "specific_entity_type: Option<EntityType>",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 7,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,+ "name": "updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "is_system",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Text",+ "Int4"+ ]+ },+ "nullable": [+ false,+ true,+ true,+ false,+ false,+ false,+ true,+ false,+ false,+ false+ ]+ },+ "hash": "5fabf029c6dd06505963dab2b60eccb8ea77088f535970dbcf5f80d57a9a4c5b"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-60fe557b143af00c5ddce77735e8b629dcce80126672a6c1d6bb9d2677976c75.json b/rust/cloud-storage/soup/.sqlx/query-60fe557b143af00c5ddce77735e8b629dcce80126672a6c1d6bb9d2677976c75.jsonnew file mode 100644index 0000000000..68fd6aefaa--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-60fe557b143af00c5ddce77735e8b629dcce80126672a6c1d6bb9d2677976c75.json@@ -0,0 +1,122 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n t.id,\n t.provider_id,\n t.inbox_visible,\n t.is_read,\n t.effective_ts AS \"sort_ts!\",\n t.created_at AS \"created_at!\",\n t.updated_at AS \"updated_at!\",\n t.project_id,\n t.viewed_at AS \"viewed_at?\",\n lmp.subject AS \"name?\",\n lmp.snippet AS \"snippet?\",\n lmp.is_draft,\n (\n SELECT EXISTS (\n SELECT 1\n FROM email_messages m_imp\n JOIN email_message_labels ml ON m_imp.id = ml.message_id\n JOIN email_labels l ON ml.label_id = l.id\n WHERE m_imp.thread_id = t.id\n AND l.name = 'IMPORTANT'\n AND l.link_id = t.link_id\n )\n ) AS \"is_important!\",\n c.email_address AS \"sender_email?\",\n COALESCE(lmp.from_name, c.name) AS \"sender_name?\",\n c.sfs_photo_url as \"sender_photo_url?\",\n el.macro_id AS \"owner_id!\"\n FROM (\n -- Step 1: Find the latest draft timestamp for each thread, calculate the\n -- effective sort key, then sort and limit the results. This is the core optimization.\n SELECT\n t.id,\n t.provider_id,\n t.link_id,\n t.inbox_visible,\n t.is_read,\n t.project_id,\n ldpt.latest_draft_ts AS created_at,\n ldpt.latest_draft_ts AS updated_at,\n uh.updated_at AS viewed_at,\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, ldpt.latest_draft_ts)\n ELSE ldpt.latest_draft_ts\n END AS effective_ts\n FROM (\n -- This sub-subquery efficiently finds the latest draft timestamp for every thread.\n SELECT m.thread_id, MAX(m.updated_at) as latest_draft_ts\n FROM email_messages m\n -- we only display macro drafts, not drafts created in gmail\n WHERE m.link_id = $1 AND m.is_draft = TRUE AND m.internal_date_ts IS NULL\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml\n JOIN email_labels l ON ml.label_id = l.id\n WHERE ml.message_id = m.id AND l.name = 'TRASH' AND l.link_id = $1\n )\n GROUP BY m.thread_id\n ) ldpt\n JOIN email_threads t ON ldpt.thread_id = t.id\n LEFT JOIN email_user_history uh ON uh.thread_id = t.id AND uh.link_id = t.link_id\n WHERE\n (($3::timestamptz IS NULL) OR (\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, ldpt.latest_draft_ts)\n ELSE ldpt.latest_draft_ts\n END, t.id\n ) < ($3::timestamptz, $4::uuid))\n ORDER BY effective_ts DESC, t.updated_at DESC\n LIMIT $2\n ) AS t\n -- Step 2: For EACH of the limited threads from above, find the full details of its latest draft.\n CROSS JOIN LATERAL (\n SELECT\n m.subject,\n m.snippet,\n m.from_contact_id,\n m.from_name,\n m.is_draft\n FROM email_messages m\n WHERE m.thread_id = t.id\n AND m.is_draft = TRUE\n -- we only display macro drafts, not drafts created in gmail\n AND m.internal_date_ts IS NULL\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml\n JOIN email_labels l ON ml.label_id = l.id\n WHERE ml.message_id = m.id AND l.name = 'TRASH' AND l.link_id = t.link_id\n )\n ORDER BY m.updated_at DESC\n LIMIT 1\n ) AS lmp\n -- Step 3: Join to get the sender's details.\n LEFT JOIN email_contacts c ON lmp.from_contact_id = c.id\n JOIN email_links el ON t.link_id = el.id\n ORDER BY t.effective_ts DESC, t.updated_at DESC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "inbox_visible",+ "type_info": "Bool"+ },+ {+ "ordinal": 3,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "sort_ts!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "project_id",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "viewed_at?",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "name?",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "snippet?",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 12,+ "name": "is_important!",+ "type_info": "Bool"+ },+ {+ "ordinal": 13,+ "name": "sender_email?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 14,+ "name": "sender_name?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 15,+ "name": "sender_photo_url?",+ "type_info": "Text"+ },+ {+ "ordinal": 16,+ "name": "owner_id!",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int8",+ "Timestamptz",+ "Uuid",+ "Text"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ false,+ null,+ null,+ null,+ true,+ false,+ true,+ true,+ false,+ null,+ false,+ null,+ true,+ false+ ]+ },+ "hash": "60fe557b143af00c5ddce77735e8b629dcce80126672a6c1d6bb9d2677976c75"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-621186dcec072b603a5f3d7b9e987a1638589d539c60d9dc5c2ab0865ff062d6.json b/rust/cloud-storage/soup/.sqlx/query-621186dcec072b603a5f3d7b9e987a1638589d539c60d9dc5c2ab0865ff062d6.jsonnew file mode 100644index 0000000000..d0a749ebd2--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-621186dcec072b603a5f3d7b9e987a1638589d539c60d9dc5c2ab0865ff062d6.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT user_id FROM user_mute_notification\n WHERE user_id = ANY($1)\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "TextArray"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "621186dcec072b603a5f3d7b9e987a1638589d539c60d9dc5c2ab0865ff062d6"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-625ee33d48768e369ee1fe3abe27811ad04313b1aa31f4b51abe5fd3bf569674.json b/rust/cloud-storage/soup/.sqlx/query-625ee33d48768e369ee1fe3abe27811ad04313b1aa31f4b51abe5fd3bf569674.jsonnew file mode 100644index 0000000000..d374c2f79f--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-625ee33d48768e369ee1fe3abe27811ad04313b1aa31f4b51abe5fd3bf569674.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n DELETE FROM user_notification_type_preference\n WHERE user_id = $1 AND notification_event_type = $2\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Text"+ ]+ },+ "nullable": []+ },+ "hash": "625ee33d48768e369ee1fe3abe27811ad04313b1aa31f4b51abe5fd3bf569674"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-63492b018803ce26db5891964a0f52f37d2f54bd8243265c6561f4423af8617c.json b/rust/cloud-storage/soup/.sqlx/query-63492b018803ce26db5891964a0f52f37d2f54bd8243265c6561f4423af8617c.jsonnew file mode 100644index 0000000000..6d97183829--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-63492b018803ce26db5891964a0f52f37d2f54bd8243265c6561f4423af8617c.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO entity_properties (id, entity_id, entity_type, property_definition_id, values)\n SELECT \n u.id,\n u.entity_id,\n 'TASK'::property_entity_type,\n u.property_definition_id,\n NULL\n FROM UNNEST(\n $1::UUID[],\n $2::TEXT[],\n $3::UUID[]\n ) AS u(id, entity_id, property_definition_id)\n ON CONFLICT (entity_id, entity_type, property_definition_id)\n DO NOTHING\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "UuidArray",+ "TextArray",+ "UuidArray"+ ]+ },+ "nullable": []+ },+ "hash": "63492b018803ce26db5891964a0f52f37d2f54bd8243265c6561f4423af8617c"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-63ca13cc79c27b5267ebbf53491b657ca7671e1ab9d1a4691372693a9f9a4ff8.json b/rust/cloud-storage/soup/.sqlx/query-63ca13cc79c27b5267ebbf53491b657ca7671e1ab9d1a4691372693a9f9a4ff8.jsonnew file mode 100644index 0000000000..a110bb67c6--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-63ca13cc79c27b5267ebbf53491b657ca7671e1ab9d1a4691372693a9f9a4ff8.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT DISTINCT cp.user_id\n FROM comms_channel_participants cp\n WHERE cp.channel_id = $1 AND cp.left_at IS NULL\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "63ca13cc79c27b5267ebbf53491b657ca7671e1ab9d1a4691372693a9f9a4ff8"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-679d0dd86957b91b759135cf9fc7314630cfd377b004a8c1dfedbf5764137ebd.json b/rust/cloud-storage/soup/.sqlx/query-679d0dd86957b91b759135cf9fc7314630cfd377b004a8c1dfedbf5764137ebd.jsonnew file mode 100644index 0000000000..1bc2f8db8f--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-679d0dd86957b91b759135cf9fc7314630cfd377b004a8c1dfedbf5764137ebd.json@@ -0,0 +1,54 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO email_filters (link_id, email_address, is_important)\n VALUES ($1, $2, $3)\n ON CONFLICT (link_id, lower(email_address)) WHERE email_address IS NOT NULL\n DO UPDATE SET is_important = EXCLUDED.is_important\n RETURNING id, link_id, email_address, email_domain, is_important, created_at",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "email_address",+ "type_info": "Varchar"+ },+ {+ "ordinal": 3,+ "name": "email_domain",+ "type_info": "Varchar"+ },+ {+ "ordinal": 4,+ "name": "is_important",+ "type_info": "Bool"+ },+ {+ "ordinal": 5,+ "name": "created_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Varchar",+ "Bool"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ true,+ false,+ false+ ]+ },+ "hash": "679d0dd86957b91b759135cf9fc7314630cfd377b004a8c1dfedbf5764137ebd"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-6c022c7b1e5e5faf6f388528436453738aa66c36c46313ca18c7570b406553f6.json b/rust/cloud-storage/soup/.sqlx/query-6c022c7b1e5e5faf6f388528436453738aa66c36c46313ca18c7570b406553f6.jsonnew file mode 100644index 0000000000..2f59f37298--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-6c022c7b1e5e5faf6f388528436453738aa66c36c46313ca18c7570b406553f6.json@@ -0,0 +1,20 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE email_threads\n SET\n inbox_visible = $1,\n is_read = $2,\n latest_inbound_message_ts = $3,\n latest_outbound_message_ts = $4,\n latest_non_spam_message_ts = $5,\n updated_at = NOW()\n WHERE\n id = $6 AND\n link_id = $7\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Bool",+ "Bool",+ "Timestamptz",+ "Timestamptz",+ "Timestamptz",+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "6c022c7b1e5e5faf6f388528436453738aa66c36c46313ca18c7570b406553f6"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-714f90b277b3e53e84688fbe6b573cd622f5c320c33ab43c3c952aa9c12199b3.json b/rust/cloud-storage/soup/.sqlx/query-714f90b277b3e53e84688fbe6b573cd622f5c320c33ab43c3c952aa9c12199b3.jsonnew file mode 100644index 0000000000..ed19453502--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-714f90b277b3e53e84688fbe6b573cd622f5c320c33ab43c3c952aa9c12199b3.json@@ -0,0 +1,122 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH ApplicableLabelIDs AS (\n SELECT id\n FROM email_labels\n WHERE link_id = $1\n AND (name = 'INBOX')\n ),\n QualifyingMessages AS (\n SELECT m.thread_id,\n m.internal_date_ts,\n m.created_at AS fallback_ts,\n m.is_draft,\n m.subject,\n m.snippet,\n m.from_contact_id,\n m.from_name\n FROM email_messages m\n WHERE m.link_id = $1\n AND NOT EXISTS (\n SELECT 1\n FROM email_message_labels ml\n JOIN email_labels l ON ml.label_id = l.id\n WHERE ml.message_id = m.id\n AND l.name = 'TRASH'\n AND l.link_id = $1\n )\n AND EXISTS (\n SELECT 1\n FROM email_message_labels ml\n JOIN email_labels l ON ml.label_id = l.id\n WHERE ml.message_id = m.id\n AND l.name = 'IMPORTANT'\n )\n AND EXISTS (\n SELECT 1\n FROM email_message_labels ml\n JOIN ApplicableLabelIDs ali ON ml.label_id = ali.id\n WHERE ml.message_id = m.id\n )\n\n UNION ALL\n\n SELECT m.thread_id,\n m.internal_date_ts,\n m.created_at AS fallback_ts,\n m.is_draft,\n m.subject,\n m.snippet,\n m.from_contact_id,\n m.from_name\n FROM email_messages m\n WHERE m.link_id = $1\n AND m.is_draft = TRUE\n AND NOT EXISTS (\n SELECT 1\n FROM email_message_labels ml\n JOIN email_labels l ON ml.label_id = l.id\n WHERE ml.message_id = m.id\n AND l.name = 'TRASH'\n AND l.link_id = $1\n )\n ),\n AllImportantThreads AS (\n -- From all qualifying messages, get the single most recent one per thread.\n SELECT DISTINCT ON (thread_id)\n thread_id,\n internal_date_ts,\n fallback_ts,\n is_draft,\n subject,\n snippet,\n from_contact_id,\n from_name\n FROM QualifyingMessages\n ORDER BY thread_id, COALESCE(internal_date_ts, fallback_ts) DESC\n ),\n ImportantWithSortKey AS (\n -- Join with user_history to calculate the final effective sort key.\n SELECT\n ait.thread_id,\n ait.internal_date_ts,\n ait.fallback_ts,\n ait.is_draft,\n ait.subject,\n ait.snippet,\n ait.from_contact_id,\n ait.from_name,\n COALESCE(ait.internal_date_ts, ait.fallback_ts) as created_at,\n COALESCE(ait.internal_date_ts, ait.fallback_ts) as updated_at,\n uh.updated_at as viewed_at,\n -- This CASE statement dynamically selects the correct timestamp for sorting.\n -- For 'updated_at' and 'created_at', we use the important message timestamp\n -- For 'viewed_at', we use the history timestamp.\n -- For 'viewed_updated', we use the history timestamp if it exists, otherwise the important message timestamp.\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, COALESCE(ait.internal_date_ts, ait.fallback_ts))\n ELSE COALESCE(ait.internal_date_ts, ait.fallback_ts)\n END AS effective_ts\n FROM AllImportantThreads ait\n -- This has to be a left join to support all sort methods.\n LEFT JOIN email_user_history uh ON uh.thread_id = ait.thread_id AND uh.link_id = $1\n )\n SELECT\n isk.thread_id as \"id!\",\n t.provider_id,\n t.inbox_visible,\n t.is_read,\n isk.effective_ts as \"sort_ts!\",\n isk.created_at as \"created_at!\",\n isk.updated_at as \"updated_at!\",\n t.project_id,\n isk.viewed_at as \"viewed_at?\",\n isk.is_draft as \"is_draft!\",\n -- It's the important view - all threads here are important\n true as \"is_important!\",\n isk.subject as \"name?\",\n isk.snippet as \"snippet?\",\n c.email_address AS \"sender_email?\",\n COALESCE(isk.from_name, c.name) AS \"sender_name?\",\n c.sfs_photo_url as \"sender_photo_url?\",\n el.macro_id AS \"owner_id!\"\n FROM ImportantWithSortKey isk\n JOIN email_threads t ON isk.thread_id = t.id\n LEFT JOIN email_contacts c ON isk.from_contact_id = c.id\n JOIN email_links el ON t.link_id = el.id\n WHERE\n ($3::timestamptz IS NULL) OR (isk.effective_ts, isk.thread_id) < ($3::timestamptz, $4::uuid)\n ORDER BY isk.effective_ts DESC, isk.thread_id DESC\n LIMIT $2\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id!",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "inbox_visible",+ "type_info": "Bool"+ },+ {+ "ordinal": 3,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "sort_ts!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "project_id",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "viewed_at?",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "is_draft!",+ "type_info": "Bool"+ },+ {+ "ordinal": 10,+ "name": "is_important!",+ "type_info": "Bool"+ },+ {+ "ordinal": 11,+ "name": "name?",+ "type_info": "Text"+ },+ {+ "ordinal": 12,+ "name": "snippet?",+ "type_info": "Text"+ },+ {+ "ordinal": 13,+ "name": "sender_email?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 14,+ "name": "sender_name?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 15,+ "name": "sender_photo_url?",+ "type_info": "Text"+ },+ {+ "ordinal": 16,+ "name": "owner_id!",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int8",+ "Timestamptz",+ "Uuid",+ "Text"+ ]+ },+ "nullable": [+ null,+ true,+ false,+ false,+ null,+ null,+ null,+ true,+ false,+ null,+ null,+ null,+ null,+ false,+ null,+ true,+ false+ ]+ },+ "hash": "714f90b277b3e53e84688fbe6b573cd622f5c320c33ab43c3c952aa9c12199b3"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-732141210551d42218ce027266c6dfa3dd1f0ddb2c37493ed1235fe488073d89.json b/rust/cloud-storage/soup/.sqlx/query-732141210551d42218ce027266c6dfa3dd1f0ddb2c37493ed1235fe488073d89.jsonnew file mode 100644index 0000000000..ea49b9c1cd--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-732141210551d42218ce027266c6dfa3dd1f0ddb2c37493ed1235fe488073d89.json@@ -0,0 +1,108 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT \n id,\n organization_id,\n user_id,\n display_name,\n data_type as \"data_type: DataType\",\n is_multi_select,\n specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n created_at,\n updated_at,\n is_system\n FROM property_definitions\n WHERE id = $1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "organization_id",+ "type_info": "Int4"+ },+ {+ "ordinal": 2,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "display_name",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "data_type: DataType",+ "type_info": {+ "Custom": {+ "name": "property_data_type",+ "kind": {+ "Enum": [+ "BOOLEAN",+ "DATE",+ "NUMBER",+ "STRING",+ "SELECT_NUMBER",+ "SELECT_STRING",+ "ENTITY",+ "LINK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 5,+ "name": "is_multi_select",+ "type_info": "Bool"+ },+ {+ "ordinal": 6,+ "name": "specific_entity_type: Option<EntityType>",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 7,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,+ "name": "updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "is_system",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ false,+ true,+ true,+ false,+ false,+ false,+ true,+ false,+ false,+ false+ ]+ },+ "hash": "732141210551d42218ce027266c6dfa3dd1f0ddb2c37493ed1235fe488073d89"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-73c67fbf678e1479d528adcc5bea7da3261d0a04e24cc16f96ec9f2dea3b2e98.json b/rust/cloud-storage/soup/.sqlx/query-73c67fbf678e1479d528adcc5bea7da3261d0a04e24cc16f96ec9f2dea3b2e98.jsonnew file mode 100644index 0000000000..65459bcefd--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-73c67fbf678e1479d528adcc5bea7da3261d0a04e24cc16f96ec9f2dea3b2e98.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT id\n FROM \"User\"\n WHERE email = $1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "73c67fbf678e1479d528adcc5bea7da3261d0a04e24cc16f96ec9f2dea3b2e98"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-74132c6b056f693ac364bd5d70a40d81ccd384ffc21881d7c162895cb7d11647.json b/rust/cloud-storage/soup/.sqlx/query-74132c6b056f693ac364bd5d70a40d81ccd384ffc21881d7c162895cb7d11647.jsonnew file mode 100644index 0000000000..eddca4f0fd--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-74132c6b056f693ac364bd5d70a40d81ccd384ffc21881d7c162895cb7d11647.json@@ -0,0 +1,29 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT id, email_address\n FROM email_contacts\n WHERE link_id = $1 AND email_address = ANY($2)\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "email_address",+ "type_info": "Varchar"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "TextArray"+ ]+ },+ "nullable": [+ false,+ false+ ]+ },+ "hash": "74132c6b056f693ac364bd5d70a40d81ccd384ffc21881d7c162895cb7d11647"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-74d33764e454fb9ab4f2775974462d6fdb092bffc720d929de5e7b50ecef5139.json b/rust/cloud-storage/soup/.sqlx/query-74d33764e454fb9ab4f2775974462d6fdb092bffc720d929de5e7b50ecef5139.jsonnew file mode 100644index 0000000000..34382e8725--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-74d33764e454fb9ab4f2775974462d6fdb092bffc720d929de5e7b50ecef5139.json@@ -0,0 +1,28 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT id, apns_collapse_key as \"apns_collapse_key!: String\"\n FROM notification\n WHERE id = ANY($1) AND apns_collapse_key IS NOT NULL\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "apns_collapse_key!: String",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ true+ ]+ },+ "hash": "74d33764e454fb9ab4f2775974462d6fdb092bffc720d929de5e7b50ecef5139"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-7617f808df94ffe77c8195a911ee6b230a21fe9935e099d1310d244248ca253a.json b/rust/cloud-storage/soup/.sqlx/query-7617f808df94ffe77c8195a911ee6b230a21fe9935e099d1310d244248ca253a.jsonnew file mode 100644index 0000000000..655495fb29--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-7617f808df94ffe77c8195a911ee6b230a21fe9935e099d1310d244248ca253a.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT c.id\n FROM comms_channels c\n INNER JOIN comms_channel_participants cp ON cp.channel_id = c.id\n WHERE cp.user_id = $1 AND cp.left_at IS NULL\n AND c.id = ANY($2::uuid[])\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "UuidArray"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "7617f808df94ffe77c8195a911ee6b230a21fe9935e099d1310d244248ca253a"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-765650cab2b1a1d1abe6ca406438bf48968cebebc7316b87b192d649e096cd67.json b/rust/cloud-storage/soup/.sqlx/query-765650cab2b1a1d1abe6ca406438bf48968cebebc7316b87b192d649e096cd67.jsonnew file mode 100644index 0000000000..a8e7326c35--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-765650cab2b1a1d1abe6ca406438bf48968cebebc7316b87b192d649e096cd67.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT user_id FROM user_notification_item_unsubscribe\n WHERE item_id = $1 AND user_id = ANY($2)\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "TextArray"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "765650cab2b1a1d1abe6ca406438bf48968cebebc7316b87b192d649e096cd67"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-78f1cf9da464937604c1a2d5115c014cab9de72bd88605ff47a316baa2c7acc2.json b/rust/cloud-storage/soup/.sqlx/query-78f1cf9da464937604c1a2d5115c014cab9de72bd88605ff47a316baa2c7acc2.jsonnew file mode 100644index 0000000000..9e6f7f8877--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-78f1cf9da464937604c1a2d5115c014cab9de72bd88605ff47a316baa2c7acc2.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT d.device_endpoint\n FROM notification_user_device_registration d\n WHERE d.device_token = $1\n LIMIT 1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "device_endpoint",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "78f1cf9da464937604c1a2d5115c014cab9de72bd88605ff47a316baa2c7acc2"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-79d3bc72e6f424765706f7deea426379ae49cbd70dd122daedd95343618b9ac6.json b/rust/cloud-storage/soup/.sqlx/query-79d3bc72e6f424765706f7deea426379ae49cbd70dd122daedd95343618b9ac6.jsonnew file mode 100644index 0000000000..2bde15938f--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-79d3bc72e6f424765706f7deea426379ae49cbd70dd122daedd95343618b9ac6.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH RECURSIVE project_hierarchy AS (\n SELECT id as project_id\n FROM \"Project\"\n WHERE id = $1 AND \"deletedAt\" IS NULL\n UNION ALL\n SELECT parent.id as project_id\n FROM project_hierarchy ph\n JOIN \"Project\" parent ON parent.id = (\n SELECT \"parentId\" FROM \"Project\" WHERE id = ph.project_id AND \"parentId\" IS NOT NULL AND \"deletedAt\" IS NULL\n )\n )\n SELECT DISTINCT user_id FROM \"UserItemAccess\"\n WHERE item_id IN (\n SELECT project_id FROM project_hierarchy\n )\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "79d3bc72e6f424765706f7deea426379ae49cbd70dd122daedd95343618b9ac6"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-7ae5368ee01e670dcc9804096f3d3e9dcab6dcebcb601bfb1ed190dbda0ff37f.json b/rust/cloud-storage/soup/.sqlx/query-7ae5368ee01e670dcc9804096f3d3e9dcab6dcebcb601bfb1ed190dbda0ff37f.jsonnew file mode 100644index 0000000000..a33e79f60e--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-7ae5368ee01e670dcc9804096f3d3e9dcab6dcebcb601bfb1ed190dbda0ff37f.json@@ -0,0 +1,34 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO entity_properties (id, entity_id, entity_type, property_definition_id, values)\n VALUES ($1, $2, $3, $4, $5)\n ON CONFLICT (entity_id, entity_type, property_definition_id) \n DO UPDATE SET \n values = EXCLUDED.values,\n updated_at = NOW()\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Text",+ {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ },+ "Uuid",+ "Jsonb"+ ]+ },+ "nullable": []+ },+ "hash": "7ae5368ee01e670dcc9804096f3d3e9dcab6dcebcb601bfb1ed190dbda0ff37f"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-7c0b9d645a85e30577377e4d8c8a8f976e86c6251e12517a2b1e14d525e09198.json b/rust/cloud-storage/soup/.sqlx/query-7c0b9d645a85e30577377e4d8c8a8f976e86c6251e12517a2b1e14d525e09198.jsonnew file mode 100644index 0000000000..721b0038f2--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-7c0b9d645a85e30577377e4d8c8a8f976e86c6251e12517a2b1e14d525e09198.json@@ -0,0 +1,28 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT user_id, notification_event_type\n FROM user_notification_type_preference\n WHERE user_id = $1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "notification_event_type",+ "type_info": "Varchar"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false,+ false+ ]+ },+ "hash": "7c0b9d645a85e30577377e4d8c8a8f976e86c6251e12517a2b1e14d525e09198"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-7ccdaab5873129437c98581ac37eb4148255b83e18fad15349d06c54040fd6cc.json b/rust/cloud-storage/soup/.sqlx/query-7ccdaab5873129437c98581ac37eb4148255b83e18fad15349d06c54040fd6cc.jsonnew file mode 100644index 0000000000..a166680895--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-7ccdaab5873129437c98581ac37eb4148255b83e18fad15349d06c54040fd6cc.json@@ -0,0 +1,21 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO notification (id, notification_event_type, event_item_id, event_item_type, service_sender, metadata, sender_id, apns_collapse_key)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8)\n ON CONFLICT (id) DO NOTHING\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Varchar",+ "Text",+ "Text",+ "Text",+ "Jsonb",+ "Text",+ "Text"+ ]+ },+ "nullable": []+ },+ "hash": "7ccdaab5873129437c98581ac37eb4148255b83e18fad15349d06c54040fd6cc"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-7ee9ba5adfac304c7ac930943538ecca7428b1054d451fb2f8973cf9c11caf45.json b/rust/cloud-storage/soup/.sqlx/query-7ee9ba5adfac304c7ac930943538ecca7428b1054d451fb2f8973cf9c11caf45.jsonnew file mode 100644index 0000000000..fbdbdf128a--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-7ee9ba5adfac304c7ac930943538ecca7428b1054d451fb2f8973cf9c11caf45.json@@ -0,0 +1,118 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH input_ids AS (\n SELECT UNNEST($1::uuid[]) AS channel_id\n )\n SELECT\n i.channel_id AS \"channel_id!\",\n l.message_id AS \"l_message_id?: uuid::Uuid\",\n l.thread_id AS \"l_thread_id?: uuid::Uuid\",\n l.sender_id AS \"l_sender_id?: String\",\n l.content AS \"l_content?: String\",\n l.created_at AS \"l_created_at?: chrono::DateTime<chrono::Utc>\",\n l.updated_at AS \"l_updated_at?: chrono::DateTime<chrono::Utc>\",\n l.deleted_at AS \"l_deleted_at?: chrono::DateTime<chrono::Utc>\",\n l.mentions AS \"l_mentions?: Vec<String>\",\n n.message_id AS \"n_message_id?: uuid::Uuid\",\n n.thread_id AS \"n_thread_id?: uuid::Uuid\",\n n.sender_id AS \"n_sender_id?: String\",\n n.content AS \"n_content?: String\",\n n.created_at AS \"n_created_at?: chrono::DateTime<chrono::Utc>\",\n n.updated_at AS \"n_updated_at?: chrono::DateTime<chrono::Utc>\",\n n.deleted_at AS \"n_deleted_at?: chrono::DateTime<chrono::Utc>\",\n n.mentions AS \"n_mentions?: Vec<String>\"\n FROM input_ids i\n LEFT JOIN LATERAL (\n SELECT\n m.id AS message_id,\n m.thread_id,\n m.sender_id,\n m.content,\n m.created_at,\n m.updated_at,\n m.deleted_at::timestamptz AS deleted_at,\n COALESCE(\n ARRAY(\n SELECT entity_type || ':' || entity_id\n FROM comms_entity_mentions em\n WHERE em.source_entity_type = 'message'\n AND em.source_entity_id = m.id::text\n ),\n '{}'::text[]\n ) AS mentions\n FROM comms_messages m\n WHERE m.channel_id = i.channel_id\n AND m.deleted_at IS NULL\n ORDER BY m.created_at DESC\n LIMIT 1\n ) l ON TRUE\n LEFT JOIN LATERAL (\n SELECT\n m.id AS message_id,\n m.thread_id,\n m.sender_id,\n m.content,\n m.created_at,\n m.updated_at,\n m.deleted_at::timestamptz AS deleted_at,\n COALESCE(\n ARRAY(\n SELECT entity_type || ':' || entity_id\n FROM comms_entity_mentions em\n WHERE em.source_entity_type = 'message'\n AND em.source_entity_id = m.id::text\n ),\n '{}'::text[]\n ) AS mentions\n FROM comms_messages m\n WHERE m.channel_id = i.channel_id\n AND m.deleted_at IS NULL\n AND m.thread_id IS NULL\n ORDER BY m.created_at DESC\n LIMIT 1\n ) n ON TRUE\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "channel_id!",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "l_message_id?: uuid::Uuid",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "l_thread_id?: uuid::Uuid",+ "type_info": "Uuid"+ },+ {+ "ordinal": 3,+ "name": "l_sender_id?: String",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "l_content?: String",+ "type_info": "Text"+ },+ {+ "ordinal": 5,+ "name": "l_created_at?: chrono::DateTime<chrono::Utc>",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "l_updated_at?: chrono::DateTime<chrono::Utc>",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "l_deleted_at?: chrono::DateTime<chrono::Utc>",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,+ "name": "l_mentions?: Vec<String>",+ "type_info": "TextArray"+ },+ {+ "ordinal": 9,+ "name": "n_message_id?: uuid::Uuid",+ "type_info": "Uuid"+ },+ {+ "ordinal": 10,+ "name": "n_thread_id?: uuid::Uuid",+ "type_info": "Uuid"+ },+ {+ "ordinal": 11,+ "name": "n_sender_id?: String",+ "type_info": "Text"+ },+ {+ "ordinal": 12,+ "name": "n_content?: String",+ "type_info": "Text"+ },+ {+ "ordinal": 13,+ "name": "n_created_at?: chrono::DateTime<chrono::Utc>",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 14,+ "name": "n_updated_at?: chrono::DateTime<chrono::Utc>",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 15,+ "name": "n_deleted_at?: chrono::DateTime<chrono::Utc>",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 16,+ "name": "n_mentions?: Vec<String>",+ "type_info": "TextArray"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ null,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ true+ ]+ },+ "hash": "7ee9ba5adfac304c7ac930943538ecca7428b1054d451fb2f8973cf9c11caf45"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-82301526394304e59946caa3c724c377fa46ad214834bc1a876d39ad29ad92ac.json b/rust/cloud-storage/soup/.sqlx/query-82301526394304e59946caa3c724c377fa46ad214834bc1a876d39ad29ad92ac.jsonnew file mode 100644index 0000000000..37446ebe78--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-82301526394304e59946caa3c724c377fa46ad214834bc1a876d39ad29ad92ac.json@@ -0,0 +1,122 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n t.id,\n t.provider_id,\n t.inbox_visible,\n t.is_read,\n t.effective_ts AS \"sort_ts!\",\n t.created_at AS \"created_at!\",\n t.updated_at AS \"updated_at!\",\n t.project_id,\n t.viewed_at AS \"viewed_at?\",\n lmp.subject AS \"name?\",\n lmp.snippet AS \"snippet?\",\n lmp.is_draft,\n (\n SELECT EXISTS (\n SELECT 1\n FROM email_messages m_imp\n JOIN email_message_labels ml ON m_imp.id = ml.message_id\n JOIN email_labels l ON ml.label_id = l.id\n WHERE m_imp.thread_id = t.id\n AND l.name = 'IMPORTANT'\n AND l.link_id = t.link_id\n )\n ) AS \"is_important!\",\n c.email_address AS \"sender_email?\",\n COALESCE(lmp.from_name, c.name) AS \"sender_name?\",\n c.sfs_photo_url as \"sender_photo_url?\",\n el.macro_id AS \"owner_id!\"\n FROM (\n -- Step 1: Efficiently find and sort ONLY the top N+1 candidate threads.\n -- This subquery only touches `threads` and `user_history`.\n SELECT\n t.id,\n t.provider_id,\n t.link_id,\n t.inbox_visible,\n t.is_read,\n t.project_id,\n t.latest_outbound_message_ts AS created_at,\n t.latest_outbound_message_ts AS updated_at,\n uh.updated_at AS viewed_at,\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, t.latest_outbound_message_ts)\n ELSE t.latest_outbound_message_ts\n END AS effective_ts\n FROM email_threads t\n LEFT JOIN email_user_history uh ON uh.thread_id = t.id AND uh.link_id = t.link_id\n WHERE\n t.link_id = $1\n AND t.latest_outbound_message_ts IS NOT NULL\n \n -- Cursor logic moved inside for maximum efficiency\n AND (($3::timestamptz IS NULL) OR (\n -- This CASE must exactly match the one that defines `effective_ts`\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, t.latest_outbound_message_ts)\n ELSE t.latest_outbound_message_ts\n END, t.id\n ) < ($3::timestamptz, $4::uuid))\n ORDER BY effective_ts DESC, t.updated_at DESC\n LIMIT $2\n ) AS t\n -- Step 2: For EACH of the limited threads from above, find its latest SENT, non-trashed message.\n CROSS JOIN LATERAL (\n SELECT\n m.subject,\n m.snippet,\n m.from_contact_id,\n m.from_name,\n m.is_draft\n FROM email_messages m\n WHERE m.thread_id = t.id\n AND m.is_sent = TRUE -- This condition is specific to the \"Sent\" view\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml JOIN email_labels l ON ml.label_id = l.id\n WHERE ml.message_id = m.id AND l.name = 'TRASH' AND l.link_id = t.link_id\n )\n ORDER BY m.internal_date_ts DESC\n LIMIT 1\n ) AS lmp\n -- Step 3: Join to get the sender's details for the final result set.\n LEFT JOIN email_contacts c ON lmp.from_contact_id = c.id\n JOIN email_links el ON t.link_id = el.id\n -- Final ordering is preserved because the input `t` is already sorted.\n ORDER BY t.effective_ts DESC, t.updated_at DESC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "inbox_visible",+ "type_info": "Bool"+ },+ {+ "ordinal": 3,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "sort_ts!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "project_id",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "viewed_at?",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "name?",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "snippet?",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 12,+ "name": "is_important!",+ "type_info": "Bool"+ },+ {+ "ordinal": 13,+ "name": "sender_email?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 14,+ "name": "sender_name?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 15,+ "name": "sender_photo_url?",+ "type_info": "Text"+ },+ {+ "ordinal": 16,+ "name": "owner_id!",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int8",+ "Timestamptz",+ "Uuid",+ "Text"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ false,+ null,+ true,+ true,+ true,+ false,+ true,+ true,+ false,+ null,+ false,+ null,+ true,+ false+ ]+ },+ "hash": "82301526394304e59946caa3c724c377fa46ad214834bc1a876d39ad29ad92ac"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-827b998f442f5f6cb6ff85dc35f01c5782128a4cb9a020e22ab83a24a6c2b4f5.json b/rust/cloud-storage/soup/.sqlx/query-827b998f442f5f6cb6ff85dc35f01c5782128a4cb9a020e22ab83a24a6c2b4f5.jsonnew file mode 100644index 0000000000..d172804854--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-827b998f442f5f6cb6ff85dc35f01c5782128a4cb9a020e22ab83a24a6c2b4f5.json@@ -0,0 +1,110 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT \n id,\n organization_id,\n user_id,\n display_name,\n data_type as \"data_type: DataType\",\n is_multi_select,\n specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n created_at,\n updated_at,\n is_system\n FROM property_definitions\n WHERE \n ($3 AND is_system)\n OR (\n ($1::int IS NOT NULL AND organization_id = $1) \n OR ($2::text IS NOT NULL AND user_id = $2)\n )\n ORDER BY LOWER(display_name) ASC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "organization_id",+ "type_info": "Int4"+ },+ {+ "ordinal": 2,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "display_name",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "data_type: DataType",+ "type_info": {+ "Custom": {+ "name": "property_data_type",+ "kind": {+ "Enum": [+ "BOOLEAN",+ "DATE",+ "NUMBER",+ "STRING",+ "SELECT_NUMBER",+ "SELECT_STRING",+ "ENTITY",+ "LINK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 5,+ "name": "is_multi_select",+ "type_info": "Bool"+ },+ {+ "ordinal": 6,+ "name": "specific_entity_type: Option<EntityType>",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 7,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,+ "name": "updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "is_system",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Int4",+ "Text",+ "Bool"+ ]+ },+ "nullable": [+ false,+ true,+ true,+ false,+ false,+ false,+ true,+ false,+ false,+ false+ ]+ },+ "hash": "827b998f442f5f6cb6ff85dc35f01c5782128a4cb9a020e22ab83a24a6c2b4f5"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-83dea9ffef9207e919ec708a6570c6f4090dbdbbb9f5f609edbad91becbc1bb4.json b/rust/cloud-storage/soup/.sqlx/query-83dea9ffef9207e919ec708a6570c6f4090dbdbbb9f5f609edbad91becbc1bb4.jsonnew file mode 100644index 0000000000..1290218ff1--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-83dea9ffef9207e919ec708a6570c6f4090dbdbbb9f5f609edbad91becbc1bb4.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT project_id\n FROM email_threads\n WHERE id = $1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "project_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ true+ ]+ },+ "hash": "83dea9ffef9207e919ec708a6570c6f4090dbdbbb9f5f609edbad91becbc1bb4"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-8519d142dcd5c9c6b60b9c61c24eca0b0c860eee7227124be31b2fcbff39e2bd.json b/rust/cloud-storage/soup/.sqlx/query-8519d142dcd5c9c6b60b9c61c24eca0b0c860eee7227124be31b2fcbff39e2bd.jsonnew file mode 100644index 0000000000..14e048261e--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-8519d142dcd5c9c6b60b9c61c24eca0b0c860eee7227124be31b2fcbff39e2bd.json@@ -0,0 +1,122 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH trash_label AS (\n SELECT id FROM email_labels WHERE link_id = $1 AND name = 'TRASH'\n ),\n important_label AS (\n SELECT id FROM email_labels WHERE link_id = $1 AND name = 'IMPORTANT'\n )\n SELECT\n t.id,\n t.provider_id,\n TRUE AS \"inbox_visible!\",\n t.is_read,\n t.effective_ts AS \"sort_ts!\",\n t.created_at AS \"created_at!\",\n t.updated_at AS \"updated_at!\",\n t.project_id,\n t.viewed_at AS \"viewed_at?\",\n lmp.subject AS \"name?\",\n lmp.snippet AS \"snippet?\",\n lmp.is_draft,\n EXISTS (\n SELECT 1\n FROM email_messages m_imp\n JOIN email_message_labels ml ON m_imp.id = ml.message_id\n WHERE m_imp.thread_id = t.id\n AND ml.label_id = (SELECT id FROM important_label)\n ) AS \"is_important!\",\n c.email_address AS \"sender_email?\",\n COALESCE(lmp.from_name, c.name) AS \"sender_name?\",\n c.sfs_photo_url as \"sender_photo_url?\",\n el.macro_id AS \"owner_id!\"\n FROM (\n -- Step 1: Efficiently find and sort ONLY the top N+1 candidate threads.\n -- This subquery is fast as it only touches `threads` and `user_history`.\n SELECT\n t.id,\n t.provider_id,\n t.link_id,\n t.is_read,\n t.project_id,\n t.latest_inbound_message_ts AS created_at,\n t.latest_inbound_message_ts AS updated_at,\n uh.updated_at AS viewed_at,\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, t.latest_inbound_message_ts)\n ELSE t.latest_inbound_message_ts\n END AS effective_ts\n FROM email_threads t\n LEFT JOIN email_user_history uh ON uh.thread_id = t.id AND uh.link_id = t.link_id\n WHERE\n t.link_id = $1\n AND t.inbox_visible = TRUE\n AND t.latest_inbound_message_ts IS NOT NULL\n \n -- The cursor logic is moved inside this subquery for maximum efficiency.\n AND (($3::timestamptz IS NULL) OR (\n -- This CASE must exactly match the one that defines `effective_ts`\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, t.latest_inbound_message_ts)\n ELSE t.latest_inbound_message_ts\n END, t.id\n ) < ($3::timestamptz, $4::uuid))\n ORDER BY effective_ts DESC, t.updated_at DESC -- fall back to updated_at if effective_ts is the same\n LIMIT $2\n ) AS t\n -- Step 2: For EACH of the limited threads from above, find its latest non-trashed message.\n CROSS JOIN LATERAL (\n SELECT\n m.subject,\n m.snippet,\n m.from_contact_id,\n m.from_name,\n m.is_draft\n FROM email_messages m\n WHERE m.thread_id = t.id\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml\n WHERE ml.message_id = m.id\n AND ml.label_id = (SELECT id FROM trash_label)\n )\n ORDER BY m.internal_date_ts DESC\n LIMIT 1\n ) AS lmp\n -- Step 3: Join to get the sender's details for the final result set.\n LEFT JOIN email_contacts c ON lmp.from_contact_id = c.id\n JOIN email_links el ON t.link_id = el.id\n -- Final ordering is preserved because the input `t` is already sorted.\n ORDER BY t.effective_ts DESC, t.updated_at DESC -- fall back to updated_at if effective_ts is the same\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "inbox_visible!",+ "type_info": "Bool"+ },+ {+ "ordinal": 3,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "sort_ts!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "project_id",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "viewed_at?",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "name?",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "snippet?",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 12,+ "name": "is_important!",+ "type_info": "Bool"+ },+ {+ "ordinal": 13,+ "name": "sender_email?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 14,+ "name": "sender_name?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 15,+ "name": "sender_photo_url?",+ "type_info": "Text"+ },+ {+ "ordinal": 16,+ "name": "owner_id!",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int8",+ "Timestamptz",+ "Uuid",+ "Text"+ ]+ },+ "nullable": [+ false,+ true,+ null,+ false,+ null,+ true,+ true,+ true,+ false,+ true,+ true,+ false,+ null,+ false,+ null,+ true,+ false+ ]+ },+ "hash": "8519d142dcd5c9c6b60b9c61c24eca0b0c860eee7227124be31b2fcbff39e2bd"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-86eee52e30e4168f4a7f319d1dcaa59144a5b3269120df892f161c74b5fe7436.json b/rust/cloud-storage/soup/.sqlx/query-86eee52e30e4168f4a7f319d1dcaa59144a5b3269120df892f161c74b5fe7436.jsonnew file mode 100644index 0000000000..eab49b91f7--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-86eee52e30e4168f4a7f319d1dcaa59144a5b3269120df892f161c74b5fe7436.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE user_notification\n SET sent = true\n WHERE notification_id = $1 AND user_id = ANY($2)\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "TextArray"+ ]+ },+ "nullable": []+ },+ "hash": "86eee52e30e4168f4a7f319d1dcaa59144a5b3269120df892f161c74b5fe7436"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-87e0c17146266f40e2f76a27c0e60bd057a7efe02fe027f9514cc8fbdba2159b.json b/rust/cloud-storage/soup/.sqlx/query-87e0c17146266f40e2f76a27c0e60bd057a7efe02fe027f9514cc8fbdba2159b.jsonnew file mode 100644index 0000000000..e8401c2e59--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-87e0c17146266f40e2f76a27c0e60bd057a7efe02fe027f9514cc8fbdba2159b.json@@ -0,0 +1,40 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n m.id as message_id,\n c.email_address,\n COALESCE(m.from_name, c.name) as \"name\",\n c.sfs_photo_url\n FROM email_messages m\n INNER JOIN email_contacts c ON c.id = m.from_contact_id\n WHERE m.id = ANY($1)\n AND m.from_contact_id IS NOT NULL\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "message_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "email_address",+ "type_info": "Varchar"+ },+ {+ "ordinal": 2,+ "name": "name",+ "type_info": "Varchar"+ },+ {+ "ordinal": 3,+ "name": "sfs_photo_url",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false,+ null,+ true+ ]+ },+ "hash": "87e0c17146266f40e2f76a27c0e60bd057a7efe02fe027f9514cc8fbdba2159b"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-88cb2c1126909dabe0cc1846ca2733ab98724d4b89d409fa770209d4d7627654.json b/rust/cloud-storage/soup/.sqlx/query-88cb2c1126909dabe0cc1846ca2733ab98724d4b89d409fa770209d4d7627654.jsonnew file mode 100644index 0000000000..566b687721--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-88cb2c1126909dabe0cc1846ca2733ab98724d4b89d409fa770209d4d7627654.json@@ -0,0 +1,35 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO email_message_recipients (message_id, contact_id, name, recipient_type)\n SELECT * FROM unnest($1::uuid[], $2::uuid[], $3::text[], $4::email_recipient_type[])\n ON CONFLICT (message_id, contact_id, recipient_type) DO NOTHING\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "UuidArray",+ "UuidArray",+ "TextArray",+ {+ "Custom": {+ "name": "email_recipient_type[]",+ "kind": {+ "Array": {+ "Custom": {+ "name": "email_recipient_type",+ "kind": {+ "Enum": [+ "TO",+ "CC",+ "BCC"+ ]+ }+ }+ }+ }+ }+ }+ ]+ },+ "nullable": []+ },+ "hash": "88cb2c1126909dabe0cc1846ca2733ab98724d4b89d409fa770209d4d7627654"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-89004da6bcdd66bccd56ed64402d82dc4fb489cccaf5ca647c5a9403fa760ce9.json b/rust/cloud-storage/soup/.sqlx/query-89004da6bcdd66bccd56ed64402d82dc4fb489cccaf5ca647c5a9403fa760ce9.jsonnew file mode 100644index 0000000000..a989abc850--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-89004da6bcdd66bccd56ed64402d82dc4fb489cccaf5ca647c5a9403fa760ce9.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT pg_try_advisory_xact_lock($1)\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "pg_try_advisory_xact_lock",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Int8"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "89004da6bcdd66bccd56ed64402d82dc4fb489cccaf5ca647c5a9403fa760ce9"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-8a219d75e22ca3b14ed3bfc1fbf218e2e69f540f69d0ab223170a52ac92af43c.json b/rust/cloud-storage/soup/.sqlx/query-8a219d75e22ca3b14ed3bfc1fbf218e2e69f540f69d0ab223170a52ac92af43c.jsonnew file mode 100644index 0000000000..83e2f46e9a--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-8a219d75e22ca3b14ed3bfc1fbf218e2e69f540f69d0ab223170a52ac92af43c.json@@ -0,0 +1,20 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO frecency_aggregates (\n entity_id,\n entity_type,\n user_id,\n event_count,\n frecency_score,\n first_event,\n recent_events\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n ON CONFLICT (user_id, entity_type, entity_id)\n DO UPDATE SET\n event_count = EXCLUDED.event_count,\n frecency_score = EXCLUDED.frecency_score,\n recent_events = EXCLUDED.recent_events\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Text",+ "Text",+ "Int4",+ "Float8",+ "Timestamptz",+ "Jsonb"+ ]+ },+ "nullable": []+ },+ "hash": "8a219d75e22ca3b14ed3bfc1fbf218e2e69f540f69d0ab223170a52ac92af43c"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-8b647d9753ba2b63ba9cc0057e0b71c87592c3e3983205d6969e0b3f1dbdb74b.json b/rust/cloud-storage/soup/.sqlx/query-8b647d9753ba2b63ba9cc0057e0b71c87592c3e3983205d6969e0b3f1dbdb74b.jsonnew file mode 100644index 0000000000..1e10ec0e6e--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-8b647d9753ba2b63ba9cc0057e0b71c87592c3e3983205d6969e0b3f1dbdb74b.json@@ -0,0 +1,123 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n t.id,\n t.provider_id,\n t.inbox_visible,\n t.is_read,\n t.effective_ts AS \"sort_ts!\",\n t.created_at AS \"created_at!\",\n t.updated_at AS \"updated_at!\",\n t.project_id,\n t.viewed_at AS \"viewed_at?\",\n lmp.subject AS \"name?\",\n lmp.snippet AS \"snippet?\",\n lmp.is_draft,\n (\n SELECT EXISTS (\n SELECT 1\n FROM email_messages m_imp\n JOIN email_message_labels ml ON m_imp.id = ml.message_id\n JOIN email_labels l ON ml.label_id = l.id\n WHERE m_imp.thread_id = t.id\n AND l.link_id = t.link_id\n AND l.name = 'IMPORTANT'\n )\n ) AS \"is_important!\",\n c.email_address AS \"sender_email?\",\n COALESCE(lmp.from_name, c.name) AS \"sender_name?\",\n c.sfs_photo_url as \"sender_photo_url?\",\n el.macro_id AS \"owner_id!\"\n FROM (\n -- Step 1: Find the latest labeled message timestamp for each thread,\n -- calculate the effective sort key, then sort and limit the results.\n SELECT\n t.id,\n t.provider_id,\n t.link_id,\n t.inbox_visible,\n t.is_read,\n t.project_id,\n llpt.latest_labeled_ts AS created_at,\n llpt.latest_labeled_ts AS updated_at,\n uh.updated_at AS viewed_at,\n CASE $6 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, llpt.latest_labeled_ts)\n ELSE llpt.latest_labeled_ts\n END AS effective_ts\n FROM (\n -- This sub-subquery efficiently finds the latest timestamp for every thread\n -- that has at least one message with the specified label.\n SELECT\n m.thread_id,\n MAX(m.internal_date_ts) as latest_labeled_ts\n FROM email_messages m\n JOIN email_message_labels ml ON m.id = ml.message_id\n JOIN email_labels l ON ml.label_id = l.id\n WHERE m.link_id = $1 AND l.name = $5\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml2\n JOIN email_labels l2 ON ml2.label_id = l2.id\n WHERE ml2.message_id = m.id AND l2.name = 'TRASH' AND l2.link_id = $1\n )\n GROUP BY m.thread_id\n ) llpt\n JOIN email_threads t ON llpt.thread_id = t.id\n LEFT JOIN email_user_history uh ON uh.thread_id = t.id AND uh.link_id = $1\n WHERE\n (($3::timestamptz IS NULL) OR (\n CASE $6 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, llpt.latest_labeled_ts)\n ELSE llpt.latest_labeled_ts\n END, t.id\n ) < ($3::timestamptz, $4::uuid))\n ORDER BY effective_ts DESC, t.updated_at DESC\n LIMIT $2\n ) AS t\n -- Step 2: For EACH of the limited threads from above, find the full details of its latest message with that specific label.\n CROSS JOIN LATERAL (\n SELECT\n m.subject,\n m.snippet,\n m.from_contact_id,\n m.from_name,\n m.is_draft\n FROM email_messages m\n JOIN email_message_labels ml ON m.id = ml.message_id\n JOIN email_labels l ON ml.label_id = l.id\n WHERE m.thread_id = t.id AND m.is_draft = FALSE AND l.link_id = t.link_id AND l.name = $5\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml2\n JOIN email_labels l2 ON ml2.label_id = l2.id\n WHERE ml2.message_id = m.id AND l2.name = 'TRASH' AND l2.link_id = t.link_id\n )\n ORDER BY m.internal_date_ts DESC\n LIMIT 1\n ) AS lmp\n -- Step 3: Join to get the sender's details.\n LEFT JOIN email_contacts c ON lmp.from_contact_id = c.id\n JOIN email_links el ON t.link_id = el.id\n ORDER BY t.effective_ts DESC, t.updated_at DESC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "inbox_visible",+ "type_info": "Bool"+ },+ {+ "ordinal": 3,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "sort_ts!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "project_id",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "viewed_at?",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "name?",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "snippet?",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 12,+ "name": "is_important!",+ "type_info": "Bool"+ },+ {+ "ordinal": 13,+ "name": "sender_email?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 14,+ "name": "sender_name?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 15,+ "name": "sender_photo_url?",+ "type_info": "Text"+ },+ {+ "ordinal": 16,+ "name": "owner_id!",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int8",+ "Timestamptz",+ "Uuid",+ "Text",+ "Text"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ false,+ null,+ null,+ null,+ true,+ false,+ true,+ true,+ false,+ null,+ false,+ null,+ true,+ false+ ]+ },+ "hash": "8b647d9753ba2b63ba9cc0057e0b71c87592c3e3983205d6969e0b3f1dbdb74b"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-8d21bf0aa4c20589a55cf5777aa9c658fdacea4d0d0c7070aded12cccd373911.json b/rust/cloud-storage/soup/.sqlx/query-8d21bf0aa4c20589a55cf5777aa9c658fdacea4d0d0c7070aded12cccd373911.jsonnew file mode 100644index 0000000000..505a2bd912--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-8d21bf0aa4c20589a55cf5777aa9c658fdacea4d0d0c7070aded12cccd373911.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE entity_properties\n SET values = $2\n WHERE entity_id = $1\n AND property_definition_id = $3\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Jsonb",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "8d21bf0aa4c20589a55cf5777aa9c658fdacea4d0d0c7070aded12cccd373911"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-922f058d237b9ffe46e13677ce2e6c4f4b39b7ae7b8b4dd248f54714d842a08e.json b/rust/cloud-storage/soup/.sqlx/query-922f058d237b9ffe46e13677ce2e6c4f4b39b7ae7b8b4dd248f54714d842a08e.jsonnew file mode 100644index 0000000000..0fd14fd3e9--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-922f058d237b9ffe46e13677ce2e6c4f4b39b7ae7b8b4dd248f54714d842a08e.json@@ -0,0 +1,58 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n eaf.message_id as draft_id,\n eaf.attachment_id,\n ea.provider_attachment_id,\n orig_msg.provider_id as \"message_provider_id!\",\n ea.filename,\n ea.mime_type,\n ea.size_bytes\n FROM email_attachments_fwd eaf\n JOIN email_attachments ea ON eaf.attachment_id = ea.id\n JOIN email_messages orig_msg ON ea.message_id = orig_msg.id\n WHERE eaf.message_id = ANY($1)\n ORDER BY eaf.message_id, ea.filename ASC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "draft_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "attachment_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "provider_attachment_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "message_provider_id!",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "filename",+ "type_info": "Varchar"+ },+ {+ "ordinal": 5,+ "name": "mime_type",+ "type_info": "Varchar"+ },+ {+ "ordinal": 6,+ "name": "size_bytes",+ "type_info": "Int8"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ true,+ true,+ true,+ true+ ]+ },+ "hash": "922f058d237b9ffe46e13677ce2e6c4f4b39b7ae7b8b4dd248f54714d842a08e"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-92edc80110af7b96f7f908989461a4abb11652671a95454969369a0484ed9239.json b/rust/cloud-storage/soup/.sqlx/query-92edc80110af7b96f7f908989461a4abb11652671a95454969369a0484ed9239.jsonnew file mode 100644index 0000000000..a8520fdfd0--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-92edc80110af7b96f7f908989461a4abb11652671a95454969369a0484ed9239.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO notification_message_receipt (message_id, user_id, notification_id)\n VALUES ($1, $2, $3)\n ON CONFLICT (message_id) DO NOTHING\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Text",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "92edc80110af7b96f7f908989461a4abb11652671a95454969369a0484ed9239"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-94c019227741f6c4fe8411454cb7c0a3a97e5594c29f11fa893238656e161ff1.json b/rust/cloud-storage/soup/.sqlx/query-94c019227741f6c4fe8411454cb7c0a3a97e5594c29f11fa893238656e161ff1.jsonnew file mode 100644index 0000000000..4035617965--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-94c019227741f6c4fe8411454cb7c0a3a97e5594c29f11fa893238656e161ff1.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE user_notification\n SET deleted_at = NOW()\n WHERE user_id = $1 AND notification_id = $2\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "94c019227741f6c4fe8411454cb7c0a3a97e5594c29f11fa893238656e161ff1"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-96d853b887f2e6d7aac6b15ddd2b71a8d8900d2ef30047da7ca1a5940503b6d0.json b/rust/cloud-storage/soup/.sqlx/query-96d853b887f2e6d7aac6b15ddd2b71a8d8900d2ef30047da7ca1a5940503b6d0.jsonnew file mode 100644index 0000000000..e42c9f2009--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-96d853b887f2e6d7aac6b15ddd2b71a8d8900d2ef30047da7ca1a5940503b6d0.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH RECURSIVE project_hierarchy AS (\n SELECT p.id as project_id\n FROM \"Document\" d\n JOIN \"Project\" p ON d.\"projectId\" = p.id AND p.\"deletedAt\" IS NULL\n WHERE d.id = $1 AND d.\"deletedAt\" IS NULL\n UNION ALL\n SELECT parent.id as project_id\n FROM project_hierarchy ph\n JOIN \"Project\" parent ON parent.id = (\n SELECT \"parentId\" FROM \"Project\" WHERE id = ph.project_id AND \"parentId\" IS NOT NULL AND \"deletedAt\" IS NULL\n )\n )\n SELECT DISTINCT user_id FROM \"UserItemAccess\"\n WHERE item_id IN (\n SELECT $1\n UNION\n SELECT project_id FROM project_hierarchy\n )\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "96d853b887f2e6d7aac6b15ddd2b71a8d8900d2ef30047da7ca1a5940503b6d0"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-9afc6f436aedd226ed0d6bf85de64c5ff57853c93ff00f768b49bf79f198590b.json b/rust/cloud-storage/soup/.sqlx/query-9afc6f436aedd226ed0d6bf85de64c5ff57853c93ff00f768b49bf79f198590b.jsonnew file mode 100644index 0000000000..154f82bfc7--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-9afc6f436aedd226ed0d6bf85de64c5ff57853c93ff00f768b49bf79f198590b.json@@ -0,0 +1,58 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT \n a.id as \"id!: Uuid\",\n a.user_id as \"user_id!: String\",\n a.channel_id as \"channel_id!: Uuid\",\n a.viewed_at as \"viewed_at?: DateTime<Utc>\",\n a.interacted_at as \"interacted_at?: DateTime<Utc>\",\n a.created_at as \"created_at!: DateTime<Utc>\",\n a.updated_at as \"updated_at!: DateTime<Utc>\"\n FROM comms_activity a\n WHERE a.user_id = $1\n ORDER BY \n GREATEST(\n COALESCE(a.viewed_at, '1970-01-01'::timestamp),\n COALESCE(a.interacted_at, '1970-01-01'::timestamp)\n ) DESC,\n a.created_at DESC\n LIMIT 100\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id!: Uuid",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "user_id!: String",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "channel_id!: Uuid",+ "type_info": "Uuid"+ },+ {+ "ordinal": 3,+ "name": "viewed_at?: DateTime<Utc>",+ "type_info": "Timestamp"+ },+ {+ "ordinal": 4,+ "name": "interacted_at?: DateTime<Utc>",+ "type_info": "Timestamp"+ },+ {+ "ordinal": 5,+ "name": "created_at!: DateTime<Utc>",+ "type_info": "Timestamp"+ },+ {+ "ordinal": 6,+ "name": "updated_at!: DateTime<Utc>",+ "type_info": "Timestamp"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ true,+ true,+ false,+ false+ ]+ },+ "hash": "9afc6f436aedd226ed0d6bf85de64c5ff57853c93ff00f768b49bf79f198590b"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-9cd40fbb1ade51e9e0d49792839d1a363cada017252a6f653c2272608189bcc4.json b/rust/cloud-storage/soup/.sqlx/query-9cd40fbb1ade51e9e0d49792839d1a363cada017252a6f653c2272608189bcc4.jsonnew file mode 100644index 0000000000..9d717fa5f9--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-9cd40fbb1ade51e9e0d49792839d1a363cada017252a6f653c2272608189bcc4.json@@ -0,0 +1,28 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT property_definition_id, values\n FROM entity_properties\n WHERE entity_id = $1\n AND entity_type = 'TASK'\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "property_definition_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "values",+ "type_info": "Jsonb"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false,+ true+ ]+ },+ "hash": "9cd40fbb1ade51e9e0d49792839d1a363cada017252a6f653c2272608189bcc4"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-9e45ba072fbc5266f7edba0fecb99d19192e10139d6ea089be4a3a4a7923361c.json b/rust/cloud-storage/soup/.sqlx/query-9e45ba072fbc5266f7edba0fecb99d19192e10139d6ea089be4a3a4a7923361c.jsonnew file mode 100644index 0000000000..357e50473e--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-9e45ba072fbc5266f7edba0fecb99d19192e10139d6ea089be4a3a4a7923361c.json@@ -0,0 +1,18 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO property_options (\n id,\n property_definition_id,\n display_order,\n number_value,\n string_value\n )\n VALUES ($1, $2, $3, $4, $5)\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid",+ "Int4",+ "Float8",+ "Text"+ ]+ },+ "nullable": []+ },+ "hash": "9e45ba072fbc5266f7edba0fecb99d19192e10139d6ea089be4a3a4a7923361c"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-9f5c0108230743e209902d457637931a2cbc77192ce513473a4f5e3498b8533c.json b/rust/cloud-storage/soup/.sqlx/query-9f5c0108230743e209902d457637931a2cbc77192ce513473a4f5e3498b8533c.jsonnew file mode 100644index 0000000000..e8b14cc25a--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-9f5c0108230743e209902d457637931a2cbc77192ce513473a4f5e3498b8533c.json@@ -0,0 +1,101 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n ml.message_id,\n l.id,\n l.link_id,\n l.provider_label_id,\n l.name,\n l.created_at,\n l.message_list_visibility as \"message_list_visibility: _\",\n l.label_list_visibility as \"label_list_visibility: _\",\n l.type as \"type_: _\"\n FROM email_message_labels ml\n JOIN email_labels l ON ml.label_id = l.id\n WHERE ml.message_id = ANY($1)\n ORDER BY ml.message_id, l.name\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "message_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 3,+ "name": "provider_label_id",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "name",+ "type_info": "Varchar"+ },+ {+ "ordinal": 5,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "message_list_visibility: _",+ "type_info": {+ "Custom": {+ "name": "email_message_list_visibility_enum",+ "kind": {+ "Enum": [+ "Show",+ "Hide"+ ]+ }+ }+ }+ },+ {+ "ordinal": 7,+ "name": "label_list_visibility: _",+ "type_info": {+ "Custom": {+ "name": "email_label_list_visibility_enum",+ "kind": {+ "Enum": [+ "LabelShow",+ "LabelShowIfUnread",+ "LabelHide"+ ]+ }+ }+ }+ },+ {+ "ordinal": 8,+ "name": "type_: _",+ "type_info": {+ "Custom": {+ "name": "email_label_type_enum",+ "kind": {+ "Enum": [+ "System",+ "User"+ ]+ }+ }+ }+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ false,+ false,+ false+ ]+ },+ "hash": "9f5c0108230743e209902d457637931a2cbc77192ce513473a4f5e3498b8533c"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-a0046a263c572915a8e14a8ac70479f1ba89549f1930f571bf278fcfe259cfd1.json b/rust/cloud-storage/soup/.sqlx/query-a0046a263c572915a8e14a8ac70479f1ba89549f1930f571bf278fcfe259cfd1.jsonnew file mode 100644index 0000000000..ad14cfedba--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-a0046a263c572915a8e14a8ac70479f1ba89549f1930f571bf278fcfe259cfd1.json@@ -0,0 +1,44 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT user_id, device_endpoint, device_type as \"device_type: DbDeviceType\"\n FROM notification_user_device_registration\n WHERE user_id = ANY($1)\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "device_endpoint",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "device_type: DbDeviceType",+ "type_info": {+ "Custom": {+ "name": "notification_device_type_option",+ "kind": {+ "Enum": [+ "ios",+ "android"+ ]+ }+ }+ }+ }+ ],+ "parameters": {+ "Left": [+ "TextArray"+ ]+ },+ "nullable": [+ false,+ false,+ false+ ]+ },+ "hash": "a0046a263c572915a8e14a8ac70479f1ba89549f1930f571bf278fcfe259cfd1"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-a2c42d1ef0b78555844e0feddc14956117973fadd5565af9a2c48c7d2230e05f.json b/rust/cloud-storage/soup/.sqlx/query-a2c42d1ef0b78555844e0feddc14956117973fadd5565af9a2c48c7d2230e05f.jsonnew file mode 100644index 0000000000..df027cb4f4--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-a2c42d1ef0b78555844e0feddc14956117973fadd5565af9a2c48c7d2230e05f.json@@ -0,0 +1,122 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH spam_label AS (\n SELECT id FROM email_labels WHERE link_id = $1 AND name = 'SPAM'\n ),\n trash_label AS (\n SELECT id FROM email_labels WHERE link_id = $1 AND name = 'TRASH'\n ),\n important_label AS (\n SELECT id FROM email_labels WHERE link_id = $1 AND name = 'IMPORTANT'\n )\n SELECT\n t.id,\n t.provider_id,\n t.inbox_visible,\n t.is_read,\n t.effective_ts AS \"sort_ts!\",\n t.created_at AS \"created_at!\",\n t.updated_at AS \"updated_at!\",\n t.project_id,\n t.viewed_at AS \"viewed_at?\",\n lmp.subject AS \"name?\",\n lmp.snippet AS \"snippet?\",\n lmp.is_draft,\n EXISTS (\n SELECT 1\n FROM email_messages m_imp\n JOIN email_message_labels ml ON m_imp.id = ml.message_id\n WHERE m_imp.thread_id = t.id\n AND ml.label_id = (SELECT id FROM important_label)\n ) AS \"is_important!\",\n c.email_address AS \"sender_email?\",\n COALESCE(lmp.from_name, c.name) AS \"sender_name?\",\n c.sfs_photo_url as \"sender_photo_url?\",\n el.macro_id AS \"owner_id!\"\n FROM (\n -- Step 1: Efficiently find, sort, and limit the top N+1 threads.\n -- This subquery only touches `threads` and `user_history`, making it very fast.\n SELECT\n t.id,\n t.provider_id,\n t.link_id,\n t.inbox_visible,\n t.is_read,\n t.project_id,\n t.latest_non_spam_message_ts AS created_at,\n t.latest_non_spam_message_ts AS updated_at,\n uh.updated_at AS viewed_at,\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, t.latest_non_spam_message_ts)\n ELSE t.latest_non_spam_message_ts\n END AS effective_ts\n FROM email_threads t\n LEFT JOIN email_user_history uh ON uh.thread_id = t.id AND uh.link_id = t.link_id\n WHERE\n t.link_id = $1\n AND t.latest_non_spam_message_ts IS NOT NULL\n \n -- Cursor logic is moved inside for maximum efficiency\n AND (($3::timestamptz IS NULL) OR (\n -- This CASE must exactly match the one that defines `effective_ts`\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, t.latest_non_spam_message_ts)\n ELSE t.latest_non_spam_message_ts\n END, t.id\n ) < ($3::timestamptz, $4::uuid))\n ORDER BY effective_ts DESC, t.updated_at DESC\n LIMIT $2\n ) AS t\n -- Step 2: For EACH of the limited threads from above, find its latest non-SPAM/TRASH message.\n CROSS JOIN LATERAL (\n SELECT\n m.subject,\n m.snippet,\n m.is_draft,\n m.from_contact_id,\n m.from_name\n FROM email_messages m\n WHERE m.thread_id = t.id\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml\n WHERE ml.message_id = m.id\n AND ml.label_id = (SELECT id FROM spam_label)\n )\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml\n WHERE ml.message_id = m.id\n AND ml.label_id = (SELECT id FROM trash_label)\n )\n ORDER BY m.internal_date_ts DESC\n LIMIT 1\n ) AS lmp\n -- Step 3: Join to get the sender's details for the final result set.\n LEFT JOIN email_contacts c ON lmp.from_contact_id = c.id\n JOIN email_links el ON t.link_id = el.id\n ORDER BY t.effective_ts DESC, t.updated_at DESC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "inbox_visible",+ "type_info": "Bool"+ },+ {+ "ordinal": 3,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "sort_ts!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "project_id",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "viewed_at?",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "name?",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "snippet?",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 12,+ "name": "is_important!",+ "type_info": "Bool"+ },+ {+ "ordinal": 13,+ "name": "sender_email?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 14,+ "name": "sender_name?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 15,+ "name": "sender_photo_url?",+ "type_info": "Text"+ },+ {+ "ordinal": 16,+ "name": "owner_id!",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int8",+ "Timestamptz",+ "Uuid",+ "Text"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ false,+ null,+ true,+ true,+ true,+ false,+ true,+ true,+ false,+ null,+ false,+ null,+ true,+ false+ ]+ },+ "hash": "a2c42d1ef0b78555844e0feddc14956117973fadd5565af9a2c48c7d2230e05f"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-a5d9f358b5382c0eaed918f903bc6aa328f527e6e47d649c37dfcf1c9f3a7139.json b/rust/cloud-storage/soup/.sqlx/query-a5d9f358b5382c0eaed918f903bc6aa328f527e6e47d649c37dfcf1c9f3a7139.jsonnew file mode 100644index 0000000000..7626c0a06b--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-a5d9f358b5382c0eaed918f903bc6aa328f527e6e47d649c37dfcf1c9f3a7139.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE user_notification\n SET seen_at = NOW()\n WHERE user_id = $1 AND notification_id = ANY($2)\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "UuidArray"+ ]+ },+ "nullable": []+ },+ "hash": "a5d9f358b5382c0eaed918f903bc6aa328f527e6e47d649c37dfcf1c9f3a7139"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-a774adbda891d81dd017de5b0b50f41a5a1da6e4c5a81e51eb3cb267f10ef1fc.json b/rust/cloud-storage/soup/.sqlx/query-a774adbda891d81dd017de5b0b50f41a5a1da6e4c5a81e51eb3cb267f10ef1fc.jsonnew file mode 100644index 0000000000..ca7b895e22--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-a774adbda891d81dd017de5b0b50f41a5a1da6e4c5a81e51eb3cb267f10ef1fc.json@@ -0,0 +1,122 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n t.id,\n t.provider_id,\n t.inbox_visible,\n t.is_read,\n t.effective_ts AS \"sort_ts!\",\n t.created_at AS \"created_at!\",\n t.updated_at AS \"updated_at!\",\n t.project_id,\n t.viewed_at AS \"viewed_at?\",\n lmp.subject AS \"name?\",\n lmp.snippet AS \"snippet?\",\n lmp.is_draft,\n -- A thread in \"Other\" can still be \"Important\", so we must perform the check.\n (\n SELECT EXISTS (\n SELECT 1\n FROM email_messages m_imp\n JOIN email_message_labels ml ON m_imp.id = ml.message_id\n JOIN email_labels l ON ml.label_id = l.id\n WHERE m_imp.thread_id = t.id\n AND l.link_id = t.link_id\n AND l.name = 'IMPORTANT'\n )\n ) AS \"is_important!\",\n c.email_address AS \"sender_email?\",\n COALESCE(lmp.from_name, c.name) AS \"sender_name?\",\n c.sfs_photo_url as \"sender_photo_url?\",\n el.macro_id AS \"owner_id!\"\n FROM (\n -- Step 1: Efficiently find, sort, and limit the top N+1 threads that qualify for the \"Other\" inbox.\n SELECT\n t.id,\n t.provider_id,\n t.link_id,\n t.inbox_visible,\n t.is_read,\n t.project_id,\n t.latest_non_spam_message_ts AS created_at,\n t.latest_non_spam_message_ts AS updated_at,\n uh.updated_at AS viewed_at,\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, t.latest_non_spam_message_ts)\n ELSE t.latest_non_spam_message_ts\n END AS effective_ts\n FROM email_threads t\n LEFT JOIN email_user_history uh ON uh.thread_id = t.id AND uh.link_id = t.link_id\n WHERE\n t.link_id = $1\n AND t.latest_non_spam_message_ts IS NOT NULL\n -- Inclusion Criteria: Must have a category label.\n AND EXISTS (\n SELECT 1 FROM email_messages m JOIN email_message_labels ml ON m.id = ml.message_id JOIN email_labels l ON ml.label_id = l.id\n WHERE m.thread_id = t.id AND l.link_id = t.link_id AND l.name IN ('CATEGORY_PROMOTIONS', 'CATEGORY_SOCIAL', 'CATEGORY_FORUMS')\n )\n -- ****** CORRECTED EXCLUSION CRITERIA ******\n -- This now matches the logic of your original query, which did NOT filter out 'INBOX' or 'IMPORTANT'.\n AND NOT EXISTS (\n SELECT 1 FROM email_messages m JOIN email_message_labels ml ON m.id = ml.message_id JOIN email_labels l ON ml.label_id = l.id\n WHERE m.thread_id = t.id AND l.link_id = t.link_id AND l.name IN ('SPAM', 'TRASH', 'DRAFT')\n )\n \n AND (($3::timestamptz IS NULL) OR (\n CASE $5 -- sort_method_str\n WHEN 'viewed_at' THEN COALESCE(uh.\"updated_at\", '1970-01-01 00:00:00+00')\n WHEN 'viewed_updated' THEN COALESCE(uh.updated_at, t.latest_non_spam_message_ts)\n ELSE t.latest_non_spam_message_ts\n END, t.id\n ) < ($3::timestamptz, $4::uuid))\n ORDER BY effective_ts DESC, t.updated_at DESC\n LIMIT $2\n ) AS t\n -- Step 2: For EACH of the limited threads from above, find its latest non-spam/trash message for the preview.\n CROSS JOIN LATERAL (\n SELECT\n m.subject,\n m.snippet,\n m.is_draft,\n m.from_contact_id,\n m.from_name\n FROM email_messages m\n WHERE m.thread_id = t.id\n AND m.is_draft = FALSE\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml JOIN email_labels l ON ml.label_id = l.id\n WHERE ml.message_id = m.id AND l.link_id = t.link_id AND l.name IN ('SPAM', 'TRASH')\n )\n ORDER BY m.internal_date_ts DESC\n LIMIT 1\n ) AS lmp\n -- Step 3: Join to get the sender's details.\n LEFT JOIN email_contacts c ON lmp.from_contact_id = c.id\n JOIN email_links el ON t.link_id = el.id\n ORDER BY t.effective_ts DESC, t.updated_at DESC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "inbox_visible",+ "type_info": "Bool"+ },+ {+ "ordinal": 3,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "sort_ts!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "project_id",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "viewed_at?",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "name?",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "snippet?",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 12,+ "name": "is_important!",+ "type_info": "Bool"+ },+ {+ "ordinal": 13,+ "name": "sender_email?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 14,+ "name": "sender_name?",+ "type_info": "Varchar"+ },+ {+ "ordinal": 15,+ "name": "sender_photo_url?",+ "type_info": "Text"+ },+ {+ "ordinal": 16,+ "name": "owner_id!",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int8",+ "Timestamptz",+ "Uuid",+ "Text"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ false,+ null,+ true,+ true,+ true,+ false,+ true,+ true,+ false,+ null,+ false,+ null,+ true,+ false+ ]+ },+ "hash": "a774adbda891d81dd017de5b0b50f41a5a1da6e4c5a81e51eb3cb267f10ef1fc"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-b0c4750b13bbd3de768ac09f971094ac7f53c161f7054083964f472fa01dd83d.json b/rust/cloud-storage/soup/.sqlx/query-b0c4750b13bbd3de768ac09f971094ac7f53c161f7054083964f472fa01dd83d.jsonnew file mode 100644index 0000000000..f91da73bfc--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-b0c4750b13bbd3de768ac09f971094ac7f53c161f7054083964f472fa01dd83d.json@@ -0,0 +1,29 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT id, email_address\n FROM email_contacts\n WHERE link_id = $1 AND email_address = ANY($2)\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "email_address",+ "type_info": "Varchar"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "TextArray"+ ]+ },+ "nullable": [+ false,+ false+ ]+ },+ "hash": "b0c4750b13bbd3de768ac09f971094ac7f53c161f7054083964f472fa01dd83d"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-b0e8935f157a7ae307fb050b39d0dde4e9e2e39f7cb20c716fbbcc1ffe320cd1.json b/rust/cloud-storage/soup/.sqlx/query-b0e8935f157a7ae307fb050b39d0dde4e9e2e39f7cb20c716fbbcc1ffe320cd1.jsonnew file mode 100644index 0000000000..e2f94b21f4--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-b0e8935f157a7ae307fb050b39d0dde4e9e2e39f7cb20c716fbbcc1ffe320cd1.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "\n DELETE FROM email_message_labels\n WHERE\n message_id = ANY($1)\n AND label_id = (\n SELECT id FROM email_labels\n WHERE link_id = $2 AND provider_label_id = $3\n )\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "UuidArray",+ "Uuid",+ "Text"+ ]+ },+ "nullable": []+ },+ "hash": "b0e8935f157a7ae307fb050b39d0dde4e9e2e39f7cb20c716fbbcc1ffe320cd1"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-b1c4d610f2fe772e88b8e78bc872f01c886031d866616effed3c6a61a99d2413.json b/rust/cloud-storage/soup/.sqlx/query-b1c4d610f2fe772e88b8e78bc872f01c886031d866616effed3c6a61a99d2413.jsonnew file mode 100644index 0000000000..9d7bd134c0--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-b1c4d610f2fe772e88b8e78bc872f01c886031d866616effed3c6a61a99d2413.json@@ -0,0 +1,16 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE email_messages m\n SET\n is_read = $1,\n updated_at = NOW()\n WHERE\n m.id = ANY($2)\n AND m.link_id = $3\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Bool",+ "UuidArray",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "b1c4d610f2fe772e88b8e78bc872f01c886031d866616effed3c6a61a99d2413"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-b370ac2ac7ace6911ff13454d24ff42b906dcc72b2fb4bcd783b8cb7c06ceab4.json b/rust/cloud-storage/soup/.sqlx/query-b370ac2ac7ace6911ff13454d24ff42b906dcc72b2fb4bcd783b8cb7c06ceab4.jsonnew file mode 100644index 0000000000..4ab9cd0461--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-b370ac2ac7ace6911ff13454d24ff42b906dcc72b2fb4bcd783b8cb7c06ceab4.json@@ -0,0 +1,14 @@+{+ "db_name": "PostgreSQL",+ "query": "DELETE FROM entity_properties WHERE id = $1",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "b370ac2ac7ace6911ff13454d24ff42b906dcc72b2fb4bcd783b8cb7c06ceab4"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-b3f9f3696438bd2ad8754650d87d7bbf32e70d3d173a748a07eacdb4e42841eb.json b/rust/cloud-storage/soup/.sqlx/query-b3f9f3696438bd2ad8754650d87d7bbf32e70d3d173a748a07eacdb4e42841eb.jsonnew file mode 100644index 0000000000..e5d913399d--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-b3f9f3696438bd2ad8754650d87d7bbf32e70d3d173a748a07eacdb4e42841eb.json@@ -0,0 +1,28 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO notification_user_device_registration (id, user_id, device_token, device_endpoint, device_type)\n VALUES ($1, $2, $3, $4, $5)\n ON CONFLICT (device_endpoint) DO UPDATE SET user_id = $2, device_token = $3, device_type = $5, updated_at = NOW()\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Text",+ "Text",+ "Text",+ {+ "Custom": {+ "name": "notification_device_type_option",+ "kind": {+ "Enum": [+ "ios",+ "android"+ ]+ }+ }+ }+ ]+ },+ "nullable": []+ },+ "hash": "b3f9f3696438bd2ad8754650d87d7bbf32e70d3d173a748a07eacdb4e42841eb"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-b4d3994adddd1a4b1c769cf01690bedbf26640fdfad218b4dca813bdcee08a5a.json b/rust/cloud-storage/soup/.sqlx/query-b4d3994adddd1a4b1c769cf01690bedbf26640fdfad218b4dca813bdcee08a5a.jsonnew file mode 100644index 0000000000..765e4bd327--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-b4d3994adddd1a4b1c769cf01690bedbf26640fdfad218b4dca813bdcee08a5a.json@@ -0,0 +1,22 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT DISTINCT emr.message_id\n FROM email_message_recipients emr\n JOIN email_messages m ON m.id = emr.message_id\n WHERE emr.message_id = ANY($1)\n AND m.from_contact_id IS NOT NULL\n AND emr.contact_id = m.from_contact_id\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "message_id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "b4d3994adddd1a4b1c769cf01690bedbf26640fdfad218b4dca813bdcee08a5a"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-b6705d3675950d0bbbd4a0ba10f7716a24694cfd98741fc0508d607684b1c8a9.json b/rust/cloud-storage/soup/.sqlx/query-b6705d3675950d0bbbd4a0ba10f7716a24694cfd98741fc0508d607684b1c8a9.jsonnew file mode 100644index 0000000000..1168d26a34--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-b6705d3675950d0bbbd4a0ba10f7716a24694cfd98741fc0508d607684b1c8a9.json@@ -0,0 +1,28 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE notification_message_receipt\n SET failed = true, failed_at = NOW()\n WHERE message_id = $1\n RETURNING user_id, notification_id\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "notification_id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": [+ false,+ false+ ]+ },+ "hash": "b6705d3675950d0bbbd4a0ba10f7716a24694cfd98741fc0508d607684b1c8a9"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-b79ca4a7b148d78ddf48b5c57dea59763b17693c09564a0190ed377dd09342cf.json b/rust/cloud-storage/soup/.sqlx/query-b79ca4a7b148d78ddf48b5c57dea59763b17693c09564a0190ed377dd09342cf.jsonnew file mode 100644index 0000000000..9c01b8fe22--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-b79ca4a7b148d78ddf48b5c57dea59763b17693c09564a0190ed377dd09342cf.json@@ -0,0 +1,96 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n id,\n link_id,\n provider_label_id,\n name,\n created_at,\n message_list_visibility as \"message_list_visibility: _\",\n label_list_visibility as \"label_list_visibility: _\",\n type as \"type_: _\"\n FROM email_labels\n WHERE id = $1 AND link_id = $2\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "provider_label_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "name",+ "type_info": "Varchar"+ },+ {+ "ordinal": 4,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "message_list_visibility: _",+ "type_info": {+ "Custom": {+ "name": "email_message_list_visibility_enum",+ "kind": {+ "Enum": [+ "Show",+ "Hide"+ ]+ }+ }+ }+ },+ {+ "ordinal": 6,+ "name": "label_list_visibility: _",+ "type_info": {+ "Custom": {+ "name": "email_label_list_visibility_enum",+ "kind": {+ "Enum": [+ "LabelShow",+ "LabelShowIfUnread",+ "LabelHide"+ ]+ }+ }+ }+ },+ {+ "ordinal": 7,+ "name": "type_: _",+ "type_info": {+ "Custom": {+ "name": "email_label_type_enum",+ "kind": {+ "Enum": [+ "System",+ "User"+ ]+ }+ }+ }+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ false,+ false+ ]+ },+ "hash": "b79ca4a7b148d78ddf48b5c57dea59763b17693c09564a0190ed377dd09342cf"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-b8eb30360d1232b36214b17758d8c7d897251a93c7d56b310a2fc6f026fdbea9.json b/rust/cloud-storage/soup/.sqlx/query-b8eb30360d1232b36214b17758d8c7d897251a93c7d56b310a2fc6f026fdbea9.jsonnew file mode 100644index 0000000000..331e15bd4e--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-b8eb30360d1232b36214b17758d8c7d897251a93c7d56b310a2fc6f026fdbea9.json@@ -0,0 +1,34 @@+{+ "db_name": "PostgreSQL",+ "query": "\n DELETE FROM email_message_recipients\n WHERE message_id = $1\n AND (contact_id, recipient_type) NOT IN (\n SELECT contact_id, recipient_type\n FROM unnest($2::uuid[], $3::email_recipient_type[])\n AS t(contact_id, recipient_type)\n )\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "UuidArray",+ {+ "Custom": {+ "name": "email_recipient_type[]",+ "kind": {+ "Array": {+ "Custom": {+ "name": "email_recipient_type",+ "kind": {+ "Enum": [+ "TO",+ "CC",+ "BCC"+ ]+ }+ }+ }+ }+ }+ }+ ]+ },+ "nullable": []+ },+ "hash": "b8eb30360d1232b36214b17758d8c7d897251a93c7d56b310a2fc6f026fdbea9"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-b9570b07121de0df914dd0579cc92a5e92973cf114526f80dbe7ab714493090b.json b/rust/cloud-storage/soup/.sqlx/query-b9570b07121de0df914dd0579cc92a5e92973cf114526f80dbe7ab714493090b.jsonnew file mode 100644index 0000000000..4063a3122f--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-b9570b07121de0df914dd0579cc92a5e92973cf114526f80dbe7ab714493090b.json@@ -0,0 +1,146 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT \n pd.id,\n pd.organization_id,\n pd.user_id,\n pd.display_name,\n pd.data_type as \"data_type: DataType\",\n pd.is_multi_select,\n pd.specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n pd.created_at,\n pd.updated_at,\n pd.is_system,\n po.id as \"option_id?\",\n po.display_order as \"option_display_order?\",\n po.number_value as option_number_value,\n po.string_value as option_string_value,\n po.created_at as \"option_created_at?\",\n po.updated_at as \"option_updated_at?\"\n FROM property_definitions pd\n LEFT JOIN property_options po ON pd.id = po.property_definition_id\n WHERE \n ($3 AND pd.is_system)\n OR (\n ($1::int IS NOT NULL AND pd.organization_id = $1) \n OR ($2::text IS NOT NULL AND pd.user_id = $2)\n )\n ORDER BY LOWER(pd.display_name), po.display_order, po.number_value, LOWER(po.string_value)\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "organization_id",+ "type_info": "Int4"+ },+ {+ "ordinal": 2,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "display_name",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "data_type: DataType",+ "type_info": {+ "Custom": {+ "name": "property_data_type",+ "kind": {+ "Enum": [+ "BOOLEAN",+ "DATE",+ "NUMBER",+ "STRING",+ "SELECT_NUMBER",+ "SELECT_STRING",+ "ENTITY",+ "LINK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 5,+ "name": "is_multi_select",+ "type_info": "Bool"+ },+ {+ "ordinal": 6,+ "name": "specific_entity_type: Option<EntityType>",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 7,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,+ "name": "updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "is_system",+ "type_info": "Bool"+ },+ {+ "ordinal": 10,+ "name": "option_id?",+ "type_info": "Uuid"+ },+ {+ "ordinal": 11,+ "name": "option_display_order?",+ "type_info": "Int4"+ },+ {+ "ordinal": 12,+ "name": "option_number_value",+ "type_info": "Float8"+ },+ {+ "ordinal": 13,+ "name": "option_string_value",+ "type_info": "Text"+ },+ {+ "ordinal": 14,+ "name": "option_created_at?",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 15,+ "name": "option_updated_at?",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Int4",+ "Text",+ "Bool"+ ]+ },+ "nullable": [+ false,+ true,+ true,+ false,+ false,+ false,+ true,+ false,+ false,+ false,+ false,+ false,+ true,+ true,+ false,+ false+ ]+ },+ "hash": "b9570b07121de0df914dd0579cc92a5e92973cf114526f80dbe7ab714493090b"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-c12b511f8fbe853ce8e5489db2468ee8a07030cb234bc0a10bc014c493b8e9c2.json b/rust/cloud-storage/soup/.sqlx/query-c12b511f8fbe853ce8e5489db2468ee8a07030cb234bc0a10bc014c493b8e9c2.jsonnew file mode 100644index 0000000000..e2aa061544--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-c12b511f8fbe853ce8e5489db2468ee8a07030cb234bc0a10bc014c493b8e9c2.json@@ -0,0 +1,31 @@+{+ "db_name": "PostgreSQL",+ "query": "DELETE FROM entity_properties WHERE entity_id = $1 AND entity_type = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ ]+ },+ "nullable": []+ },+ "hash": "c12b511f8fbe853ce8e5489db2468ee8a07030cb234bc0a10bc014c493b8e9c2"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-c33f85b35573916eb380c8b6069939087fbd3b34b296b546a34cdfc3e7c9eee0.json b/rust/cloud-storage/soup/.sqlx/query-c33f85b35573916eb380c8b6069939087fbd3b34b296b546a34cdfc3e7c9eee0.jsonnew file mode 100644index 0000000000..9da8336f8e--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-c33f85b35573916eb380c8b6069939087fbd3b34b296b546a34cdfc3e7c9eee0.json@@ -0,0 +1,14 @@+{+ "db_name": "PostgreSQL",+ "query": "\n DELETE FROM email_message_recipients\n WHERE message_id = $1\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "c33f85b35573916eb380c8b6069939087fbd3b34b296b546a34cdfc3e7c9eee0"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-c3f8291d5ce84fb1eb463eaa0f0aed0c3ac2ed1297f345941cc8c2bfdcadedd5.json b/rust/cloud-storage/soup/.sqlx/query-c3f8291d5ce84fb1eb463eaa0f0aed0c3ac2ed1297f345941cc8c2bfdcadedd5.jsonnew file mode 100644index 0000000000..d93442c86c--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-c3f8291d5ce84fb1eb463eaa0f0aed0c3ac2ed1297f345941cc8c2bfdcadedd5.json@@ -0,0 +1,53 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n m.id,\n m.thread_id,\n m.provider_thread_id,\n m.headers_jsonb,\n m.is_sent,\n m.is_draft\n FROM email_messages m\n WHERE m.link_id = $1\n AND m.is_draft = true\n AND jsonb_path_exists(\n m.headers_jsonb,\n '$[*] ? (@.\"Macro-In-Reply-To\" == $macro_uuid)'::jsonpath,\n jsonb_build_object('macro_uuid', $2::text)\n )\n ORDER BY m.created_at DESC\n LIMIT 1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "provider_thread_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "headers_jsonb",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 4,+ "name": "is_sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 5,+ "name": "is_draft",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Text"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ true,+ false,+ false+ ]+ },+ "hash": "c3f8291d5ce84fb1eb463eaa0f0aed0c3ac2ed1297f345941cc8c2bfdcadedd5"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-c4d2fed1a0fb95c20ef9b4049cc5cacfb7f0a441c630528d2cde076211ff63f9.json b/rust/cloud-storage/soup/.sqlx/query-c4d2fed1a0fb95c20ef9b4049cc5cacfb7f0a441c630528d2cde076211ff63f9.jsonnew file mode 100644index 0000000000..93c23384d7--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-c4d2fed1a0fb95c20ef9b4049cc5cacfb7f0a441c630528d2cde076211ff63f9.json@@ -0,0 +1,54 @@+{+ "db_name": "PostgreSQL",+ "query": "INSERT INTO email_filters (link_id, email_domain, is_important)\n VALUES ($1, $2, $3)\n ON CONFLICT (link_id, lower(email_domain)) WHERE email_domain IS NOT NULL\n DO UPDATE SET is_important = EXCLUDED.is_important\n RETURNING id, link_id, email_address, email_domain, is_important, created_at",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "email_address",+ "type_info": "Varchar"+ },+ {+ "ordinal": 3,+ "name": "email_domain",+ "type_info": "Varchar"+ },+ {+ "ordinal": 4,+ "name": "is_important",+ "type_info": "Bool"+ },+ {+ "ordinal": 5,+ "name": "created_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Varchar",+ "Bool"+ ]+ },+ "nullable": [+ false,+ false,+ true,+ true,+ false,+ false+ ]+ },+ "hash": "c4d2fed1a0fb95c20ef9b4049cc5cacfb7f0a441c630528d2cde076211ff63f9"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-c6f8bb6a2a9cda820cf54efb5e4ff8b048d735cfcc23716612f2ee66a8c7151c.json b/rust/cloud-storage/soup/.sqlx/query-c6f8bb6a2a9cda820cf54efb5e4ff8b048d735cfcc23716612f2ee66a8c7151c.jsonnew file mode 100644index 0000000000..c6b12842de--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-c6f8bb6a2a9cda820cf54efb5e4ff8b048d735cfcc23716612f2ee66a8c7151c.json@@ -0,0 +1,14 @@+{+ "db_name": "PostgreSQL",+ "query": "DELETE FROM property_options WHERE id = $1",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "c6f8bb6a2a9cda820cf54efb5e4ff8b048d735cfcc23716612f2ee66a8c7151c"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-c8569a737734eab039a3ca9759478b203596330442305a6f3925edf67a8b52a3.json b/rust/cloud-storage/soup/.sqlx/query-c8569a737734eab039a3ca9759478b203596330442305a6f3925edf67a8b52a3.jsonnew file mode 100644index 0000000000..dec05aa8a8--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-c8569a737734eab039a3ca9759478b203596330442305a6f3925edf67a8b52a3.json@@ -0,0 +1,84 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT id, macro_id, fusionauth_user_id, email_address, provider as \"provider: _\",\n is_sync_active, created_at, updated_at\n FROM email_links\n WHERE fusionauth_user_id = $1 AND macro_id = $2 AND provider = $3\n LIMIT 1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "macro_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "fusionauth_user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "email_address",+ "type_info": "Varchar"+ },+ {+ "ordinal": 4,+ "name": "provider: _",+ "type_info": {+ "Custom": {+ "name": "email_user_provider_enum",+ "kind": {+ "Enum": [+ "GMAIL"+ ]+ }+ }+ }+ },+ {+ "ordinal": 5,+ "name": "is_sync_active",+ "type_info": "Bool"+ },+ {+ "ordinal": 6,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "updated_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "Text",+ {+ "Custom": {+ "name": "email_user_provider_enum",+ "kind": {+ "Enum": [+ "GMAIL"+ ]+ }+ }+ }+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ false,+ false+ ]+ },+ "hash": "c8569a737734eab039a3ca9759478b203596330442305a6f3925edf67a8b52a3"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-c8e8b950c4f8645562fb36042b549b0c1f6ec3da1b9beb4d212ddd5bc640948e.json b/rust/cloud-storage/soup/.sqlx/query-c8e8b950c4f8645562fb36042b549b0c1f6ec3da1b9beb4d212ddd5bc640948e.jsonnew file mode 100644index 0000000000..c15673d65f--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-c8e8b950c4f8645562fb36042b549b0c1f6ec3da1b9beb4d212ddd5bc640948e.json@@ -0,0 +1,58 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT id, draft_id, file_name, content_type, sha, size, s3_key\n FROM email_attachments_drafts\n WHERE draft_id = ANY($1)\n ORDER BY draft_id, file_name ASC\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "draft_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "file_name",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "content_type",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "sha",+ "type_info": "Text"+ },+ {+ "ordinal": 5,+ "name": "size",+ "type_info": "Int4"+ },+ {+ "ordinal": 6,+ "name": "s3_key",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ false+ ]+ },+ "hash": "c8e8b950c4f8645562fb36042b549b0c1f6ec3da1b9beb4d212ddd5bc640948e"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-d20bc5b5dfecf0a2ef4b7d77b9090ad28584cd0a1fd24460096b6a5097a870ac.json b/rust/cloud-storage/soup/.sqlx/query-d20bc5b5dfecf0a2ef4b7d77b9090ad28584cd0a1fd24460096b6a5097a870ac.jsonnew file mode 100644index 0000000000..f3780614e0--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-d20bc5b5dfecf0a2ef4b7d77b9090ad28584cd0a1fd24460096b6a5097a870ac.json@@ -0,0 +1,97 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n un.user_id as owner_id,\n un.notification_id,\n n.event_item_id,\n n.event_item_type,\n un.sent,\n un.done,\n un.created_at::timestamptz as \"created_at!\",\n un.seen_at::timestamptz as viewed_at,\n un.created_at::timestamptz as \"updated_at!\",\n un.deleted_at::timestamptz,\n n.metadata as \"notification_metadata: serde_json::Value\",\n n.notification_event_type as notification_event_type,\n n.sender_id as sender_id\n FROM user_notification un\n JOIN notification n ON n.id = un.notification_id\n WHERE un.user_id = $1\n AND un.deleted_at IS NULL\n AND un.done = false\n AND (($3::timestamptz IS NULL)\n OR (un.created_at, un.notification_id) < ($3, $4))\n ORDER BY un.created_at DESC, un.notification_id DESC\n LIMIT $2\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "owner_id",+ "type_info": "Text"+ },+ {+ "ordinal": 1,+ "name": "notification_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "event_item_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "event_item_type",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 5,+ "name": "done",+ "type_info": "Bool"+ },+ {+ "ordinal": 6,+ "name": "created_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "viewed_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,+ "name": "updated_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "deleted_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 10,+ "name": "notification_metadata: serde_json::Value",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 11,+ "name": "notification_event_type",+ "type_info": "Varchar"+ },+ {+ "ordinal": 12,+ "name": "sender_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "Int8",+ "Timestamptz",+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ null,+ null,+ null,+ null,+ false,+ false,+ true+ ]+ },+ "hash": "d20bc5b5dfecf0a2ef4b7d77b9090ad28584cd0a1fd24460096b6a5097a870ac"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-d42e3270642ca0b9eff6b5807f600c24fd26d50d612a66edf0738c62d15680ba.json b/rust/cloud-storage/soup/.sqlx/query-d42e3270642ca0b9eff6b5807f600c24fd26d50d612a66edf0738c62d15680ba.jsonnew file mode 100644index 0000000000..563aad9bf4--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-d42e3270642ca0b9eff6b5807f600c24fd26d50d612a66edf0738c62d15680ba.json@@ -0,0 +1,64 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT *\n FROM\n frecency_events\n WHERE was_processed = false\n LIMIT $1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Int8"+ },+ {+ "ordinal": 1,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "entity_type",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "event_type",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "timestamp",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "connection_id",+ "type_info": "Text"+ },+ {+ "ordinal": 6,+ "name": "entity_id",+ "type_info": "Text"+ },+ {+ "ordinal": 7,+ "name": "was_processed",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Int8"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ false,+ false+ ]+ },+ "hash": "d42e3270642ca0b9eff6b5807f600c24fd26d50d612a66edf0738c62d15680ba"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-d501983b009e4418f1753f03db0ea12db11f18e4a89a76c87b4c8ddda431cbdb.json b/rust/cloud-storage/soup/.sqlx/query-d501983b009e4418f1753f03db0ea12db11f18e4a89a76c87b4c8ddda431cbdb.jsonnew file mode 100644index 0000000000..07bca28bb4--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-d501983b009e4418f1753f03db0ea12db11f18e4a89a76c87b4c8ddda431cbdb.json@@ -0,0 +1,101 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT DISTINCT ON (l.id, m.thread_id)\n l.id,\n m.thread_id as \"thread_id!\",\n l.link_id,\n l.provider_label_id,\n l.name,\n l.created_at,\n l.message_list_visibility as \"message_list_visibility: _\",\n l.label_list_visibility as \"label_list_visibility: _\",\n l.type as \"type_: _\"\n FROM\n email_messages m\n JOIN email_message_labels ml ON m.id = ml.message_id\n JOIN email_labels l ON ml.label_id = l.id\n WHERE m.thread_id = ANY($1)\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "thread_id!",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 3,+ "name": "provider_label_id",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "name",+ "type_info": "Varchar"+ },+ {+ "ordinal": 5,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "message_list_visibility: _",+ "type_info": {+ "Custom": {+ "name": "email_message_list_visibility_enum",+ "kind": {+ "Enum": [+ "Show",+ "Hide"+ ]+ }+ }+ }+ },+ {+ "ordinal": 7,+ "name": "label_list_visibility: _",+ "type_info": {+ "Custom": {+ "name": "email_label_list_visibility_enum",+ "kind": {+ "Enum": [+ "LabelShow",+ "LabelShowIfUnread",+ "LabelHide"+ ]+ }+ }+ }+ },+ {+ "ordinal": 8,+ "name": "type_: _",+ "type_info": {+ "Custom": {+ "name": "email_label_type_enum",+ "kind": {+ "Enum": [+ "System",+ "User"+ ]+ }+ }+ }+ }+ ],+ "parameters": {+ "Left": [+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ false,+ false,+ false+ ]+ },+ "hash": "d501983b009e4418f1753f03db0ea12db11f18e4a89a76c87b4c8ddda431cbdb"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-d536db3ccfb32aee9a48227e2b15d2404023ea24b62c159466c95899d76e29ed.json b/rust/cloud-storage/soup/.sqlx/query-d536db3ccfb32aee9a48227e2b15d2404023ea24b62c159466c95899d76e29ed.jsonnew file mode 100644index 0000000000..6ef8856744--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-d536db3ccfb32aee9a48227e2b15d2404023ea24b62c159466c95899d76e29ed.json@@ -0,0 +1,24 @@+{+ "db_name": "PostgreSQL",+ "query": "\n WITH RECURSIVE project_hierarchy AS (\n SELECT p.id as project_id\n FROM email_threads t\n JOIN \"Project\" p ON t.project_id = p.id AND p.\"deletedAt\" IS NULL\n WHERE t.id = $1\n UNION ALL\n SELECT parent.id as project_id\n FROM project_hierarchy ph\n JOIN \"Project\" parent ON parent.id = (\n SELECT \"parentId\" FROM \"Project\" WHERE id = ph.project_id AND \"parentId\" IS NOT NULL AND \"deletedAt\" IS NULL\n )\n )\n SELECT access_level FROM (\n -- Source 1: Cast the AccessLevel enum to text.\n SELECT access_level::text FROM \"UserItemAccess\"\n WHERE user_id = $3 AND item_id IN (\n SELECT $2 -- The thread ID as text\n UNION\n SELECT project_id FROM project_hierarchy -- All parent projects\n )\n UNION ALL\n -- Source 2: Select the publicAccessLevel (which is already text).\n SELECT \"publicAccessLevel\" as access_level\n FROM \"SharePermission\"\n WHERE \"isPublic\" = true AND \"publicAccessLevel\" IS NOT NULL AND id IN (\n SELECT \"sharePermissionId\" FROM \"EmailThreadPermission\" WHERE \"threadId\" = $2\n UNION\n SELECT \"sharePermissionId\" FROM \"ProjectPermission\" WHERE \"projectId\" IN (SELECT project_id FROM project_hierarchy)\n )\n ) as all_levels\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "access_level",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Text",+ "Text"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "d536db3ccfb32aee9a48227e2b15d2404023ea24b62c159466c95899d76e29ed"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-d9956cd2e52cda4f0e7c080058d33f2bbf35c99b29e7482f198d592ff435cf28.json b/rust/cloud-storage/soup/.sqlx/query-d9956cd2e52cda4f0e7c080058d33f2bbf35c99b29e7482f198d592ff435cf28.jsonnew file mode 100644index 0000000000..6790b93ff8--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-d9956cd2e52cda4f0e7c080058d33f2bbf35c99b29e7482f198d592ff435cf28.json@@ -0,0 +1,82 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT t.id, t.provider_id, t.link_id, t.inbox_visible, t.is_read,\n t.latest_inbound_message_ts, t.latest_outbound_message_ts,\n t.latest_non_spam_message_ts, t.created_at, t.updated_at,\n t.project_id\n FROM email_threads t\n WHERE t.id = $1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 3,+ "name": "inbox_visible",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 5,+ "name": "latest_inbound_message_ts",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "latest_outbound_message_ts",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "latest_non_spam_message_ts",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 10,+ "name": "project_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ false,+ false,+ true,+ true,+ true,+ false,+ false,+ true+ ]+ },+ "hash": "d9956cd2e52cda4f0e7c080058d33f2bbf35c99b29e7482f198d592ff435cf28"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-db297e24e3ed1e94c27121977d81813bbe4cde5e5b7bec42e424c72db0e27e73.json b/rust/cloud-storage/soup/.sqlx/query-db297e24e3ed1e94c27121977d81813bbe4cde5e5b7bec42e424c72db0e27e73.jsonnew file mode 100644index 0000000000..d197caf563--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-db297e24e3ed1e94c27121977d81813bbe4cde5e5b7bec42e424c72db0e27e73.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT user_id FROM user_notification_type_preference\n WHERE notification_event_type = $1 AND user_id = ANY($2)\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "user_id",+ "type_info": "Text"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "TextArray"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "db297e24e3ed1e94c27121977d81813bbe4cde5e5b7bec42e424c72db0e27e73"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-dc836e7dd12a3df4a05ba072af32cb1aca7d6b8c20e636adff6fb3977577e62a.json b/rust/cloud-storage/soup/.sqlx/query-dc836e7dd12a3df4a05ba072af32cb1aca7d6b8c20e636adff6fb3977577e62a.jsonnew file mode 100644index 0000000000..2ce75f867a--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-dc836e7dd12a3df4a05ba072af32cb1aca7d6b8c20e636adff6fb3977577e62a.json@@ -0,0 +1,52 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n t.id,\n t.latest_inbound_message_ts as last_received,\n t.latest_outbound_message_ts as last_sent,\n first_msg.internal_date_ts as thread_started,\n first_msg.subject,\n (SELECT COUNT(*)::bigint FROM email_messages WHERE thread_id = t.id) as \"message_count!\"\n FROM\n email_threads t\n -- LATERAL join to get subject and timestamp from the first message\n LEFT JOIN LATERAL (\n SELECT internal_date_ts, subject\n FROM email_messages\n WHERE thread_id = t.id\n ORDER BY internal_date_ts ASC NULLS LAST\n LIMIT 1\n ) first_msg ON true\n WHERE\n t.id = $1\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "last_received",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 2,+ "name": "last_sent",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 3,+ "name": "thread_started",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 4,+ "name": "subject",+ "type_info": "Text"+ },+ {+ "ordinal": 5,+ "name": "message_count!",+ "type_info": "Int8"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ false,+ true,+ true,+ true,+ true,+ null+ ]+ },+ "hash": "dc836e7dd12a3df4a05ba072af32cb1aca7d6b8c20e636adff6fb3977577e62a"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-dfc54abc6dd32c35bf3d3c65288ead04d9990d5f6613bd7668dd7cba38ebe3a5.json b/rust/cloud-storage/soup/.sqlx/query-dfc54abc6dd32c35bf3d3c65288ead04d9990d5f6613bd7668dd7cba38ebe3a5.jsonnew file mode 100644index 0000000000..f8ffb29abe--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-dfc54abc6dd32c35bf3d3c65288ead04d9990d5f6613bd7668dd7cba38ebe3a5.json@@ -0,0 +1,149 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n m.id,\n m.provider_id,\n m.thread_id,\n m.provider_thread_id,\n m.replying_to_id,\n m.global_id,\n m.link_id,\n m.subject,\n m.snippet,\n m.from_contact_id,\n m.provider_history_id,\n m.internal_date_ts,\n m.sent_at,\n m.size_estimate,\n m.is_read,\n m.is_starred,\n m.is_sent,\n m.is_draft,\n m.has_attachments,\n m.headers_jsonb,\n m.created_at,\n m.updated_at\n FROM email_messages m\n WHERE m.thread_id = $1 AND m.link_id = $2\n ORDER BY m.internal_date_ts DESC NULLS LAST\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 3,+ "name": "provider_thread_id",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "replying_to_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 5,+ "name": "global_id",+ "type_info": "Text"+ },+ {+ "ordinal": 6,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 7,+ "name": "subject",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "snippet",+ "type_info": "Text"+ },+ {+ "ordinal": 9,+ "name": "from_contact_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 10,+ "name": "provider_history_id",+ "type_info": "Text"+ },+ {+ "ordinal": 11,+ "name": "internal_date_ts",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 12,+ "name": "sent_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 13,+ "name": "size_estimate",+ "type_info": "Int8"+ },+ {+ "ordinal": 14,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 15,+ "name": "is_starred",+ "type_info": "Bool"+ },+ {+ "ordinal": 16,+ "name": "is_sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 17,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 18,+ "name": "has_attachments",+ "type_info": "Bool"+ },+ {+ "ordinal": 19,+ "name": "headers_jsonb",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 20,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 21,+ "name": "updated_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ true,+ true,+ true,+ false,+ true,+ true,+ true,+ true,+ true,+ true,+ true,+ false,+ false,+ false,+ false,+ false,+ true,+ false,+ false+ ]+ },+ "hash": "dfc54abc6dd32c35bf3d3c65288ead04d9990d5f6613bd7668dd7cba38ebe3a5"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-e0b90388e3a9f7dbd1e6586cb0633b0d2d39d64dcc88a0f0c5cd310303e7dc92.json b/rust/cloud-storage/soup/.sqlx/query-e0b90388e3a9f7dbd1e6586cb0633b0d2d39d64dcc88a0f0c5cd310303e7dc92.jsonnew file mode 100644index 0000000000..a6d8c54236--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-e0b90388e3a9f7dbd1e6586cb0633b0d2d39d64dcc88a0f0c5cd310303e7dc92.json@@ -0,0 +1,140 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO property_definitions (\n id,\n organization_id, \n user_id, \n display_name, \n data_type, \n is_multi_select,\n specific_entity_type\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING \n id,\n organization_id,\n user_id,\n display_name,\n data_type as \"data_type: DataType\",\n is_multi_select,\n specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n created_at,\n updated_at\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "organization_id",+ "type_info": "Int4"+ },+ {+ "ordinal": 2,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "display_name",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "data_type: DataType",+ "type_info": {+ "Custom": {+ "name": "property_data_type",+ "kind": {+ "Enum": [+ "BOOLEAN",+ "DATE",+ "NUMBER",+ "STRING",+ "SELECT_NUMBER",+ "SELECT_STRING",+ "ENTITY",+ "LINK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 5,+ "name": "is_multi_select",+ "type_info": "Bool"+ },+ {+ "ordinal": 6,+ "name": "specific_entity_type: Option<EntityType>",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 7,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 8,+ "name": "updated_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int4",+ "Text",+ "Text",+ {+ "Custom": {+ "name": "property_data_type",+ "kind": {+ "Enum": [+ "BOOLEAN",+ "DATE",+ "NUMBER",+ "STRING",+ "SELECT_NUMBER",+ "SELECT_STRING",+ "ENTITY",+ "LINK"+ ]+ }+ }+ },+ "Bool",+ {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ ]+ },+ "nullable": [+ false,+ true,+ true,+ false,+ false,+ false,+ true,+ false,+ false+ ]+ },+ "hash": "e0b90388e3a9f7dbd1e6586cb0633b0d2d39d64dcc88a0f0c5cd310303e7dc92"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-e3502d4611d734fa9d27c17c3adb0785d06317da255894345de287a654f24fc3.json b/rust/cloud-storage/soup/.sqlx/query-e3502d4611d734fa9d27c17c3adb0785d06317da255894345de287a654f24fc3.jsonnew file mode 100644index 0000000000..1bb390dc5d--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-e3502d4611d734fa9d27c17c3adb0785d06317da255894345de287a654f24fc3.json@@ -0,0 +1,14 @@+{+ "db_name": "PostgreSQL",+ "query": "DELETE FROM property_definitions WHERE id = $1",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "e3502d4611d734fa9d27c17c3adb0785d06317da255894345de287a654f24fc3"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-e4e4c79727e7a83f2dfbb1d82a00a771eb3bd08aab63d2be4a1338fbde315f62.json b/rust/cloud-storage/soup/.sqlx/query-e4e4c79727e7a83f2dfbb1d82a00a771eb3bd08aab63d2be4a1338fbde315f62.jsonnew file mode 100644index 0000000000..f0ae8ed700--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-e4e4c79727e7a83f2dfbb1d82a00a771eb3bd08aab63d2be4a1338fbde315f62.json@@ -0,0 +1,66 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT *\n FROM frecency_aggregates\n WHERE user_id = $1 AND ($2::float8 IS NULL OR frecency_score < $2)\n ORDER BY frecency_score DESC\n LIMIT $3\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Int8"+ },+ {+ "ordinal": 1,+ "name": "entity_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "entity_type",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "event_count",+ "type_info": "Int4"+ },+ {+ "ordinal": 5,+ "name": "frecency_score",+ "type_info": "Float8"+ },+ {+ "ordinal": 6,+ "name": "first_event",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "recent_events",+ "type_info": "Jsonb"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "Float8",+ "Int8"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ false,+ false,+ false,+ false+ ]+ },+ "hash": "e4e4c79727e7a83f2dfbb1d82a00a771eb3bd08aab63d2be4a1338fbde315f62"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-e70d5acce88125ae894d9d57356559c6e59e236c9650211a52fdc90602318cc3.json b/rust/cloud-storage/soup/.sqlx/query-e70d5acce88125ae894d9d57356559c6e59e236c9650211a52fdc90602318cc3.jsonnew file mode 100644index 0000000000..3ace0da282--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-e70d5acce88125ae894d9d57356559c6e59e236c9650211a52fdc90602318cc3.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "DELETE FROM email_filters WHERE id = $1 AND link_id = $2",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Uuid"+ ]+ },+ "nullable": []+ },+ "hash": "e70d5acce88125ae894d9d57356559c6e59e236c9650211a52fdc90602318cc3"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-e7e9e2db72c9bf45273b0cfe11057a5dbce790572f2420457e24b0fd498c2024.json b/rust/cloud-storage/soup/.sqlx/query-e7e9e2db72c9bf45273b0cfe11057a5dbce790572f2420457e24b0fd498c2024.jsonnew file mode 100644index 0000000000..5d51a7025e--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-e7e9e2db72c9bf45273b0cfe11057a5dbce790572f2420457e24b0fd498c2024.json@@ -0,0 +1,29 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO email_threads (id, provider_id, link_id, inbox_visible, is_read,\n latest_inbound_message_ts, latest_outbound_message_ts,\n latest_non_spam_message_ts)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8)\n ON CONFLICT (link_id, provider_id) WHERE provider_id IS NOT NULL DO UPDATE\n SET\n latest_inbound_message_ts = EXCLUDED.latest_inbound_message_ts,\n updated_at = NOW()\n RETURNING id\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Text",+ "Uuid",+ "Bool",+ "Bool",+ "Timestamptz",+ "Timestamptz",+ "Timestamptz"+ ]+ },+ "nullable": [+ false+ ]+ },+ "hash": "e7e9e2db72c9bf45273b0cfe11057a5dbce790572f2420457e24b0fd498c2024"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-ec772d88365b803914f51dbe270f14ab6cdd2fe57c9d76e430cfef7234e92168.json b/rust/cloud-storage/soup/.sqlx/query-ec772d88365b803914f51dbe270f14ab6cdd2fe57c9d76e430cfef7234e92168.jsonnew file mode 100644index 0000000000..65e2bc75d4--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-ec772d88365b803914f51dbe270f14ab6cdd2fe57c9d76e430cfef7234e92168.json@@ -0,0 +1,20 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO frecency_events (\n user_id,\n entity_type,\n event_type,\n timestamp,\n connection_id,\n entity_id,\n was_processed\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "Text",+ "Text",+ "Timestamptz",+ "Text",+ "Text",+ "Bool"+ ]+ },+ "nullable": []+ },+ "hash": "ec772d88365b803914f51dbe270f14ab6cdd2fe57c9d76e430cfef7234e92168"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-edce1ca1979c9bd7c42f7e89d80a8d25037d25951b1f406dddb8d62cc13f74f0.json b/rust/cloud-storage/soup/.sqlx/query-edce1ca1979c9bd7c42f7e89d80a8d25037d25951b1f406dddb8d62cc13f74f0.jsonnew file mode 100644index 0000000000..13653d45bf--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-edce1ca1979c9bd7c42f7e89d80a8d25037d25951b1f406dddb8d62cc13f74f0.json@@ -0,0 +1,185 @@+{+ "db_name": "PostgreSQL",+ "query": "\nSELECT\n ep.id as entity_property_id,\n ep.entity_id,\n ep.entity_type as \"entity_type: EntityType\",\n ep.property_definition_id,\n ep.values as \"values: sqlx::types::JsonValue\",\n ep.created_at as entity_property_created_at,\n ep.updated_at as entity_property_updated_at,\n pd.organization_id as definition_organization_id,\n pd.user_id as definition_user_id,\n pd.display_name,\n pd.data_type as \"data_type: DataType\",\n pd.is_multi_select,\n pd.specific_entity_type as \"specific_entity_type: Option<EntityType>\",\n pd.created_at as definition_created_at,\n pd.updated_at as definition_updated_at,\n pd.is_system as definition_is_system\nFROM entity_properties ep\nINNER JOIN property_definitions pd ON ep.property_definition_id = pd.id\nWHERE (ep.entity_id, ep.entity_type) IN (\n SELECT * FROM UNNEST($1::TEXT[], $2::property_entity_type[])\n)\nAND pd.id = ANY($3::UUID[])\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "entity_property_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "entity_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "entity_type: EntityType",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 3,+ "name": "property_definition_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 4,+ "name": "values: sqlx::types::JsonValue",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 5,+ "name": "entity_property_created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "entity_property_updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 7,+ "name": "definition_organization_id",+ "type_info": "Int4"+ },+ {+ "ordinal": 8,+ "name": "definition_user_id",+ "type_info": "Text"+ },+ {+ "ordinal": 9,+ "name": "display_name",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "data_type: DataType",+ "type_info": {+ "Custom": {+ "name": "property_data_type",+ "kind": {+ "Enum": [+ "BOOLEAN",+ "DATE",+ "NUMBER",+ "STRING",+ "SELECT_NUMBER",+ "SELECT_STRING",+ "ENTITY",+ "LINK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 11,+ "name": "is_multi_select",+ "type_info": "Bool"+ },+ {+ "ordinal": 12,+ "name": "specific_entity_type: Option<EntityType>",+ "type_info": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ },+ {+ "ordinal": 13,+ "name": "definition_created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 14,+ "name": "definition_updated_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 15,+ "name": "definition_is_system",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "TextArray",+ {+ "Custom": {+ "name": "property_entity_type[]",+ "kind": {+ "Array": {+ "Custom": {+ "name": "property_entity_type",+ "kind": {+ "Enum": [+ "CHANNEL",+ "CHAT",+ "DOCUMENT",+ "PROJECT",+ "THREAD",+ "USER",+ "COMPANY",+ "TASK"+ ]+ }+ }+ }+ }+ }+ },+ "UuidArray"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ true,+ false,+ false,+ true,+ true,+ false,+ false,+ false,+ true,+ false,+ false,+ false+ ]+ },+ "hash": "edce1ca1979c9bd7c42f7e89d80a8d25037d25951b1f406dddb8d62cc13f74f0"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-efc740cd935fb67ef5c2a75b3c37cf16bf09d6e52e5f6e5c5b107ef8244a141d.json b/rust/cloud-storage/soup/.sqlx/query-efc740cd935fb67ef5c2a75b3c37cf16bf09d6e52e5f6e5c5b107ef8244a141d.jsonnew file mode 100644index 0000000000..1cbb49a96b--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-efc740cd935fb67ef5c2a75b3c37cf16bf09d6e52e5f6e5c5b107ef8244a141d.json@@ -0,0 +1,23 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO user_notification (notification_id, user_id)\n SELECT $1, user_id\n FROM UNNEST($2::text[]) as user_id\n RETURNING created_at::timestamptz as \"created_at!\"\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "created_at!",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "TextArray"+ ]+ },+ "nullable": [+ null+ ]+ },+ "hash": "efc740cd935fb67ef5c2a75b3c37cf16bf09d6e52e5f6e5c5b107ef8244a141d"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-f2d5d7aea9918978cd69c14f8afe24156c2fa387e001ee8eaf57e4a70a106069.json b/rust/cloud-storage/soup/.sqlx/query-f2d5d7aea9918978cd69c14f8afe24156c2fa387e001ee8eaf57e4a70a106069.jsonnew file mode 100644index 0000000000..182e0858ba--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-f2d5d7aea9918978cd69c14f8afe24156c2fa387e001ee8eaf57e4a70a106069.json@@ -0,0 +1,18 @@+{+ "db_name": "PostgreSQL",+ "query": "\n INSERT INTO entity_properties (id, entity_id, entity_type, property_definition_id, values)\n SELECT \n u.id,\n u.entity_id,\n u.entity_type::property_entity_type,\n u.property_definition_id,\n u.values\n FROM UNNEST(\n $1::UUID[],\n $2::TEXT[],\n $3::TEXT[],\n $4::UUID[],\n $5::JSONB[]\n ) AS u(id, entity_id, entity_type, property_definition_id, values)\n ON CONFLICT (entity_id, entity_type, property_definition_id)\n DO UPDATE SET \n values = EXCLUDED.values,\n updated_at = NOW()\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "UuidArray",+ "TextArray",+ "TextArray",+ "UuidArray",+ "JsonbArray"+ ]+ },+ "nullable": []+ },+ "hash": "f2d5d7aea9918978cd69c14f8afe24156c2fa387e001ee8eaf57e4a70a106069"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-f3e53dd531be738b881df199783a2beded3bd378038cbd6f012080ac77c5291b.json b/rust/cloud-storage/soup/.sqlx/query-f3e53dd531be738b881df199783a2beded3bd378038cbd6f012080ac77c5291b.jsonnew file mode 100644index 0000000000..39180b3b0f--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-f3e53dd531be738b881df199783a2beded3bd378038cbd6f012080ac77c5291b.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "\n UPDATE user_notification\n SET deleted_at = NOW()\n WHERE user_id = $1 AND notification_id = ANY($2)\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text",+ "UuidArray"+ ]+ },+ "nullable": []+ },+ "hash": "f3e53dd531be738b881df199783a2beded3bd378038cbd6f012080ac77c5291b"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-f95b295c9ffa7b96a7907c43c0557d60af3f02fc72c3f541bc94c903034a6748.json b/rust/cloud-storage/soup/.sqlx/query-f95b295c9ffa7b96a7907c43c0557d60af3f02fc72c3f541bc94c903034a6748.jsonnew file mode 100644index 0000000000..8f396b9fba--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-f95b295c9ffa7b96a7907c43c0557d60af3f02fc72c3f541bc94c903034a6748.json@@ -0,0 +1,162 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n id, provider_id, thread_id, provider_thread_id, replying_to_id,\n global_id, link_id, provider_history_id, internal_date_ts, snippet,\n size_estimate, subject, sent_at, has_attachments, is_read, is_starred,\n is_sent, is_draft, body_text, body_html_sanitized, body_macro,\n headers_jsonb, created_at, updated_at\n FROM email_messages\n WHERE thread_id = $1\n ORDER BY internal_date_ts DESC\n LIMIT $2 OFFSET $3\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 2,+ "name": "thread_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 3,+ "name": "provider_thread_id",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "replying_to_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 5,+ "name": "global_id",+ "type_info": "Text"+ },+ {+ "ordinal": 6,+ "name": "link_id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 7,+ "name": "provider_history_id",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "internal_date_ts",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 9,+ "name": "snippet",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "size_estimate",+ "type_info": "Int8"+ },+ {+ "ordinal": 11,+ "name": "subject",+ "type_info": "Text"+ },+ {+ "ordinal": 12,+ "name": "sent_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 13,+ "name": "has_attachments",+ "type_info": "Bool"+ },+ {+ "ordinal": 14,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 15,+ "name": "is_starred",+ "type_info": "Bool"+ },+ {+ "ordinal": 16,+ "name": "is_sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 17,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 18,+ "name": "body_text",+ "type_info": "Text"+ },+ {+ "ordinal": 19,+ "name": "body_html_sanitized",+ "type_info": "Text"+ },+ {+ "ordinal": 20,+ "name": "body_macro",+ "type_info": "Text"+ },+ {+ "ordinal": 21,+ "name": "headers_jsonb",+ "type_info": "Jsonb"+ },+ {+ "ordinal": 22,+ "name": "created_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 23,+ "name": "updated_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid",+ "Int8",+ "Int8"+ ]+ },+ "nullable": [+ false,+ true,+ false,+ true,+ true,+ true,+ false,+ true,+ true,+ true,+ true,+ true,+ true,+ false,+ false,+ false,+ false,+ false,+ true,+ true,+ true,+ true,+ false,+ false+ ]+ },+ "hash": "f95b295c9ffa7b96a7907c43c0557d60af3f02fc72c3f541bc94c903034a6748"+}diff --git a/rust/cloud-storage/soup/.sqlx/query-fc6df4dc3c0f82de02b70975338d7455df93799b12af38d50bb85d81391861c3.json b/rust/cloud-storage/soup/.sqlx/query-fc6df4dc3c0f82de02b70975338d7455df93799b12af38d50bb85d81391861c3.jsonnew file mode 100644index 0000000000..ca1b2f5d86--- /dev/null+++ b/rust/cloud-storage/soup/.sqlx/query-fc6df4dc3c0f82de02b70975338d7455df93799b12af38d50bb85d81391861c3.json@@ -0,0 +1,58 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n id, is_draft, is_sent, is_read, provider_id,\n internal_date_ts, updated_at\n FROM email_messages\n WHERE thread_id = $1\n ORDER BY internal_date_ts DESC NULLS LAST\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "id",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "is_draft",+ "type_info": "Bool"+ },+ {+ "ordinal": 2,+ "name": "is_sent",+ "type_info": "Bool"+ },+ {+ "ordinal": 3,+ "name": "is_read",+ "type_info": "Bool"+ },+ {+ "ordinal": 4,+ "name": "provider_id",+ "type_info": "Text"+ },+ {+ "ordinal": 5,+ "name": "internal_date_ts",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "updated_at",+ "type_info": "Timestamptz"+ }+ ],+ "parameters": {+ "Left": [+ "Uuid"+ ]+ },+ "nullable": [+ false,+ false,+ false,+ false,+ true,+ true,+ false+ ]+ },+ "hash": "fc6df4dc3c0f82de02b70975338d7455df93799b12af38d50bb85d81391861c3"+}diff --git a/rust/cloud-storage/soup/src/domain/service.rs b/rust/cloud-storage/soup/src/domain/service.rsindex 87b11fdc44..656c3c1bd7 100644--- a/rust/cloud-storage/soup/src/domain/service.rs+++ b/rust/cloud-storage/soup/src/domain/service.rs@@ -364,14 +364,16 @@ wherereturn Ok(Either::Left(None.into_iter()));};+ let user_id = req.user_id.as_ref().to_string();+Ok(Either::Right(self.call_record_service.get_user_call_records(req).await.map_err(|_| SoupErr::CallErr).map(|records| {- records.into_iter().map(|record| {- let soup_record = SoupCallRecord::from(record);+ records.into_iter().map(move |record| {+ let soup_record = SoupCallRecord::from_record_for_user(record, &user_id);FrecencySoupItem {item: SoupItem::CallRecord(soup_record),frecency_score: None,