-
Notifications
You must be signed in to change notification settings - Fork 526
chore: Add support CRUD endpoints #6836
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
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
}, | ||
body: JSON.stringify({ | ||
body: { | ||
type: "markdown", |
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.
Supports HTML and markdown. I'm assuming we'll have a markdown editor.
Uploads are not supported yet.
@@ -98,6 +98,7 @@ export async function createTicketAction( | |||
loginRedirect("/support"); | |||
} | |||
|
|||
// @TODO: This needs to be updated to use team.unthreadCustomerId after all users are migrated. |
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.
This will need to update to use team.unthreadCustomerId
for the other endpoints to start working.
type GetTicketResponse = | ||
| { | ||
success: false; | ||
message: string; | ||
} | ||
| { | ||
success: true; | ||
result: UnthreadMessagesResponse; | ||
}; |
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.
Does this response format make sense?
where: [ | ||
{ | ||
field: "customerId", | ||
operator: "==", | ||
value: customerId, | ||
}, | ||
], |
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.
Ensure we only return conversations for this customer.
|
||
// Get the conversation first to confirm the user has permissions to update this ticket. | ||
const conversation = await getUnthreadConversation(conversationId); | ||
if (!conversation || conversation.customerId !== customerId) { |
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.
Ensure we only return conversations for this customer.
|
||
// Get the conversation first to confirm the user has permissions to update this ticket. | ||
const conversation = await getUnthreadConversation(conversationId); | ||
if (!conversation || conversation.customerId !== customerId) { |
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.
Ensure we only update conversations for this customer.
|
||
// Get the conversation first to confirm the user has permissions to update this ticket. | ||
const conversation = await getUnthreadConversation(conversationId); | ||
if (!conversation || conversation.customerId !== customerId) { |
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.
Ensure we only update conversations for this customer.
import { getTeamById } from "@/api/team"; | ||
import { getUnthreadConversation } from "lib/unthread/get-conversation"; | ||
import { getRawAccount } from "../../../../account/settings/getAccount"; | ||
import { loginRedirect } from "../../../../login/loginRedirect"; |
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.
My editor autocompleted these. Are mixed absolute/relative paths fine?
"use server"; | ||
import "server-only"; | ||
|
||
interface UnthreadUser { |
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.
Source: Unthread API docs
Adds CRUD server actions to list, create, and update support tickets
PR-Codex overview
This PR focuses on enhancing the ticketing system by introducing new functionalities for creating, updating, and retrieving tickets. It includes updates to type definitions and improvements in error handling and validation throughout the ticket management process.
Detailed summary
engineCloud
configuration topackages/service-utils/src/core/api.ts
.TeamPlan
type to manage billing and support plans inTeamResponse
.fetchTeamAndProject
to useincomingServiceApiKey
.updateTicketAction
for ticket updates with error handling.addMessageToTicketAction
for adding messages to tickets.listTicketsAction
for retrieving a list of tickets.getTicketAction
for fetching ticket details and messages.getUnthreadConversation
for conversation retrieval.