Skip to content

Conversation

@arpandhakal
Copy link
Collaborator

Changes

  • created a separate service file name public.service for tasks
  • created a separate abstract service which inherits base service and extended by PublicTasksService and TasksService. This file contains all the utilities shared by both of the services.
  • changed methods in public.controller for tasks
  • refactored tasks service

@arpandhakal arpandhakal self-assigned this Jan 6, 2026
@linear
Copy link

linear bot commented Jan 6, 2026

@vercel
Copy link
Contributor

vercel bot commented Jan 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
tasks-app Ready Ready Preview, Comment Jan 12, 2026 0:47am

Comment on lines 305 to 313
async canCreateSubTask(taskId: string): Promise<boolean> {
const parentPath = await this.getPathOfTask(taskId)
if (!parentPath) {
throw new APIError(httpStatus.NOT_FOUND, 'The requested parent task was not found')
}
const uuidLength = parentPath.split('.').length
if (!uuidLength) return true
return uuidLength <= maxSubTaskDepth
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We seem to be missing policy-level authorization here

Comment on lines 315 to 324
async getPathOfTask(id: string) {
return (
await this.db.$queryRaw<{ path: string }[] | null>`
SELECT "path"
FROM "Tasks"
WHERE id::text = ${id}
AND "workspaceId" = ${this.user.workspaceId}
`
)?.[0]?.path
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming we use this method directly from controller, we are missing policy service authorization

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not used directly from the controller. These are utilities used by the create task method from public and web api. The policy service authorization is already used in the main method calling these utilities. However, I modified the access scope of these methods to make them more secure. Thanks!

Copy link
Collaborator

@rrojan rrojan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🏆

@arpandhakal arpandhakal changed the base branch from feature/tdb2 to OUT-2844 January 12, 2026 10:50
@arpandhakal arpandhakal changed the base branch from OUT-2844 to feature/tdb2 January 12, 2026 12:44
- created a separate service file name public.service for tasks
- created a separate abstract service which inherits base service and extended by PublicTasksService and TasksService. This file contains all the utilities shared by both of the services.
- changed methods in public.controller for tasks
- refactored tasks service
…rom both services using the template pattern
@arpandhakal arpandhakal merged commit 1bb373d into feature/tdb2 Jan 12, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants