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.

feat(tasks): update createtask to take sharewithteam parameter (#2087)

Will Hutchinson47a39b550d42
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/createTaskRequest.ts b/js/app/packages/service-clients/service-storage/generated/schemas/createTaskRequest.ts
index a4d9a44a52..472e5cb08e 100644
--- a/js/app/packages/service-clients/service-storage/generated/schemas/createTaskRequest.ts
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/createTaskRequest.ts
@@ -15,6 +15,9 @@ export interface CreateTaskRequest {
projectId?: CreateTaskRequestProjectId;
/** Optional property values to set on the task. */
propertyValues?: CreateTaskRequestPropertyValues;
+ /** Whether to share the task with your team or not
+Defaults to true */
+ shareWithTeam?: boolean;
/** The name of the task. */
taskName: string;
}
diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.ts
index 7324105760..8013cf52f9 100644
--- a/js/app/packages/service-clients/service-storage/generated/zod.ts
+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts
@@ -1563,6 +1563,12 @@ export const createTaskHandlerBody = zod
)
.nullish()
.describe('Optional property values to set on the task.'),
+ shareWithTeam: zod
+ .boolean()
+ .optional()
+ .describe(
+ 'Whether to share the task with your team or not\nDefaults to true'
+ ),
taskName: zod.string().describe('The name of the task.'),
})
.describe('Request body for creating a task.');
diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.json
index d06ff712a0..1df2fe71b9 100644
--- a/js/app/packages/service-clients/service-storage/openapi.json
+++ b/js/app/packages/service-clients/service-storage/openapi.json
@@ -6061,6 +6061,10 @@
},
"description": "Optional property values to set on the task."
},
+ "shareWithTeam": {
+ "type": "boolean",
+ "description": "Whether to share the task with your team or not\nDefaults to true"
+ },
"taskName": {
"type": "string",
"description": "The name of the task."
diff --git a/rust/cloud-storage/documents/src/domain/models.rs b/rust/cloud-storage/documents/src/domain/models.rs
index 3beeadc35d..55bee844b1 100644
--- a/rust/cloud-storage/documents/src/domain/models.rs
+++ b/rust/cloud-storage/documents/src/domain/models.rs
@@ -115,6 +115,10 @@ pub struct PropertyInput {
pub value: SetPropertyValue,
}
+fn default_true() -> bool {
+ true
+}
+
/// Request body for creating a task.
#[derive(serde::Serialize, serde::Deserialize, Debug)]
#[cfg_attr(feature = "axum", derive(utoipa::ToSchema))]
@@ -126,6 +130,10 @@ pub struct CreateTaskRequest {
pub project_id: Option<uuid::Uuid>,
/// Optional property values to set on the task.
pub property_values: Option<Vec<PropertyInput>>,
+ /// Whether to share the task with your team or not
+ /// Defaults to true
+ #[serde(default = "default_true")]
+ pub share_with_team: bool,
}
/// Response for creating a task.
diff --git a/rust/cloud-storage/documents/src/domain/service.rs b/rust/cloud-storage/documents/src/domain/service.rs
index 72fd6f33d0..85991e9705 100644
--- a/rust/cloud-storage/documents/src/domain/service.rs
+++ b/rust/cloud-storage/documents/src/domain/service.rs
@@ -705,13 +705,15 @@ impl<R: DocumentRepo, U: PresignedUploadUrlPort, T: TaskPropertiesPort, C: Conne
.document_id
.clone();
- let _ = self
- .repo
- .share_with_team(&plain_user_id, &document_id)
- .await
- .inspect_err(|e| {
- tracing::error!(error=?e, "failed to share task with team");
- });
+ if request.share_with_team {
+ let _ = self
+ .repo
+ .share_with_team(&plain_user_id, &document_id)
+ .await
+ .inspect_err(|e| {
+ tracing::error!(error=?e, "failed to share task with team");
+ });
+ }
if let Some(properties) = request.property_values {
for property_input in properties {