-
Notifications
You must be signed in to change notification settings - Fork 0
feat: share todo with email #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Files not reviewed (1)
- .env: Language not supported
Deno.test("POST /api/todos/share shares a todo with a user", async () => { | ||
const shareData = { todoId: 1, userId: 2 }; | ||
const response = await mockRequest("POST", "http://localhost:8080/api/todos/share", shareData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test URL for sharing a todo is missing the required todo id parameter as per the endpoint '/api/todos/:id/share'. Please update the URL to include an id, for example, '/api/todos/1/share'.
Deno.test("POST /api/todos/share shares a todo with a user", async () => { | |
const shareData = { todoId: 1, userId: 2 }; | |
const response = await mockRequest("POST", "http://localhost:8080/api/todos/share", shareData); | |
Deno.test("POST /api/todos/:id/share shares a todo with a user", async () => { | |
const shareData = { todoId: 1, userId: 2 }; | |
const response = await mockRequest("POST", "http://localhost:8080/api/todos/1/share", shareData); |
Copilot uses AI. Check for mistakes.
// Important: Check that todo hasn't been shared with the same user | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deduplication check for shared recipients mentioned in the comment is not implemented. Consider adding logic to prevent sharing the same todo with duplicate email addresses.
// Important: Check that todo hasn't been shared with the same user | |
// Important: Check that todo hasn't been shared with the same user | |
const deduplicatedSharedWith = Array.from(new Set(validatedBody.sharedWith)); |
Copilot uses AI. Check for mistakes.
@@ -27,6 +27,7 @@ deno run test | |||
- GET /api/todos - Retrieves all todos. | |||
- GET /api/todos/:id - Retrieves a specific todo by ID. | |||
- POST /api/todos - Creates a new todo | |||
- POST /api/todos/:id/shar - Shares an existing todo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The share endpoint path appears to be misspelled as '/shar'. Please correct it to '/share' to match the implementation.
- POST /api/todos/:id/shar - Shares an existing todo | |
- POST /api/todos/:id/share - Shares an existing todo |
Copilot uses AI. Check for mistakes.
updatedAt: new Date().toISOString(), | ||
sharedWith: inputTodo.sharedWith ?? ["[email protected]"], | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A hardcoded default email value is used when sharedWith is not provided. Consider removing or parameterizing this default to avoid unexpected behavior in production.
updatedAt: new Date().toISOString(), | |
sharedWith: inputTodo.sharedWith ?? ["[email protected]"], | |
}; | |
updatedAt: new Date().toISOString() | |
}; | |
if (inputTodo.sharedWith) { | |
this.todos[inputId].sharedWith = inputTodo.sharedWith; | |
} |
Copilot uses AI. Check for mistakes.
Added POST
/api/todos/:id/share
endpoint that will allow one to share a todo with one or many people over email.Edit: Secretly testing Copilot 👀