Skip to content

Commit f0cda95

Browse files
committed
Add updating Activity assignee
1 parent 395daa6 commit f0cda95

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

.changeset/violet-lemons-burn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@plotday/twister": patch
3+
---
4+
5+
Added: Update Activity assignee

twister/src/plot.ts

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,45 @@ export type Activity = ActivityCommon & {
248248
title: string | null;
249249
/** The type of activity (Note, Task, or Event) */
250250
type: ActivityType;
251-
/** Who this activity note is assigned to */
251+
/**
252+
* The actor assigned to this activity.
253+
*
254+
* **For actions (tasks):** An assignee is required. If not explicitly provided when creating
255+
* an action, the assignee will default to the user who installed the twist (the twist owner).
256+
*
257+
* **For notes and events:** Assignee is optional and typically null.
258+
*
259+
* @example
260+
* ```typescript
261+
* // Create action with explicit assignee
262+
* const task: NewActivity = {
263+
* type: ActivityType.Action,
264+
* title: "Review PR #123",
265+
* assignee: {
266+
* id: userId as ActorId,
267+
* type: ActorType.User,
268+
* name: "Alice"
269+
* }
270+
* };
271+
*
272+
* // Create action with auto-assignment (defaults to twist owner)
273+
* const task: NewActivity = {
274+
* type: ActivityType.Action,
275+
* title: "Follow up on email"
276+
* // assignee will be set automatically to twist owner
277+
* };
278+
*
279+
* // Update assignee
280+
* await plot.updateActivity({
281+
* id: activityId,
282+
* assignee: {
283+
* id: newUserId as ActorId,
284+
* type: ActorType.User,
285+
* name: "Bob"
286+
* }
287+
* });
288+
* ```
289+
*/
252290
assignee: Actor | null;
253291
/** Timestamp when the activity was marked as complete. Null if not completed. */
254292
doneAt: Date | null;
@@ -403,6 +441,7 @@ export type ActivityUpdate = Pick<Activity, "id"> &
403441
| "end"
404442
| "doneAt"
405443
| "title"
444+
| "assignee"
406445
| "draft"
407446
| "private"
408447
| "meta"

0 commit comments

Comments
 (0)