Skip to content

update support ticket to support categories, project, and target options #6689

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 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3be1fcf
update support ticket to support categories, project, and target options
Apr 1, 2025
5bcf8e6
Merge branch 'main' into support-ticket-updates
egoodwinx Apr 2, 2025
a34b349
Merge branch 'graphql-hive:main' into support-ticket-updates
egoodwinx Apr 3, 2025
23c28a4
address comments
Apr 3, 2025
a40fdbf
Merge branch 'main' into support-ticket-updates
egoodwinx Apr 4, 2025
4feb3ff
Merge branch 'graphql-hive:main' into support-ticket-updates
egoodwinx Apr 6, 2025
c0cce7b
added resolver logic
Apr 6, 2025
24677e8
Merge branch 'main' into support-ticket-updates
jdolle Apr 14, 2025
c88dd7b
Merge branch 'graphql-hive:main' into support-ticket-updates
egoodwinx Apr 15, 2025
edf992c
Merge branch 'graphql-hive:main' into support-ticket-updates
egoodwinx Apr 16, 2025
35326cf
Merge branch 'graphql-hive:main' into support-ticket-updates
egoodwinx May 1, 2025
e41ece0
Merge branch 'graphql-hive:main' into support-ticket-updates
egoodwinx May 6, 2025
5f0d6ac
update ticket message and optional category metadata
Apr 16, 2025
d6217f5
remove category, project, target from schema since its in the body, u…
May 6, 2025
fbf0c63
Merge branch 'main' into support-ticket-updates
jdolle May 7, 2025
9c8bf4a
update to fix lint errors
May 15, 2025
e76a0b1
Merge branch 'main' into support-ticket-updates
jdolle May 15, 2025
9a162e5
fix SupportCategoryType typecheck errors
May 19, 2025
f5f1438
Merge branch 'main' into support-ticket-updates
egoodwinx May 19, 2025
a08864a
Merge branch 'main' into support-ticket-updates
egoodwinx Jun 1, 2025
1bd9716
Merge branch 'main' into support-ticket-updates
jdolle Jun 2, 2025
d412ed0
Merge branch 'main' into support-ticket-updates
egoodwinx Jun 8, 2025
24bf245
pnpm prettier and lint fixes
Jun 23, 2025
a2e5a12
fix merge issues
Jun 23, 2025
fc84dea
Merge branch 'main' into support-ticket-updates
jdolle Jun 23, 2025
f979a00
fix typecheck
Jun 24, 2025
539a7d2
fix lint issue
Jun 24, 2025
63b812a
fix prettier
Jun 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ export const AuditLogModel = z.union([
metadata: z.object({
ticketId: z.string(),
ticketSubject: z.string(),
ticketCategory: z.string(),
ticketProject: z.string(),
ticketTarget: z.string(),
ticketDescription: z.string(),
ticketPriority: z.string(),
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { createHash } from 'node:crypto';
import { Inject, Injectable, Scope } from 'graphql-modules';
import { z } from 'zod';
import { Organization, SupportTicketPriority, SupportTicketStatus } from '../../../shared/entities';
import {
Organization,
SupportCategory,
SupportTicketPriority,
SupportTicketStatus,
} from '../../../shared/entities';
import { atomic } from '../../../shared/helpers';
import { AuditLogRecorder } from '../../audit-logs/providers/audit-log-recorder';
import { Session } from '../../auth/lib/authz';
Expand All @@ -10,7 +15,6 @@ import { Logger } from '../../shared/providers/logger';
import { Storage } from '../../shared/providers/storage';
import { OrganizationManager } from './../../organization/providers/organization-manager';
import { SUPPORT_MODULE_CONFIG, type SupportConfig } from './config';
import { SupportCategory } from 'packages/libraries/core/src/client/__generated__/types';

export const SupportTicketPriorityAPIModel = z.enum(['low', 'normal', 'high', 'urgent']);
export const SupportTicketStatusAPIModel = z.enum([
Expand All @@ -24,7 +28,7 @@ export const SupportTicketStatusAPIModel = z.enum([

export const SupportTicketPriorityModel = z.nativeEnum(SupportTicketPriority);
export const SupportTicketStatusModel = z.nativeEnum(SupportTicketStatus);
export const SupportTicketCategoryModel = z.nativeEnum(SupportCategory);
export const SupportTicketCategoryModel = z.nativeEnum(SupportCategory).optional();

const SupportTicketModel = z.object({
id: z.number(),
Expand Down Expand Up @@ -516,6 +520,9 @@ export class SupportManager {
organizationId: string;
subject: string;
description: string;
category?: SupportCategory;
project?: string;
target?: string;
priority: z.infer<typeof SupportTicketPriorityModel>;
}) {
this.logger.info(
Expand Down Expand Up @@ -557,6 +564,9 @@ export class SupportManager {
subject: input.subject,
description: input.description,
priority: input.priority,
category: input.category,
project: input.project,
target: input.target,
// version is here to cache bust the idempotency key.
version: 'v2',
}),
Expand All @@ -568,6 +578,12 @@ export class SupportManager {
});
const customerType = this.resolveCustomerType(organization);

const formattedBody = ` "Category: " + ${request.data.category ? request.data.category : null}\n\n
"Project: " + ${request.data.project ? request.data.project : null}\n\n
"Target: " + ${request.data.target ? request.data.target : null}\n\n
"Description: " + ${request.data.description}
`;

const response = await this.httpClient
.post(`https://${this.config.subdomain}.zendesk.com/api/v2/tickets`, {
username: this.config.username,
Expand All @@ -578,7 +594,7 @@ export class SupportManager {
submitter_id: parseInt(internalUserId, 10),
requester_id: parseInt(internalUserId, 10),
comment: {
body: request.data.description,
body: formattedBody,
},
priority: request.data.priority,
subject: request.data.subject,
Expand Down Expand Up @@ -606,6 +622,9 @@ export class SupportManager {
metadata: {
ticketDescription: input.description,
ticketPriority: input.priority,
ticketCategory: input.category ?? '',
ticketProject: input.project ?? '',
ticketTarget: input.target ?? '',
ticketId: String(response.ticket.id),
ticketSubject: input.subject,
},
Expand Down
7 changes: 7 additions & 0 deletions packages/services/api/src/shared/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ export enum SupportTicketPriority {
URGENT = 'urgent',
}

export enum SupportCategory {
Billing = 'BILLING',
Compliance = 'COMPLIANCE',
Other = 'OTHER',
TechnicalIssue = 'TECHNICAL_ISSUE',
}

export enum SupportTicketStatus {
OPEN = 'open',
SOLVED = 'solved',
Expand Down