[SILO-1142] feat: add epics write endpoints#37
Conversation
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 25 minutes and 41 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughThis PR extends the Plane Node SDK with comprehensive epic management capabilities, adding CRUD operations ( Changes
Sequence DiagramsequenceDiagram
participant Client as SDK Client
participant EpicAPI as Epics API
participant Backend as Backend Service
rect rgba(76, 175, 80, 0.5)
Note over Client,Backend: Epic Lifecycle Operations
Client->>EpicAPI: create(workspaceSlug, projectId, data)
EpicAPI->>Backend: POST /epics
Backend-->>EpicAPI: Epic
EpicAPI-->>Client: Epic
Client->>EpicAPI: listIssues(workspaceSlug, projectId, epicId)
EpicAPI->>Backend: GET /epics/{epicId}/issues
Backend-->>EpicAPI: PaginatedResponse<EpicIssue>
EpicAPI-->>Client: PaginatedResponse<EpicIssue>
Client->>EpicAPI: addIssues(workspaceSlug, projectId, epicId, data)
EpicAPI->>Backend: POST /epics/{epicId}/issues
Backend-->>EpicAPI: EpicIssue[]
EpicAPI-->>Client: EpicIssue[]
Client->>EpicAPI: update(workspaceSlug, projectId, epicId, data)
EpicAPI->>Backend: PATCH /epics/{epicId}
Backend-->>EpicAPI: Epic
EpicAPI-->>Client: Epic
Client->>EpicAPI: delete(workspaceSlug, projectId, epicId)
EpicAPI->>Backend: DELETE /epics/{epicId}
Backend-->>EpicAPI: void
EpicAPI-->>Client: void
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (5)
src/api/Epics.ts (3)
57-57: Avoid usinganytype for theparamsparameter.Per coding guidelines, avoid
anytypes. Consider defining a proper interface for pagination/filter parameters.♻️ Example typed params
// In src/models/common.ts or similar export interface PaginationParams { cursor?: string; per_page?: number; // Add other common filter params as needed }Then use:
- params?: any + params?: PaginationParamsAs per coding guidelines: "Avoid
anytypes; use proper typing orunknownwith type guards"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/api/Epics.ts` at line 57, Replace the untyped params?: any with a proper typed interface: define and export an interface (e.g., PaginationParams) in a shared models file (suggested: src/models/common.ts) that includes cursor?: string, per_page?: number and any other expected filter keys, import that interface into src/api/Epics.ts, and change the function signature from params?: any to params?: PaginationParams (or params?: PaginationParams | Record<string, unknown> if free-form keys remain); update any call sites or runtime handling to satisfy the new type (or add a small type-guard/conversion if runtime values need validation) and remove the any usage.
53-63: Method names use "Issues" instead of "WorkItems", violating naming guideline.The coding guidelines specify: "Never use 'Issue' in names — always use 'Work Item'". Consider renaming:
listIssues→listWorkItemsaddIssues→addWorkItems♻️ Suggested renames
/** - * List work items under an epic + * List work items under an epic */ - async listIssues( + async listWorkItems( workspaceSlug: string, projectId: string, epicId: string, params?: any ): Promise<PaginatedResponse<EpicIssue>> {/** - * Add work items as sub-issues under an epic + * Add work items under an epic */ - async addIssues( + async addWorkItems( workspaceSlug: string, projectId: string, epicId: string, data: AddEpicWorkItems ): Promise<EpicIssue[]> {As per coding guidelines: "Never use 'Issue' in names — always use 'Work Item'"
Also applies to: 68-78
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/api/Epics.ts` around lines 53 - 63, The public API methods and types using "Issue" must be renamed to "WorkItem": rename the method listIssues to listWorkItems (and any addIssues to addWorkItems), update return/type names like EpicIssue to EpicWorkItem (and any related parameter or interface names), and update all internal references and imports/usages (e.g., in class Epics, callers of listIssues/addIssues, and overloads) so signatures and documentation reflect the new names while preserving behavior and types; ensure exported symbols and tests are updated accordingly to avoid breaking imports.
39-41: Consider renamingdeletetodelto match the standard pattern.Per coding guidelines, standard resource methods should follow the pattern:
list,create,retrieve,update,del. This method is nameddeleteinstead ofdel.♻️ Suggested rename
- async delete(workspaceSlug: string, projectId: string, epicId: string): Promise<void> { + async del(workspaceSlug: string, projectId: string, epicId: string): Promise<void> { return this.httpDelete(`/workspaces/${workspaceSlug}/projects/${projectId}/epics/${epicId}/`); }As per coding guidelines: "Standard resource methods should follow the pattern:
list,create,retrieve,update,del"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/api/Epics.ts` around lines 39 - 41, Rename the method named delete to del on the Epics class: change the method signature async delete(...) to async del(...) but keep the same parameters and return this.httpDelete(`/workspaces/${workspaceSlug}/projects/${projectId}/epics/${epicId}/`);; update all internal references/callers, any interface/type declarations, and exports that referenced Epics.delete to use Epics.del so callers compile; run tests/type-checking to ensure no remaining references to the old name.src/models/Epic.ts (2)
51-64: DeriveUpdateEpicfromCreateEpicusingPartial.Per coding guidelines, DTOs should be derived using
Pick,Omit, andPartial. SinceUpdateEpichas the exact same fields asCreateEpicbut all optional, it can be derived:♻️ Suggested derivation
-export interface UpdateEpic { - name?: string; - description_html?: string; - state_id?: string; - parent_id?: string; - assignee_ids?: string[]; - label_ids?: string[]; - priority?: PriorityEnum; - start_date?: string; - target_date?: string; - estimate_point?: string; - external_source?: string; - external_id?: string; -} +export type UpdateEpic = Partial<CreateEpic>;As per coding guidelines: "Models should use TypeScript interfaces with separate Create/Update DTOs derived using Pick, Omit, and Partial"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/models/Epic.ts` around lines 51 - 64, Replace the explicit UpdateEpic interface with a derived type from CreateEpic so all fields become optional; specifically change UpdateEpic to be a Partial of CreateEpic (e.g., type UpdateEpic = Partial<CreateEpic>), ensuring you reference the existing CreateEpic declaration and remove the duplicated field list in the UpdateEpic declaration.
70-102: RenameEpicIssuetoEpicWorkItemto comply with naming guideline.The coding guidelines specify: "Never use 'Issue' in names — always use 'Work Item'".
♻️ Suggested rename
-export interface EpicIssue { +export interface EpicWorkItem { id: string; type_id?: string | null; // ... rest of fields }Also update the API methods in
src/api/Epics.tsto useEpicWorkIteminstead ofEpicIssue.As per coding guidelines: "Never use 'Issue' in names — always use 'Work Item'"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/models/Epic.ts` around lines 70 - 102, Rename the EpicIssue type to EpicWorkItem throughout the codebase: update the interface declaration name (EpicIssue → EpicWorkItem) and any references/imports that use EpicIssue (notably in src/api/Epics.ts) to the new symbol; ensure exported/imported names and JSDoc/type annotations are updated, and run/type-check to catch missed usages so all functions, method signatures, and types now reference EpicWorkItem.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/api/Epics.ts`:
- Line 57: Replace the untyped params?: any with a proper typed interface:
define and export an interface (e.g., PaginationParams) in a shared models file
(suggested: src/models/common.ts) that includes cursor?: string, per_page?:
number and any other expected filter keys, import that interface into
src/api/Epics.ts, and change the function signature from params?: any to
params?: PaginationParams (or params?: PaginationParams | Record<string,
unknown> if free-form keys remain); update any call sites or runtime handling to
satisfy the new type (or add a small type-guard/conversion if runtime values
need validation) and remove the any usage.
- Around line 53-63: The public API methods and types using "Issue" must be
renamed to "WorkItem": rename the method listIssues to listWorkItems (and any
addIssues to addWorkItems), update return/type names like EpicIssue to
EpicWorkItem (and any related parameter or interface names), and update all
internal references and imports/usages (e.g., in class Epics, callers of
listIssues/addIssues, and overloads) so signatures and documentation reflect the
new names while preserving behavior and types; ensure exported symbols and tests
are updated accordingly to avoid breaking imports.
- Around line 39-41: Rename the method named delete to del on the Epics class:
change the method signature async delete(...) to async del(...) but keep the
same parameters and return
this.httpDelete(`/workspaces/${workspaceSlug}/projects/${projectId}/epics/${epicId}/`);;
update all internal references/callers, any interface/type declarations, and
exports that referenced Epics.delete to use Epics.del so callers compile; run
tests/type-checking to ensure no remaining references to the old name.
In `@src/models/Epic.ts`:
- Around line 51-64: Replace the explicit UpdateEpic interface with a derived
type from CreateEpic so all fields become optional; specifically change
UpdateEpic to be a Partial of CreateEpic (e.g., type UpdateEpic =
Partial<CreateEpic>), ensuring you reference the existing CreateEpic declaration
and remove the duplicated field list in the UpdateEpic declaration.
- Around line 70-102: Rename the EpicIssue type to EpicWorkItem throughout the
codebase: update the interface declaration name (EpicIssue → EpicWorkItem) and
any references/imports that use EpicIssue (notably in src/api/Epics.ts) to the
new symbol; ensure exported/imported names and JSDoc/type annotations are
updated, and run/type-check to catch missed usages so all functions, method
signatures, and types now reference EpicWorkItem.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 392da9eb-667f-4692-b2e4-a96470881719
📒 Files selected for processing (4)
package.jsonsrc/api/Epics.tssrc/models/Epic.tstests/unit/epic.test.ts
Description
Type of Change
Test Scenarios