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.

add [tasks] - quick create task endpoint (#675)

Daniel Kweon2feb051dac62
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/createTaskHandler200.ts b/js/app/packages/service-clients/service-storage/generated/schemas/createTaskHandler200.ts
new file mode 100644
index 0000000000..9f749000e9
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/createTaskHandler200.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Response for create_task
+ */
+export type CreateTaskHandler200 = {
+ /** The document id of the created task */
+ documentId: string;
+};
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
new file mode 100644
index 0000000000..ebe75b9b62
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/createTaskRequest.ts
@@ -0,0 +1,20 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { CreateTaskRequestProjectId } from './createTaskRequestProjectId';
+import type { CreateTaskRequestPropertyValues } from './createTaskRequestPropertyValues';
+
+/**
+ * Request body for create_task
+ */
+export interface CreateTaskRequest {
+ /** Optional project id to associate the task with */
+ projectId?: CreateTaskRequestProjectId;
+ /** Optional property values to set on the task */
+ propertyValues?: CreateTaskRequestPropertyValues;
+ /** The name of the task */
+ taskName: string;
+}
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/createTaskRequestProjectId.ts b/js/app/packages/service-clients/service-storage/generated/schemas/createTaskRequestProjectId.ts
new file mode 100644
index 0000000000..86c3971eda
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/createTaskRequestProjectId.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Optional project id to associate the task with
+ */
+export type CreateTaskRequestProjectId = string | null;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/createTaskRequestPropertyValues.ts b/js/app/packages/service-clients/service-storage/generated/schemas/createTaskRequestPropertyValues.ts
new file mode 100644
index 0000000000..66e56249be
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/createTaskRequestPropertyValues.ts
@@ -0,0 +1,12 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { PropertyInput } from './propertyInput';
+
+/**
+ * Optional property values to set on the task
+ */
+export type CreateTaskRequestPropertyValues = PropertyInput[] | null;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/createTaskResponse.ts b/js/app/packages/service-clients/service-storage/generated/schemas/createTaskResponse.ts
new file mode 100644
index 0000000000..1787504a29
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/createTaskResponse.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Response for create_task
+ */
+export interface CreateTaskResponse {
+ /** The document id of the created task */
+ documentId: string;
+}
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/entityReference.ts b/js/app/packages/service-clients/service-storage/generated/schemas/entityReference.ts
new file mode 100644
index 0000000000..9ab609611b
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/entityReference.ts
@@ -0,0 +1,19 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { EntityType } from './entityType';
+import type { EntityReferenceSpecificMessageId } from './entityReferenceSpecificMessageId';
+
+/**
+ * Entity reference for entity-type property values.
+ */
+export interface EntityReference {
+ entity_id: string;
+ entity_type: EntityType;
+ /** For CHANNEL, CHAT, THREAD entity types - optional specific message ID.
+This allows referencing a specific message within a thread/channel/chat. */
+ specific_message_id?: EntityReferenceSpecificMessageId;
+}
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/entityReferenceSpecificMessageId.ts b/js/app/packages/service-clients/service-storage/generated/schemas/entityReferenceSpecificMessageId.ts
new file mode 100644
index 0000000000..9e72721561
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/entityReferenceSpecificMessageId.ts
@@ -0,0 +1,12 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * For CHANNEL, CHAT, THREAD entity types - optional specific message ID.
+This allows referencing a specific message within a thread/channel/chat.
+ */
+export type EntityReferenceSpecificMessageId = string | null;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/entityType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/entityType.ts
new file mode 100644
index 0000000000..338141fe14
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/entityType.ts
@@ -0,0 +1,24 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Type of entity that can be referenced by entity properties.
+ */
+export type EntityType = typeof EntityType[keyof typeof EntityType];
+
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const EntityType = {
+ CHANNEL: 'CHANNEL',
+ CHAT: 'CHAT',
+ COMPANY: 'COMPANY',
+ DOCUMENT: 'DOCUMENT',
+ PROJECT: 'PROJECT',
+ TASK: 'TASK',
+ THREAD: 'THREAD',
+ USER: 'USER',
+} as const;
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.ts
index c531d79123..e61d634d6e 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
@@ -103,6 +103,11 @@ export * from './createInstructionsDocumentResponse';
export * from './createProjectRequest';
export * from './createProjectRequestProjectParentId';
export * from './createProjectResponse';
+export * from './createTaskHandler200';
+export * from './createTaskRequest';
+export * from './createTaskRequestProjectId';
+export * from './createTaskRequestPropertyValues';
+export * from './createTaskResponse';
export * from './createUnthreadedAnchorRequest';
export * from './createUnthreadedAnchorRequestOneOf';
export * from './createUnthreadedAnchorRequestOneOfAllOf';
@@ -206,6 +211,9 @@ export * from './editPdfPlaceableCommentAnchorRequestYPct';
export * from './emailFilters';
export * from './emptyResponse';
export * from './entityFilters';
+export * from './entityReference';
+export * from './entityReferenceSpecificMessageId';
+export * from './entityType';
export * from './errorResponse';
export * from './excludeDefaultViewRequest';
export * from './excludedDefaultView';
@@ -347,6 +355,7 @@ export * from './projectPreviewOneOfSeven';
export * from './projectPreviewOneOfSevenAllOf';
export * from './projectPreviewOneOfSevenAllOfAccess';
export * from './projectType';
+export * from './propertyInput';
export * from './recentlyDeletedResponseData';
export * from './reorderPinRequest';
export * from './s3ObjectInfo';
@@ -357,6 +366,27 @@ export * from './saveDocumentRequestSha';
export * from './saveDocumentResponse';
export * from './saveDocumentResponseData';
export * from './saveDocumentResponseDataPresignedUrl';
+export * from './setPropertyValue';
+export * from './setPropertyValueOneOf';
+export * from './setPropertyValueOneOfFive';
+export * from './setPropertyValueOneOfFiveType';
+export * from './setPropertyValueOneOfNine';
+export * from './setPropertyValueOneOfNineType';
+export * from './setPropertyValueOneOfOnefive';
+export * from './setPropertyValueOneOfOnefiveType';
+export * from './setPropertyValueOneOfOnenine';
+export * from './setPropertyValueOneOfOnenineType';
+export * from './setPropertyValueOneOfOneone';
+export * from './setPropertyValueOneOfOneoneType';
+export * from './setPropertyValueOneOfOneseven';
+export * from './setPropertyValueOneOfOnesevenType';
+export * from './setPropertyValueOneOfOnethree';
+export * from './setPropertyValueOneOfOnethreeType';
+export * from './setPropertyValueOneOfSeven';
+export * from './setPropertyValueOneOfSevenType';
+export * from './setPropertyValueOneOfThree';
+export * from './setPropertyValueOneOfThreeType';
+export * from './setPropertyValueOneOfType';
export * from './sharePermissionV2';
export * from './sharePermissionV2ChannelSharePermissions';
export * from './sharePermissionV2PublicAccessLevel';
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/propertyInput.ts b/js/app/packages/service-clients/service-storage/generated/schemas/propertyInput.ts
new file mode 100644
index 0000000000..be99710e55
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/propertyInput.ts
@@ -0,0 +1,17 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SetPropertyValue } from './setPropertyValue';
+
+/**
+ * Property input for setting a property value on the task
+ */
+export interface PropertyInput {
+ /** The property definition ID */
+ propertyId: string;
+ /** The value to set for the property */
+ value: SetPropertyValue;
+}
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValue.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValue.ts
new file mode 100644
index 0000000000..5153f0aa79
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValue.ts
@@ -0,0 +1,21 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SetPropertyValueOneOf } from './setPropertyValueOneOf';
+import type { SetPropertyValueOneOfThree } from './setPropertyValueOneOfThree';
+import type { SetPropertyValueOneOfFive } from './setPropertyValueOneOfFive';
+import type { SetPropertyValueOneOfSeven } from './setPropertyValueOneOfSeven';
+import type { SetPropertyValueOneOfNine } from './setPropertyValueOneOfNine';
+import type { SetPropertyValueOneOfOneone } from './setPropertyValueOneOfOneone';
+import type { SetPropertyValueOneOfOnethree } from './setPropertyValueOneOfOnethree';
+import type { SetPropertyValueOneOfOnefive } from './setPropertyValueOneOfOnefive';
+import type { SetPropertyValueOneOfOneseven } from './setPropertyValueOneOfOneseven';
+import type { SetPropertyValueOneOfOnenine } from './setPropertyValueOneOfOnenine';
+
+/**
+ * Type-safe enum for setting entity property values - provides compile-time validation.
+ */
+export type SetPropertyValue = SetPropertyValueOneOf | SetPropertyValueOneOfThree | SetPropertyValueOneOfFive | SetPropertyValueOneOfSeven | SetPropertyValueOneOfNine | SetPropertyValueOneOfOneone | SetPropertyValueOneOfOnethree | SetPropertyValueOneOfOnefive | SetPropertyValueOneOfOneseven | SetPropertyValueOneOfOnenine;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOf.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOf.ts
new file mode 100644
index 0000000000..1c8e7a7662
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOf.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SetPropertyValueOneOfType } from './setPropertyValueOneOfType';
+
+/**
+ * Boolean true/false value
+ */
+export type SetPropertyValueOneOf = {
+ type: SetPropertyValueOneOfType;
+ value: boolean;
+};
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfFive.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfFive.ts
new file mode 100644
index 0000000000..06fad6f614
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfFive.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SetPropertyValueOneOfFiveType } from './setPropertyValueOneOfFiveType';
+
+/**
+ * Numeric value
+ */
+export type SetPropertyValueOneOfFive = {
+ type: SetPropertyValueOneOfFiveType;
+ value: number;
+};
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfFiveType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfFiveType.ts
new file mode 100644
index 0000000000..01749bf0fb
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfFiveType.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type SetPropertyValueOneOfFiveType = typeof SetPropertyValueOneOfFiveType[keyof typeof SetPropertyValueOneOfFiveType];
+
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const SetPropertyValueOneOfFiveType = {
+ number: 'number',
+} as const;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfNine.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfNine.ts
new file mode 100644
index 0000000000..30cad4291e
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfNine.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SetPropertyValueOneOfNineType } from './setPropertyValueOneOfNineType';
+
+/**
+ * Select option by ID (for select-type properties)
+ */
+export type SetPropertyValueOneOfNine = {
+ option_id: string;
+ type: SetPropertyValueOneOfNineType;
+};
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfNineType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfNineType.ts
new file mode 100644
index 0000000000..4b8dfae5ac
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfNineType.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type SetPropertyValueOneOfNineType = typeof SetPropertyValueOneOfNineType[keyof typeof SetPropertyValueOneOfNineType];
+
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const SetPropertyValueOneOfNineType = {
+ select_option: 'select_option',
+} as const;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnefive.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnefive.ts
new file mode 100644
index 0000000000..0b964927d8
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnefive.ts
@@ -0,0 +1,16 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { EntityReference } from './entityReference';
+import type { SetPropertyValueOneOfOnefiveType } from './setPropertyValueOneOfOnefiveType';
+
+/**
+ * Multiple entity references (for multi-select entity properties)
+ */
+export type SetPropertyValueOneOfOnefive = {
+ references: EntityReference[];
+ type: SetPropertyValueOneOfOnefiveType;
+};
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnefiveType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnefiveType.ts
new file mode 100644
index 0000000000..763506f94e
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnefiveType.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type SetPropertyValueOneOfOnefiveType = typeof SetPropertyValueOneOfOnefiveType[keyof typeof SetPropertyValueOneOfOnefiveType];
+
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const SetPropertyValueOneOfOnefiveType = {
+ multi_entity_reference: 'multi_entity_reference',
+} as const;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnenine.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnenine.ts
new file mode 100644
index 0000000000..35f0258672
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnenine.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SetPropertyValueOneOfOnenineType } from './setPropertyValueOneOfOnenineType';
+
+/**
+ * Multiple link values (for multi-select link properties)
+ */
+export type SetPropertyValueOneOfOnenine = {
+ type: SetPropertyValueOneOfOnenineType;
+ urls: string[];
+};
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnenineType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnenineType.ts
new file mode 100644
index 0000000000..c3db6e3705
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnenineType.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type SetPropertyValueOneOfOnenineType = typeof SetPropertyValueOneOfOnenineType[keyof typeof SetPropertyValueOneOfOnenineType];
+
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const SetPropertyValueOneOfOnenineType = {
+ multi_link: 'multi_link',
+} as const;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOneone.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOneone.ts
new file mode 100644
index 0000000000..6947cbeba8
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOneone.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SetPropertyValueOneOfOneoneType } from './setPropertyValueOneOfOneoneType';
+
+/**
+ * Multiple select options by ID (for multi-select properties)
+ */
+export type SetPropertyValueOneOfOneone = {
+ option_ids: string[];
+ type: SetPropertyValueOneOfOneoneType;
+};
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOneoneType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOneoneType.ts
new file mode 100644
index 0000000000..104b03bde3
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOneoneType.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type SetPropertyValueOneOfOneoneType = typeof SetPropertyValueOneOfOneoneType[keyof typeof SetPropertyValueOneOfOneoneType];
+
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const SetPropertyValueOneOfOneoneType = {
+ multi_select_option: 'multi_select_option',
+} as const;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOneseven.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOneseven.ts
new file mode 100644
index 0000000000..a0ba476fd1
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOneseven.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SetPropertyValueOneOfOnesevenType } from './setPropertyValueOneOfOnesevenType';
+
+/**
+ * Link value
+ */
+export type SetPropertyValueOneOfOneseven = {
+ type: SetPropertyValueOneOfOnesevenType;
+ url: string;
+};
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnesevenType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnesevenType.ts
new file mode 100644
index 0000000000..264c91b4cc
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnesevenType.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type SetPropertyValueOneOfOnesevenType = typeof SetPropertyValueOneOfOnesevenType[keyof typeof SetPropertyValueOneOfOnesevenType];
+
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const SetPropertyValueOneOfOnesevenType = {
+ link: 'link',
+} as const;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnethree.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnethree.ts
new file mode 100644
index 0000000000..44cea61d41
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnethree.ts
@@ -0,0 +1,16 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { EntityReference } from './entityReference';
+import type { SetPropertyValueOneOfOnethreeType } from './setPropertyValueOneOfOnethreeType';
+
+/**
+ * Entity reference
+ */
+export type SetPropertyValueOneOfOnethree = {
+ reference: EntityReference;
+ type: SetPropertyValueOneOfOnethreeType;
+};
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnethreeType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnethreeType.ts
new file mode 100644
index 0000000000..7da6c5517d
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfOnethreeType.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type SetPropertyValueOneOfOnethreeType = typeof SetPropertyValueOneOfOnethreeType[keyof typeof SetPropertyValueOneOfOnethreeType];
+
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const SetPropertyValueOneOfOnethreeType = {
+ entity_reference: 'entity_reference',
+} as const;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfSeven.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfSeven.ts
new file mode 100644
index 0000000000..21d78789ef
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfSeven.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SetPropertyValueOneOfSevenType } from './setPropertyValueOneOfSevenType';
+
+/**
+ * String/text value
+ */
+export type SetPropertyValueOneOfSeven = {
+ type: SetPropertyValueOneOfSevenType;
+ value: string;
+};
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfSevenType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfSevenType.ts
new file mode 100644
index 0000000000..5873895bad
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfSevenType.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type SetPropertyValueOneOfSevenType = typeof SetPropertyValueOneOfSevenType[keyof typeof SetPropertyValueOneOfSevenType];
+
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const SetPropertyValueOneOfSevenType = {
+ string: 'string',
+} as const;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfThree.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfThree.ts
new file mode 100644
index 0000000000..c48e1e31d8
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfThree.ts
@@ -0,0 +1,15 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { SetPropertyValueOneOfThreeType } from './setPropertyValueOneOfThreeType';
+
+/**
+ * Date and time value
+ */
+export type SetPropertyValueOneOfThree = {
+ type: SetPropertyValueOneOfThreeType;
+ value: string;
+};
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfThreeType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfThreeType.ts
new file mode 100644
index 0000000000..41e2d42d92
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfThreeType.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type SetPropertyValueOneOfThreeType = typeof SetPropertyValueOneOfThreeType[keyof typeof SetPropertyValueOneOfThreeType];
+
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const SetPropertyValueOneOfThreeType = {
+ date: 'date',
+} as const;
diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfType.ts b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfType.ts
new file mode 100644
index 0000000000..d9d2000938
--- /dev/null
+++ b/js/app/packages/service-clients/service-storage/generated/schemas/setPropertyValueOneOfType.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.13.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+export type SetPropertyValueOneOfType = typeof SetPropertyValueOneOfType[keyof typeof SetPropertyValueOneOfType];
+
+
+// eslint-disable-next-line @typescript-eslint/no-redeclare
+export const SetPropertyValueOneOfType = {
+ boolean: 'boolean',
+} as const;
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 4b20844234..9a088efa76 100644
--- a/js/app/packages/service-clients/service-storage/generated/zod.ts
+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts
@@ -616,6 +616,67 @@ export const createDocumentHandlerResponse = zod.object({
})
+/**
+ * This endpoint creates task metadata and sets properties atomically.
+Task content should be set separately via the sync service.
+
+NOTE: Ideally content initialization would happen here on the backend, but that requires
+adding Loro/Lexical support to initialize sync service documents server-side. Deferring
+for now — client must call `syncServiceClient.initializeFromSnapshot()` after this returns.
+ * @summary Creates a task document with properties in a single call.
+ */
+export const createTaskHandlerBody = zod.object({
+ "projectId": zod.string().nullish().describe('Optional project id to associate the task with'),
+ "propertyValues": zod.array(zod.object({
+ "propertyId": zod.string().describe('The property definition ID'),
+ "value": zod.union([zod.object({
+ "type": zod.enum(['boolean']),
+ "value": zod.boolean()
+}).describe('Boolean true/false value'),zod.object({
+ "type": zod.enum(['date']),
+ "value": zod.string().datetime({})
+}).describe('Date and time value'),zod.object({
+ "type": zod.enum(['number']),
+ "value": zod.number()
+}).describe('Numeric value'),zod.object({
+ "type": zod.enum(['string']),
+ "value": zod.string()
+}).describe('String/text value'),zod.object({
+ "option_id": zod.string().uuid(),
+ "type": zod.enum(['select_option'])
+}).describe('Select option by ID (for select-type properties)'),zod.object({
+ "option_ids": zod.array(zod.string().uuid()),
+ "type": zod.enum(['multi_select_option'])
+}).describe('Multiple select options by ID (for multi-select properties)'),zod.object({
+ "reference": zod.object({
+ "entity_id": zod.string(),
+ "entity_type": zod.enum(['CHANNEL', 'CHAT', 'COMPANY', 'DOCUMENT', 'PROJECT', 'TASK', 'THREAD', 'USER']).describe('Type of entity that can be referenced by entity properties.'),
+ "specific_message_id": zod.string().uuid().nullish().describe('For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread/channel/chat.')
+}).describe('Entity reference for entity-type property values.'),
+ "type": zod.enum(['entity_reference'])
+}).describe('Entity reference'),zod.object({
+ "references": zod.array(zod.object({
+ "entity_id": zod.string(),
+ "entity_type": zod.enum(['CHANNEL', 'CHAT', 'COMPANY', 'DOCUMENT', 'PROJECT', 'TASK', 'THREAD', 'USER']).describe('Type of entity that can be referenced by entity properties.'),
+ "specific_message_id": zod.string().uuid().nullish().describe('For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread/channel/chat.')
+}).describe('Entity reference for entity-type property values.')),
+ "type": zod.enum(['multi_entity_reference'])
+}).describe('Multiple entity references (for multi-select entity properties)'),zod.object({
+ "type": zod.enum(['link']),
+ "url": zod.string()
+}).describe('Link value'),zod.object({
+ "type": zod.enum(['multi_link']),
+ "urls": zod.array(zod.string())
+}).describe('Multiple link values (for multi-select link properties)')]).describe('Type-safe enum for setting entity property values - provides compile-time validation.')
+}).describe('Property input for setting a property value on the task')).nullish().describe('Optional property values to set on the task'),
+ "taskName": zod.string().describe('The name of the task')
+}).describe('Request body for create_task')
+
+export const createTaskHandlerResponse = zod.object({
+ "documentId": zod.string().describe('The document id of the created task')
+}).describe('Response for create_task')
+
+
export const initializeUserDocumentsResponse = zod.object({
"success": zod.boolean().describe('Indicates if the request was successful')
})
diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.json
index 2670b9ec58..774ed6a180 100644
--- a/js/app/packages/service-clients/service-storage/openapi.json
+++ b/js/app/packages/service-clients/service-storage/openapi.json
@@ -680,6 +680,74 @@
}
}
},
+ "/documents/create_task": {
+ "post": {
+ "tags": ["document"],
+ "summary": "Creates a task document with properties in a single call.",
+ "description": "This endpoint creates task metadata and sets properties atomically.\nTask content should be set separately via the sync service.\n\nNOTE: Ideally content initialization would happen here on the backend, but that requires\nadding Loro/Lexical support to initialize sync service documents server-side. Deferring\nfor now — client must call `syncServiceClient.initializeFromSnapshot()` after this returns.",
+ "operationId": "create_task_handler",
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/CreateTaskRequest" }
+ }
+ },
+ "required": true
+ },
+ "responses": {
+ "200": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "description": "Response for create_task",
+ "required": ["documentId"],
+ "properties": {
+ "documentId": {
+ "type": "string",
+ "description": "The document id of the created task"
+ }
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ },
+ "401": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ },
+ "403": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ },
+ "500": {
+ "description": "",
+ "content": {
+ "application/json": {
+ "schema": { "$ref": "#/components/schemas/ErrorResponse" }
+ }
+ }
+ }
+ }
+ }
+ },
"/documents/initialize_user_documents": {
"post": {
"tags": ["document"],
@@ -4507,6 +4575,37 @@
}
}
},
+ "CreateTaskRequest": {
+ "type": "object",
+ "description": "Request body for create_task",
+ "required": ["taskName"],
+ "properties": {
+ "projectId": {
+ "type": ["string", "null"],
+ "description": "Optional project id to associate the task with"
+ },
+ "propertyValues": {
+ "type": ["array", "null"],
+ "items": { "$ref": "#/components/schemas/PropertyInput" },
+ "description": "Optional property values to set on the task"
+ },
+ "taskName": {
+ "type": "string",
+ "description": "The name of the task"
+ }
+ }
+ },
+ "CreateTaskResponse": {
+ "type": "object",
+ "description": "Response for create_task",
+ "required": ["documentId"],
+ "properties": {
+ "documentId": {
+ "type": "string",
+ "description": "The document id of the created task"
+ }
+ }
+ },
"CreateUnthreadedAnchorRequest": {
"oneOf": [
{
@@ -5115,6 +5214,34 @@
}
}
},
+ "EntityReference": {
+ "type": "object",
+ "description": "Entity reference for entity-type property values.",
+ "required": ["entity_id", "entity_type"],
+ "properties": {
+ "entity_id": { "type": "string" },
+ "entity_type": { "$ref": "#/components/schemas/EntityType" },
+ "specific_message_id": {
+ "type": ["string", "null"],
+ "format": "uuid",
+ "description": "For CHANNEL, CHAT, THREAD entity types - optional specific message ID.\nThis allows referencing a specific message within a thread/channel/chat."
+ }
+ }
+ },
+ "EntityType": {
+ "type": "string",
+ "description": "Type of entity that can be referenced by entity properties.",
+ "enum": [
+ "CHANNEL",
+ "CHAT",
+ "COMPANY",
+ "DOCUMENT",
+ "PROJECT",
+ "TASK",
+ "THREAD",
+ "USER"
+ ]
+ },
"ErrorResponse": {
"type": "object",
"description": "A plain old json error response for use with axum.\nyup, thats it.",
@@ -6645,6 +6772,21 @@
"updatedAt": { "type": "integer", "format": "int64" }
}
},
+ "PropertyInput": {
+ "type": "object",
+ "description": "Property input for setting a property value on the task",
+ "required": ["propertyId", "value"],
+ "properties": {
+ "propertyId": {
+ "type": "string",
+ "description": "The property definition ID"
+ },
+ "value": {
+ "$ref": "#/components/schemas/SetPropertyValue",
+ "description": "The value to set for the property"
+ }
+ }
+ },
"RecentlyDeletedResponseData": {
"type": "object",
"required": ["items"],
@@ -6742,6 +6884,107 @@
}
}
},
+ "SetPropertyValue": {
+ "oneOf": [
+ {
+ "type": "object",
+ "description": "Boolean true/false value",
+ "required": ["value", "type"],
+ "properties": {
+ "type": { "type": "string", "enum": ["boolean"] },
+ "value": { "type": "boolean" }
+ }
+ },
+ {
+ "type": "object",
+ "description": "Date and time value",
+ "required": ["value", "type"],
+ "properties": {
+ "type": { "type": "string", "enum": ["date"] },
+ "value": { "type": "string", "format": "date-time" }
+ }
+ },
+ {
+ "type": "object",
+ "description": "Numeric value",
+ "required": ["value", "type"],
+ "properties": {
+ "type": { "type": "string", "enum": ["number"] },
+ "value": { "type": "number", "format": "double" }
+ }
+ },
+ {
+ "type": "object",
+ "description": "String/text value",
+ "required": ["value", "type"],
+ "properties": {
+ "type": { "type": "string", "enum": ["string"] },
+ "value": { "type": "string" }
+ }
+ },
+ {
+ "type": "object",
+ "description": "Select option by ID (for select-type properties)",
+ "required": ["option_id", "type"],
+ "properties": {
+ "option_id": { "type": "string", "format": "uuid" },
+ "type": { "type": "string", "enum": ["select_option"] }
+ }
+ },
+ {
+ "type": "object",
+ "description": "Multiple select options by ID (for multi-select properties)",
+ "required": ["option_ids", "type"],
+ "properties": {
+ "option_ids": {
+ "type": "array",
+ "items": { "type": "string", "format": "uuid" }
+ },
+ "type": { "type": "string", "enum": ["multi_select_option"] }
+ }
+ },
+ {
+ "type": "object",
+ "description": "Entity reference",
+ "required": ["reference", "type"],
+ "properties": {
+ "reference": { "$ref": "#/components/schemas/EntityReference" },
+ "type": { "type": "string", "enum": ["entity_reference"] }
+ }
+ },
+ {
+ "type": "object",
+ "description": "Multiple entity references (for multi-select entity properties)",
+ "required": ["references", "type"],
+ "properties": {
+ "references": {
+ "type": "array",
+ "items": { "$ref": "#/components/schemas/EntityReference" }
+ },
+ "type": { "type": "string", "enum": ["multi_entity_reference"] }
+ }
+ },
+ {
+ "type": "object",
+ "description": "Link value",
+ "required": ["url", "type"],
+ "properties": {
+ "type": { "type": "string", "enum": ["link"] },
+ "url": { "type": "string" }
+ }
+ },
+ {
+ "type": "object",
+ "description": "Multiple link values (for multi-select link properties)",
+ "required": ["urls", "type"],
+ "properties": {
+ "type": { "type": "string", "enum": ["multi_link"] },
+ "urls": { "type": "array", "items": { "type": "string" } }
+ }
+ }
+ ],
+ "description": "Type-safe enum for setting entity property values - provides compile-time validation."
+ },
"SharePermissionV2": {
"type": "object",
"required": ["id", "isPublic", "owner"],
diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lock
index 62196bdfaa..e17c57de91 100644
--- a/rust/cloud-storage/Cargo.lock
+++ b/rust/cloud-storage/Cargo.lock
@@ -2676,6 +2676,7 @@ dependencies = [
"models_opensearch",
"models_pagination",
"models_permissions",
+ "models_properties",
"models_soup",
"ordered-float",
"properties",
diff --git a/rust/cloud-storage/document_storage_service/Cargo.toml b/rust/cloud-storage/document_storage_service/Cargo.toml
index c9dc196e91..aa8ce86ee4 100644
--- a/rust/cloud-storage/document_storage_service/Cargo.toml
+++ b/rust/cloud-storage/document_storage_service/Cargo.toml
@@ -79,6 +79,7 @@ models_bulk_upload = { path = "../models_bulk_upload" }
models_opensearch = { path = "../models_opensearch" }
models_pagination = { path = "../models_pagination", features = ["axum"] }
models_permissions = { path = "../models_permissions" }
+models_properties = { path = "../models_properties" }
models_soup = { path = "../models_soup", features = ["schema"] }
properties = { path = "../properties" }
rayon = "1.10.0"
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_handler.rs b/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_handler.rs
index 7cfb5705e1..c4bc273896 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_handler.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/create_document/create_document_handler.rs
@@ -15,12 +15,8 @@ use model::{
response::{GenericErrorResponse, GenericResponse},
};
use model_user::axum_extractor::MacroUserExtractor;
-use models_opensearch::SearchEntityType;
use models_permissions::share_permission::access_level::EditAccessLevel;
-use sqs_client::search::SearchQueueMessage;
-use sqs_client::search::name::EntityName;
use std::str::FromStr;
-use tracing::Instrument;
/// Handles creating a document
#[utoipa::path(
@@ -117,37 +113,14 @@ pub(in crate::api) async fn create_document_handler(
}
};
- tokio::spawn({
- let sqs_client = state.sqs_client.clone();
- let document_id = response_data
+ utils::notify_search_service_of_document_name_update(
+ state.sqs_client.clone(),
+ response_data
.document_response
.document_metadata
.document_id
- .clone();
- async move {
- tracing::trace!("sending message to search extractor queue");
- let document_id = match macro_uuid::string_to_uuid(&document_id) {
- Ok(document_id) => document_id,
- Err(err) => {
- tracing::error!(error=?err, "failed to convert document_id to uuid");
- return;
- }
- };
-
- let _ = sqs_client
- .send_message_to_search_event_queue(SearchQueueMessage::UpdateEntityName(
- EntityName {
- entity_id: document_id,
- entity_type: SearchEntityType::Documents,
- },
- ))
- .await
- .inspect_err(|e| {
- tracing::error!(error=?e, "SEARCH_QUEUE unable to enqueue message");
- });
- }
- .in_current_span()
- });
+ .clone(),
+ );
return GenericResponse::builder()
.data(&response_data)
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/create_document/mod.rs b/rust/cloud-storage/document_storage_service/src/api/documents/create_document/mod.rs
index e26c7b66cd..f021cc0d6a 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/create_document/mod.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/create_document/mod.rs
@@ -1,4 +1,4 @@
mod create_document_handler;
-mod create_document_v2;
+pub(in crate::api) mod create_document_v2;
pub(in crate::api) use create_document_handler::*;
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/create_task.rs b/rust/cloud-storage/document_storage_service/src/api/documents/create_task.rs
new file mode 100644
index 0000000000..3993d05309
--- /dev/null
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/create_task.rs
@@ -0,0 +1,159 @@
+use axum::{Json, extract::State, http::StatusCode};
+use macro_middleware::cloud_storage::ensure_access::project::ProjectBodyAccessLevelExtractor;
+use model::document::FileType;
+use model::response::ErrorResponse;
+use model_user::axum_extractor::MacroUserExtractor;
+use models_permissions::share_permission::access_level::EditAccessLevel;
+use models_properties::EntityType as PropertyEntityType;
+use models_properties::api::requests::SetPropertyValue;
+use properties::PropertiesService;
+use uuid::Uuid;
+
+use crate::api::{
+ context::ApiContext,
+ documents::{
+ create_document::create_document_v2,
+ utils::{self},
+ },
+};
+
+/// SHA256 hash of empty string - for an empty markdown document
+const EMPTY_SHA256: &str = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
+
+/// Property input for setting a property value on the task
+#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, utoipa::ToSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct PropertyInput {
+ /// The property definition ID
+ pub property_id: String,
+ /// The value to set for the property
+ pub value: SetPropertyValue,
+}
+
+/// Request body for create_task
+#[derive(serde::Serialize, serde::Deserialize, Debug, utoipa::ToSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct CreateTaskRequest {
+ /// The name of the task
+ pub task_name: String,
+ /// Optional project id to associate the task with
+ pub project_id: Option<String>,
+ /// Optional property values to set on the task
+ pub property_values: Option<Vec<PropertyInput>>,
+}
+
+/// Response for create_task
+#[derive(serde::Serialize, serde::Deserialize, Debug, utoipa::ToSchema)]
+#[serde(rename_all = "camelCase")]
+pub struct CreateTaskResponse {
+ /// The document id of the created task
+ pub document_id: String,
+}
+
+/// Creates a task document with properties in a single call.
+///
+/// This endpoint creates task metadata and sets properties atomically.
+/// Task content should be set separately via the sync service.
+///
+/// NOTE: Ideally content initialization would happen here on the backend, but that requires
+/// adding Loro/Lexical support to initialize sync service documents server-side. Deferring
+/// for now — client must call `syncServiceClient.initializeFromSnapshot()` after this returns.
+#[utoipa::path(
+ post,
+ tag = "document",
+ path = "/documents/create_task",
+ request_body = CreateTaskRequest,
+ responses(
+ (status = 200, body=inline(CreateTaskResponse)),
+ (status = 401, body=ErrorResponse),
+ (status = 403, body=ErrorResponse),
+ (status = 400, body=ErrorResponse),
+ (status = 500, body=ErrorResponse),
+ )
+ )]
+#[tracing::instrument(skip(state, user_context, project), fields(user_id=?user_context.macro_user_id))]
+#[axum::debug_handler(state = ApiContext)]
+pub(in crate::api) async fn create_task_handler(
+ State(state): State<ApiContext>,
+ user_context: MacroUserExtractor,
+ project: ProjectBodyAccessLevelExtractor<EditAccessLevel, CreateTaskRequest>,
+) -> Result<Json<CreateTaskResponse>, (StatusCode, Json<ErrorResponse<'static>>)> {
+ let req = project.into_inner();
+ let user_id = user_context.user_context.user_id.clone();
+
+ // Create task document metadata (empty content - client sets via sync service)
+ let create_document_response_data = create_document_v2::create_document(
+ &state,
+ create_document_v2::CreateDocumentParams {
+ id: None,
+ sha: EMPTY_SHA256,
+ document_name: &req.task_name,
+ owner: user_context.macro_user_id,
+ file_type: Some(FileType::Md),
+ job_id: None,
+ project_id: req.project_id.as_deref(),
+ email_attachment_id: None,
+ created_at: None,
+ is_task: true,
+ },
+ )
+ .await;
+
+ let response_data = match create_document_response_data {
+ Ok(response_data) => response_data,
+ Err((status_code, message, document_id)) => {
+ tracing::error!(error=?message, "unable to create task document");
+ if let Some(document_id) = document_id {
+ tracing::info!(document_id=?document_id, "cleaning up document");
+ utils::handle_document_creation_error_cleanup(&state.db, document_id).await;
+ }
+ return Err((
+ status_code,
+ Json(ErrorResponse {
+ message: "failed to create task document",
+ }),
+ ));
+ }
+ };
+
+ let document_id = response_data
+ .document_response
+ .document_metadata
+ .document_id
+ .clone();
+
+ // Apply properties to the task (partial failure is OK)
+ if let Some(properties) = req.property_values {
+ for property_input in properties {
+ let Ok(property_uuid) = Uuid::parse_str(&property_input.property_id) else {
+ tracing::warn!(property_id=?property_input.property_id, "invalid property_id UUID, skipping");
+ continue;
+ };
+
+ let _ = state
+ .properties_service
+ .set_entity_property(
+ &user_id,
+ &document_id,
+ PropertyEntityType::Task,
+ property_uuid,
+ Some(property_input.value.clone()),
+ )
+ .await
+ .inspect_err(|e| {
+ tracing::warn!(
+ property_id=?property_uuid,
+ error=?e,
+ "failed to set property on task, continuing"
+ );
+ });
+ }
+ }
+
+ utils::notify_search_service_of_document_name_update(
+ state.sqs_client.clone(),
+ document_id.clone(),
+ );
+
+ Ok(Json(CreateTaskResponse { document_id }))
+}
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/edit_document/edit_document_v2.rs b/rust/cloud-storage/document_storage_service/src/api/documents/edit_document/edit_document_v2.rs
index dff25c94ff..91b958b6bc 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/edit_document/edit_document_v2.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/edit_document/edit_document_v2.rs
@@ -1,4 +1,7 @@
-use crate::{api::context::ApiContext, model::request::documents::edit::EditDocumentRequestV2};
+use crate::{
+ api::{context::ApiContext, documents::utils},
+ model::request::documents::edit::EditDocumentRequestV2,
+};
use anyhow::Context;
use axum::{
http::StatusCode,
@@ -10,11 +13,8 @@ use model::{
response::{ErrorResponse, GenericSuccessResponse, SuccessResponse},
user::UserContext,
};
-use models_opensearch::SearchEntityType;
use models_permissions::share_permission::UpdateSharePermissionRequestV2;
use models_permissions::share_permission::access_level::AccessLevel;
-use sqs_client::search::{SearchQueueMessage, name::EntityName};
-use tracing::Instrument;
pub async fn edit_document(
ctx: &ApiContext,
@@ -84,33 +84,10 @@ pub async fn edit_document(
// If an important attribute is updated we will need to send a message to the search extractor
if document_name.is_some() {
- tokio::spawn({
- let sqs_client = ctx.sqs_client.clone();
- let document_id = document_context.document_id.clone();
- async move {
- tracing::trace!("sending message to search extractor queue");
- let document_id = match macro_uuid::string_to_uuid(&document_id) {
- Ok(document_id) => document_id,
- Err(err) => {
- tracing::error!(error=?err, "failed to convert document_id to uuid");
- return;
- }
- };
-
- let _ = sqs_client
- .send_message_to_search_event_queue(SearchQueueMessage::UpdateEntityName(
- EntityName {
- entity_id: document_id,
- entity_type: SearchEntityType::Documents,
- },
- ))
- .await
- .inspect_err(|e| {
- tracing::error!(error=?e, "SEARCH_QUEUE unable to enqueue message");
- });
- }
- .in_current_span()
- });
+ utils::notify_search_service_of_document_name_update(
+ ctx.sqs_client.clone(),
+ document_context.document_id.clone(),
+ );
}
Ok((
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/mod.rs b/rust/cloud-storage/document_storage_service/src/api/documents/mod.rs
index 710e8f605b..4c3808194e 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/mod.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/mod.rs
@@ -8,6 +8,7 @@ use tower::ServiceBuilder;
// needs to be public in api crate for swagger
pub(in crate::api) mod copy_document;
pub(in crate::api) mod create_document;
+pub(in crate::api) mod create_task;
pub(in crate::api) mod delete_document;
pub(in crate::api) mod edit_document;
pub(in crate::api) mod export_document;
@@ -71,6 +72,23 @@ pub fn router(state: ApiContext) -> Router<ApiContext> {
)),
),
)
+ .route(
+ "/create_task",
+ post(create_task::create_task_handler).layer(
+ ServiceBuilder::new()
+ .layer(axum::middleware::from_fn(
+ macro_middleware::auth::ensure_user_exists::handler,
+ ))
+ .layer(axum::middleware::from_fn_with_state(
+ state.clone(),
+ macro_middleware::user_permissions::attach_user_permissions::handler,
+ ))
+ .layer(axum::middleware::from_fn_with_state(
+ state.clone(),
+ macro_middleware::user_permissions::validate_user_quota::document_handler,
+ )),
+ ),
+ )
.route(
"/initialize_user_documents",
post(initialize_user_documents::handler).layer(
diff --git a/rust/cloud-storage/document_storage_service/src/api/documents/utils/mod.rs b/rust/cloud-storage/document_storage_service/src/api/documents/utils/mod.rs
index 59b9ad1f04..7b9dd54ccc 100644
--- a/rust/cloud-storage/document_storage_service/src/api/documents/utils/mod.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/documents/utils/mod.rs
@@ -1,7 +1,9 @@
use std::sync::Arc;
+use models_opensearch::SearchEntityType;
use sqlx::{PgPool, Pool, Postgres};
-use tracing::instrument;
+use sqs_client::search::{SearchQueueMessage, name::EntityName};
+use tracing::{Instrument, instrument};
use crate::service::s3::S3;
@@ -50,3 +52,36 @@ pub(in crate::api::documents) async fn cleanup_document_version_on_error(
.await
.map_err(|e| tracing::error!(error=?e, "unable to delete document version"));
}
+
+/// Notifies the search service of a document name update by sending a message to the search event queue
+#[instrument(skip(sqs_client), fields(document_id = %document_id))]
+pub(in crate::api::documents) fn notify_search_service_of_document_name_update(
+ sqs_client: Arc<sqs_client::SQS>,
+ document_id: String,
+) {
+ tokio::spawn(
+ async move {
+ tracing::trace!("sending message to search extractor queue");
+ let document_id = match macro_uuid::string_to_uuid(&document_id) {
+ Ok(document_id) => document_id,
+ Err(err) => {
+ tracing::error!(error=?err, "failed to convert document_id to uuid");
+ return;
+ }
+ };
+
+ let _ = sqs_client
+ .send_message_to_search_event_queue(SearchQueueMessage::UpdateEntityName(
+ EntityName {
+ entity_id: document_id,
+ entity_type: SearchEntityType::Documents,
+ },
+ ))
+ .await
+ .inspect_err(|e| {
+ tracing::error!(error=?e, "SEARCH_QUEUE unable to enqueue message");
+ });
+ }
+ .in_current_span(),
+ );
+}
diff --git a/rust/cloud-storage/document_storage_service/src/api/swagger.rs b/rust/cloud-storage/document_storage_service/src/api/swagger.rs
index 7755fbce35..c5148a53da 100644
--- a/rust/cloud-storage/document_storage_service/src/api/swagger.rs
+++ b/rust/cloud-storage/document_storage_service/src/api/swagger.rs
@@ -11,6 +11,7 @@ use crate::{
activity, annotations,
documents::{
self,
+ create_task::{CreateTaskRequest, CreateTaskResponse, PropertyInput},
export_document::ExportDocumentResponse,
permissions_token::{
create_permission_token::DocumentPermissionsTokenResponse,
@@ -156,6 +157,7 @@ use utoipa::OpenApi;
documents::permissions_token::validate_permissions_token::handler,
documents::revert_delete_document::handler,
documents::export_document::handler,
+ documents::create_task::create_task_handler,
// instructions
instructions::create_instructions::create_instructions_handler,
@@ -236,6 +238,12 @@ use utoipa::OpenApi;
CreateDocumentRequest,
CreateDocumentResponse,
CreateDocumentResponseData, // Create document
+ CreateTaskRequest,
+ CreateTaskResponse,
+ PropertyInput,
+ models_properties::api::requests::SetPropertyValue,
+ models_properties::shared::EntityReference,
+ models_properties::shared::EntityType, // Quick create task
CreateBulkDocumentResponseData,
CreateBulkDocumentResponse, // Create document bulk
GetDocumentListResult,