Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

arcoraven
Copy link
Contributor

@arcoraven arcoraven commented Apr 24, 2025

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

  • Added engineCloud configuration to packages/service-utils/src/core/api.ts.
  • Introduced TeamPlan type to manage billing and support plans in TeamResponse.
  • Updated fetchTeamAndProject to use incomingServiceApiKey.
  • Implemented updateTicketAction for ticket updates with error handling.
  • Created addMessageToTicketAction for adding messages to tickets.
  • Developed listTicketsAction for retrieving a list of tickets.
  • Enhanced getTicketAction for fetching ticket details and messages.
  • Introduced getUnthreadConversation for conversation retrieval.
  • Added validation for customer IDs and user permissions across actions.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@arcoraven arcoraven requested review from a team as code owners April 24, 2025 10:05
Copy link

changeset-bot bot commented Apr 24, 2025

⚠️ No Changeset found

Latest commit: c90d625

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Apr 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
thirdweb-www ❌ Failed (Inspect) Apr 29, 2025 7:51pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) Apr 29, 2025 7:51pm
login ⬜️ Skipped (Inspect) Apr 29, 2025 7:51pm
thirdweb_playground ⬜️ Skipped (Inspect) Apr 29, 2025 7:51pm
wallet-ui ⬜️ Skipped (Inspect) Apr 29, 2025 7:51pm

Copy link
Contributor

graphite-app bot commented Apr 24, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Apr 24, 2025
},
body: JSON.stringify({
body: {
type: "markdown",
Copy link
Contributor Author

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.

@vercel vercel bot temporarily deployed to Preview – thirdweb_playground April 24, 2025 10:13 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 April 24, 2025 10:13 Inactive
@vercel vercel bot temporarily deployed to Preview – login April 24, 2025 10:13 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui April 24, 2025 10:13 Inactive
@@ -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.
Copy link
Contributor Author

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.

Comment on lines +9 to +17
type GetTicketResponse =
| {
success: false;
message: string;
}
| {
success: true;
result: UnthreadMessagesResponse;
};
Copy link
Contributor Author

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?

Comment on lines +101 to +107
where: [
{
field: "customerId",
operator: "==",
value: customerId,
},
],
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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) {
Copy link
Contributor Author

@arcoraven arcoraven Apr 24, 2025

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) {
Copy link
Contributor Author

@arcoraven arcoraven Apr 24, 2025

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.

Comment on lines +4 to +7
import { getTeamById } from "@/api/team";
import { getUnthreadConversation } from "lib/unthread/get-conversation";
import { getRawAccount } from "../../../../account/settings/getAccount";
import { loginRedirect } from "../../../../login/loginRedirect";
Copy link
Contributor Author

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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vercel vercel bot temporarily deployed to Preview – login April 24, 2025 10:21 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 April 24, 2025 10:21 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui April 24, 2025 10:21 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground April 24, 2025 10:21 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Involves changes to the Dashboard. packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant