Skip to content

armgit / macro

Public Imported from GitHub
0

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

chore: remove macrotation table (#2206)

Will Hutchinson5a7489bf4aea
diff --git a/rust/cloud-storage/document_storage_service_client/src/notification.rs b/rust/cloud-storage/document_storage_service_client/src/notification.rs
index 2447911446..981bf26da4 100644
--- a/rust/cloud-storage/document_storage_service_client/src/notification.rs
+++ b/rust/cloud-storage/document_storage_service_client/src/notification.rs
@@ -3,68 +3,6 @@ use crate::error::{DssClientError, GenericErrorResponse};
use super::DocumentStorageServiceClient;
impl DocumentStorageServiceClient {
- /// Gets the users that need to be notified for a given macrotation
- #[tracing::instrument(skip(self))]
- pub async fn get_macrotation_notification_users(
- &self,
- macrotation_id: &str,
- ) -> Result<Vec<String>, DssClientError> {
- let res = self
- .client
- .get(format!(
- "{}/internal/notifications/macrotation/{macrotation_id}",
- self.url
- ))
- .send()
- .await
- .map_err(|e| DssClientError::RequestBuildError {
- details: e.to_string(),
- })?;
-
- match res.status() {
- reqwest::StatusCode::OK => {
- tracing::trace!("macrotation notification users retrieved");
- let result = res.json::<Vec<String>>().await.map_err(|e| {
- DssClientError::Generic(GenericErrorResponse {
- message: e.to_string(),
- })
- })?;
-
- Ok(result)
- }
- reqwest::StatusCode::UNAUTHORIZED => {
- tracing::error!("unauthorized");
- Err(DssClientError::Unauthorized)
- }
- reqwest::StatusCode::NOT_FOUND => {
- tracing::error!("not found");
- Err(DssClientError::NotFound)
- }
- reqwest::StatusCode::INTERNAL_SERVER_ERROR => {
- tracing::error!("internal server error");
- let error_message = res.text().await.map_err(|e| {
- DssClientError::Generic(GenericErrorResponse {
- message: e.to_string(),
- })
- })?;
-
- Err(DssClientError::InternalServerError {
- details: error_message,
- })
- }
- _ => {
- let body = res.text().await.map_err(|e| {
- DssClientError::Generic(GenericErrorResponse {
- message: e.to_string(),
- })
- })?;
-
- Err(DssClientError::Generic(GenericErrorResponse {
- message: body,
- }))
- }
- }
- }
/// Gets the users that need to be notified for a given document
#[tracing::instrument(skip(self))]
pub async fn get_document_notification_users(
diff --git a/rust/cloud-storage/macro_db_client/.sqlx/query-1435acbba365796ddcb6ddbef86f4ebf664cffc44082996f6b60a60373c28f75.json b/rust/cloud-storage/macro_db_client/.sqlx/query-1435acbba365796ddcb6ddbef86f4ebf664cffc44082996f6b60a60373c28f75.json
deleted file mode 100644
index d2b084cf10..0000000000
--- a/rust/cloud-storage/macro_db_client/.sqlx/query-1435acbba365796ddcb6ddbef86f4ebf664cffc44082996f6b60a60373c28f75.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "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/macro_db_client/.sqlx/query-63492b018803ce26db5891964a0f52f37d2f54bd8243265c6561f4423af8617c.json b/rust/cloud-storage/macro_db_client/.sqlx/query-63492b018803ce26db5891964a0f52f37d2f54bd8243265c6561f4423af8617c.json
deleted file mode 100644
index 6d97183829..0000000000
--- a/rust/cloud-storage/macro_db_client/.sqlx/query-63492b018803ce26db5891964a0f52f37d2f54bd8243265c6561f4423af8617c.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "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/macro_db_client/.sqlx/query-8d21bf0aa4c20589a55cf5777aa9c658fdacea4d0d0c7070aded12cccd373911.json b/rust/cloud-storage/macro_db_client/.sqlx/query-8d21bf0aa4c20589a55cf5777aa9c658fdacea4d0d0c7070aded12cccd373911.json
deleted file mode 100644
index 505a2bd912..0000000000
--- a/rust/cloud-storage/macro_db_client/.sqlx/query-8d21bf0aa4c20589a55cf5777aa9c658fdacea4d0d0c7070aded12cccd373911.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "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/macro_db_client/.sqlx/query-9cd40fbb1ade51e9e0d49792839d1a363cada017252a6f653c2272608189bcc4.json b/rust/cloud-storage/macro_db_client/.sqlx/query-9cd40fbb1ade51e9e0d49792839d1a363cada017252a6f653c2272608189bcc4.json
deleted file mode 100644
index 9d717fa5f9..0000000000
--- a/rust/cloud-storage/macro_db_client/.sqlx/query-9cd40fbb1ade51e9e0d49792839d1a363cada017252a6f653c2272608189bcc4.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "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/macro_db_client/.sqlx/query-a0d7360472b80bff4330d4b0a8b3957afff34445002de70115fab52d9d4ceb40.json b/rust/cloud-storage/macro_db_client/.sqlx/query-a0d7360472b80bff4330d4b0a8b3957afff34445002de70115fab52d9d4ceb40.json
deleted file mode 100644
index e823a7982b..0000000000
--- a/rust/cloud-storage/macro_db_client/.sqlx/query-a0d7360472b80bff4330d4b0a8b3957afff34445002de70115fab52d9d4ceb40.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n SELECT\n u.\"id\" as id\n FROM \"Macrotation\" ma\n INNER JOIN \"Document\" d ON d.id = ma.\"documentId\"\n INNER JOIN \"UserHistory\" uh ON uh.\"itemId\" = d.\"id\" AND uh.\"itemType\" = 'document'\n INNER JOIN \"User\" u ON u.id = uh.\"userId\"\n WHERE ma.id = $1 AND u.id != ma.\"userId\"\n ",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "id",
- "type_info": "Text"
- }
- ],
- "parameters": {
- "Left": [
- "Text"
- ]
- },
- "nullable": [
- false
- ]
- },
- "hash": "a0d7360472b80bff4330d4b0a8b3957afff34445002de70115fab52d9d4ceb40"
-}
diff --git a/rust/cloud-storage/macro_db_client/.sqlx/query-cf71680da3444f573f4cddf66b6269bfe31aeee4bbec34b7e6067a855e28f2b7.json b/rust/cloud-storage/macro_db_client/.sqlx/query-cf71680da3444f573f4cddf66b6269bfe31aeee4bbec34b7e6067a855e28f2b7.json
deleted file mode 100644
index 9dc9838dc0..0000000000
--- a/rust/cloud-storage/macro_db_client/.sqlx/query-cf71680da3444f573f4cddf66b6269bfe31aeee4bbec34b7e6067a855e28f2b7.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n UPDATE entity_properties\n SET values = $2\n WHERE entity_id = $1;\n ",
- "describe": {
- "columns": [],
- "parameters": {
- "Left": [
- "Text",
- "Jsonb"
- ]
- },
- "nullable": []
- },
- "hash": "cf71680da3444f573f4cddf66b6269bfe31aeee4bbec34b7e6067a855e28f2b7"
-}
diff --git a/rust/cloud-storage/macro_db_client/.sqlx/query-f2d5d7aea9918978cd69c14f8afe24156c2fa387e001ee8eaf57e4a70a106069.json b/rust/cloud-storage/macro_db_client/.sqlx/query-f2d5d7aea9918978cd69c14f8afe24156c2fa387e001ee8eaf57e4a70a106069.json
deleted file mode 100644
index 182e0858ba..0000000000
--- a/rust/cloud-storage/macro_db_client/.sqlx/query-f2d5d7aea9918978cd69c14f8afe24156c2fa387e001ee8eaf57e4a70a106069.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "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/macro_db_client/fixtures/macrotations.sql b/rust/cloud-storage/macro_db_client/fixtures/macrotations.sql
deleted file mode 100644
index 817d42d687..0000000000
--- a/rust/cloud-storage/macro_db_client/fixtures/macrotations.sql
+++ /dev/null
@@ -1,247 +0,0 @@
-INSERT INTO public."macro_user" ("id", "username", "email", "stripe_customer_id") VALUES
- ('a1111111-1111-1111-1111-111111111111', 'user', '[email protected]', 'stripe_id'),
- ('a2222222-2222-2222-2222-222222222222', 'user2', '[email protected]', 'stripe_id2');
-
-INSERT INTO
- public."User" ("id", "email", "stripeCustomerId", "macro_user_id") (
- SELECT
- 'stripe_id',
- 'a1111111-1111-1111-1111-111111111111'
- );
-
-INSERT INTO
- public."User" ("id", "email", "stripeCustomerId", "macro_user_id") (
- SELECT
- 'stripe_id2',
- 'a2222222-2222-2222-2222-222222222222'
- );
-
-INSERT INTO
- public."Document" (
- "id",
- "name",
- "fileType",
- "owner",
- "createdAt",
- "updatedAt"
- ) (
- SELECT
- 'document-one',
- 'test_document_name',
- 'pdf',
- '2019-10-16 00:00:00',
- '2019-10-16 00:00:00'
- );
-
-INSERT INTO
- public."Document" (
- "id",
- "name",
- "fileType",
- "owner",
- "createdAt",
- "updatedAt"
- ) (
- SELECT
- 'document-two',
- 'test_document_name',
- 'pdf',
- '2019-10-16 00:00:00',
- '2019-10-16 00:00:00'
- );
-
-INSERT INTO
- public."UserHistory" (
- "userId",
- "itemId",
- "itemType",
- "createdAt",
- "updatedAt"
- ) (
- SELECT
- 'document-one',
- 'document',
- '2019-10-16 00:00:00',
- '2019-10-16 00:00:00'
- );
-
-INSERT INTO
- public."UserHistory" (
- "userId",
- "itemId",
- "itemType",
- "createdAt",
- "updatedAt"
- ) (
- SELECT
- 'document-one',
- 'document',
- '2019-10-16 00:00:00',
- '2019-10-16 00:00:00'
- );
-
-INSERT INTO
- public."UserHistory" (
- "userId",
- "itemId",
- "itemType",
- "createdAt",
- "updatedAt"
- ) (
- SELECT
- 'document-two',
- 'document',
- '2019-10-16 00:00:00',
- '2019-10-16 00:00:00'
- );
-
-INSERT INTO
- public."Macrotation" (
- "id",
- "documentId",
- "userId",
- "linkSharePosition",
- "highlightedText",
- "image",
- "comment",
- "hexCode",
- "section",
- "createdAt",
- "updatedAt"
- ) (
- SELECT
- 'macrotation-one',
- 'document-one',
- 'lsp',
- 'highlighted text',
- 'image',
- 'comment',
- 'hex code',
- 'section',
- '2019-10-16 00:00:00',
- '2019-10-16 00:00:00'
- );
-
-INSERT INTO
- public."Macrotation" (
- "id",
- "documentId",
- "userId",
- "linkSharePosition",
- "highlightedText",
- "image",
- "comment",
- "hexCode",
- "section",
- "createdAt",
- "updatedAt",
- "parentId"
- ) (
- SELECT
- 'macrotation-two',
- 'document-one',
- 'lsp',
- 'highlighted text',
- 'image',
- 'comment',
- 'hex code',
- 'section',
- '2019-10-16 00:00:00',
- '2019-10-16 00:01:00',
- 'macrotation-one'
- );
-
-INSERT INTO
- public."Macrotation" (
- "id",
- "documentId",
- "userId",
- "linkSharePosition",
- "highlightedText",
- "image",
- "comment",
- "hexCode",
- "section",
- "createdAt",
- "updatedAt"
- ) (
- SELECT
- 'macrotation-three',
- 'document-one',
- 'lsp',
- 'highlighted text',
- 'image',
- 'comment',
- 'hex code',
- 'section',
- '2019-10-16 00:00:00',
- '2019-10-16 00:03:00'
- );
-
-INSERT INTO
- public."Macrotation" (
- "id",
- "documentId",
- "userId",
- "linkSharePosition",
- "highlightedText",
- "image",
- "comment",
- "hexCode",
- "section",
- "createdAt",
- "updatedAt"
- ) (
- SELECT
- 'macrotation-four',
- 'document-one',
- 'lsp',
- 'highlighted text',
- 'image',
- 'comment',
- 'hex code',
- 'section',
- '2019-10-16 00:00:00',
- '2019-10-16 00:04:00'
- );
-
-INSERT INTO
- public."Macrotation" (
- "id",
- "documentId",
- "userId",
- "linkSharePosition",
- "highlightedText",
- "image",
- "comment",
- "hexCode",
- "section",
- "createdAt",
- "updatedAt"
- ) (
- SELECT
- 'macrotation-five',
- 'document-two',
- 'lsp',
- 'highlighted text',
- 'image',
- 'comment',
- 'hex code',
- 'section',
- '2019-10-16 00:00:00',
- '2019-10-16 00:05:00'
- );
diff --git a/rust/cloud-storage/macro_db_client/fixtures/project-macrotations.sql b/rust/cloud-storage/macro_db_client/fixtures/project-macrotations.sql
deleted file mode 100644
index 5d65c2674a..0000000000
--- a/rust/cloud-storage/macro_db_client/fixtures/project-macrotations.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-INSERT INTO public."Macrotation" ("id","documentId", "userId", "linkSharePosition", "highlightedText", "image", "comment", "hexCode", "section", "createdAt", "updatedAt")
-(SELECT 'macrotation-one', 'd1', 'macro|[email protected]', 1, 'highlighted text', 'image', 'comment', 'hex code', 'section', '2019-10-16 00:00:00', '2019-10-16 00:00:00');
-INSERT INTO public."Macrotation" ("id","documentId", "userId", "linkSharePosition", "highlightedText", "image", "comment", "hexCode", "section", "createdAt", "updatedAt")
-(SELECT 'macrotation-two', 'd1', 'macro|[email protected]', 1, 'highlighted text', 'image', 'comment', 'hex code', 'section', '2019-10-16 00:00:00', '2019-10-16 00:01:00');
-INSERT INTO public."Macrotation" ("id","documentId", "userId", "linkSharePosition", "highlightedText", "image", "comment", "hexCode", "section", "createdAt", "updatedAt")
-(SELECT 'macrotation-three', 'd1', 'macro|[email protected]', 1, 'highlighted text', 'image', 'comment', 'hex code', 'section', '2019-10-16 00:00:00', '2019-10-16 00:03:00');
-INSERT INTO public."Macrotation" ("id","documentId", "userId", "linkSharePosition", "highlightedText", "image", "comment", "hexCode", "section", "createdAt", "updatedAt")
-(SELECT 'macrotation-four', 'd1', 'macro|[email protected]', 1, 'highlighted text', 'image', 'comment', 'hex code', 'section', '2019-10-16 00:00:00', '2019-10-16 00:04:00');
-
-INSERT INTO public."Macrotation" ("id","documentId", "userId", "linkSharePosition", "highlightedText", "image", "comment", "hexCode", "section", "createdAt", "updatedAt")
-(SELECT 'macrotation-five', 'd2', 'macro|[email protected]', 1, 'highlighted text', 'image', 'comment', 'hex code', 'section', '2019-10-16 00:00:00', '2019-10-16 00:05:00');
diff --git a/rust/cloud-storage/macro_db_client/migrations/20260326135457_remove_macrotation_table.sql b/rust/cloud-storage/macro_db_client/migrations/20260326135457_remove_macrotation_table.sql
new file mode 100644
index 0000000000..c017fc5d27
--- /dev/null
+++ b/rust/cloud-storage/macro_db_client/migrations/20260326135457_remove_macrotation_table.sql
@@ -0,0 +1 @@
+DROP TABLE IF EXISTS "Macrotation";
diff --git a/rust/cloud-storage/macro_db_client/src/notification/document.rs b/rust/cloud-storage/macro_db_client/src/notification/document.rs
index 87b2d7f7c6..b99d4c5212 100644
--- a/rust/cloud-storage/macro_db_client/src/notification/document.rs
+++ b/rust/cloud-storage/macro_db_client/src/notification/document.rs
@@ -24,17 +24,3 @@ pub async fn get_document_notification_users(
Ok(users)
}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use sqlx::{Pool, Postgres};
-
- #[sqlx::test(fixtures(path = "../../fixtures", scripts("macrotations")))]
- async fn test_get_document_notification_users(pool: Pool<Postgres>) -> anyhow::Result<()> {
- let users = get_document_notification_users(&pool, "document-one").await?;
-
- assert_eq!(users, vec!["macro|[email protected]"]);
- Ok(())
- }
-}
diff --git a/rust/cloud-storage/macro_db_client/src/notification/macrotation.rs b/rust/cloud-storage/macro_db_client/src/notification/macrotation.rs
deleted file mode 100644
index e7cd680c06..0000000000
--- a/rust/cloud-storage/macro_db_client/src/notification/macrotation.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-use sqlx::{Pool, Postgres};
-
-/// Gets all users that need to be notified for a macrotation
-/// This does not include the owner of the macrotation
-#[tracing::instrument(skip(db))]
-pub async fn get_macrotation_notification_users(
- db: Pool<Postgres>,
- macrotation_id: &str,
-) -> anyhow::Result<Vec<String>> {
- let users = sqlx::query!(
- r#"
- SELECT
- u."id" as id
- FROM "Macrotation" ma
- INNER JOIN "Document" d ON d.id = ma."documentId"
- INNER JOIN "UserHistory" uh ON uh."itemId" = d."id" AND uh."itemType" = 'document'
- INNER JOIN "User" u ON u.id = uh."userId"
- WHERE ma.id = $1 AND u.id != ma."userId"
- "#,
- macrotation_id
- )
- .map(|row| row.id)
- .fetch_all(&db)
- .await?;
-
- Ok(users)
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use sqlx::{Pool, Postgres};
-
- #[sqlx::test(fixtures(path = "../../fixtures", scripts("macrotations")))]
- async fn test_get_macrotation_notification_users(pool: Pool<Postgres>) -> anyhow::Result<()> {
- let users = get_macrotation_notification_users(pool.clone(), "macrotation-one").await?;
-
- assert_eq!(users, vec!["macro|[email protected]"]);
- Ok(())
- }
-}
diff --git a/rust/cloud-storage/macro_db_client/src/notification/mod.rs b/rust/cloud-storage/macro_db_client/src/notification/mod.rs
index 04547ab86c..c742181708 100644
--- a/rust/cloud-storage/macro_db_client/src/notification/mod.rs
+++ b/rust/cloud-storage/macro_db_client/src/notification/mod.rs
@@ -8,7 +8,6 @@ use crate::{
};
pub mod document;
-pub mod macrotation;
pub mod project;
/// Attaches to cloud storage item based notifications