-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
421 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
packages/api/src/ticketing/@utils/@registry/registry.service.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/api/src/ticketing/attachment/attachment.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,34 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { AttachmentController } from './attachment.controller'; | ||
import { SyncAttachmentsService } from './sync/sync.service'; | ||
import { LoggerService } from '@@core/logger/logger.service'; | ||
import { ZendeskAttachmentService } from './services/zendesk'; | ||
import { AttachmentService } from './services/attachment.service'; | ||
import { AttachmentServiceRegistry } from './services/registry.service'; | ||
import { EncryptionService } from '@@core/encryption/encryption.service'; | ||
import { FieldMappingService } from '@@core/field-mapping/field-mapping.service'; | ||
import { PrismaService } from '@@core/prisma/prisma.service'; | ||
import { WebhookService } from '@@core/webhook/webhook.service'; | ||
import { BullModule } from '@nestjs/bull'; | ||
|
||
@Module({ | ||
imports: [ | ||
BullModule.registerQueue({ | ||
name: 'webhookDelivery', | ||
}), | ||
], | ||
controllers: [AttachmentController], | ||
providers: [ | ||
AttachmentService, | ||
PrismaService, | ||
ZendeskAttachmentService, | ||
LoggerService, | ||
SyncAttachmentsService, | ||
WebhookService, | ||
EncryptionService, | ||
FieldMappingService, | ||
AttachmentServiceRegistry, | ||
], | ||
exports: [SyncAttachmentsService], | ||
}) | ||
export class AttachmentModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/api/src/ticketing/attachment/services/registry.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { IAttachmentService } from '../types'; | ||
import { ZendeskAttachmentService } from './zendesk'; | ||
|
||
@Injectable() | ||
export class AttachmentServiceRegistry { | ||
private serviceMap: Map<string, IAttachmentService>; | ||
|
||
constructor(zendesk: ZendeskAttachmentService) { | ||
//TODO | ||
this.serviceMap = new Map<string, IAttachmentService>(); | ||
this.serviceMap.set('zendesk_t', zendesk); | ||
} | ||
|
||
getService(integrationId: string): IAttachmentService { | ||
const service = this.serviceMap.get(integrationId); | ||
if (!service) { | ||
throw new Error(`Service not found for integration ID: ${integrationId}`); | ||
} | ||
return service; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { EncryptionService } from '@@core/encryption/encryption.service'; | ||
import { EnvironmentService } from '@@core/environment/environment.service'; | ||
import { LoggerService } from '@@core/logger/logger.service'; | ||
import { PrismaService } from '@@core/prisma/prisma.service'; | ||
import { ApiResponse } from '@@core/utils/types'; | ||
import { DesunifyReturnType } from '@@core/utils/types/desunify.input'; | ||
import { Injectable } from '@nestjs/common'; | ||
import { | ||
TicketingObject, | ||
ZendeskAttachmentInput, | ||
} from '@ticketing/@utils/@types'; | ||
import { IAttachmentService } from '@ticketing/attachment/types'; | ||
|
||
@Injectable() | ||
export class ZendeskAttachmentService implements IAttachmentService { | ||
constructor( | ||
private prisma: PrismaService, | ||
private logger: LoggerService, | ||
private cryptoService: EncryptionService, | ||
private env: EnvironmentService, | ||
) { | ||
this.logger.setContext( | ||
TicketingObject.attachment.toUpperCase() + | ||
':' + | ||
ZendeskAttachmentService.name, | ||
); | ||
} | ||
addAttachment( | ||
attachmentData: DesunifyReturnType, | ||
linkedUserId: string, | ||
): Promise<ApiResponse<ZendeskAttachmentInput>> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
syncAttachments( | ||
linkedUserId: string, | ||
custom_properties?: string[], | ||
): Promise<ApiResponse<ZendeskAttachmentInput[]>> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/api/src/ticketing/comment/services/registry.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { ZendeskCommentService } from './zendesk'; | ||
import { ICommentService } from '../types'; | ||
|
||
@Injectable() | ||
export class CommentServiceRegistry { | ||
private serviceMap: Map<string, ICommentService>; | ||
|
||
constructor(zendesk: ZendeskCommentService) { | ||
//TODO | ||
this.serviceMap = new Map<string, ICommentService>(); | ||
this.serviceMap.set('zendesk_t', zendesk); | ||
} | ||
|
||
getService(integrationId: string): ICommentService { | ||
const service = this.serviceMap.get(integrationId); | ||
if (!service) { | ||
throw new Error(`Service not found for integration ID: ${integrationId}`); | ||
} | ||
return service; | ||
} | ||
} |
Oops, something went wrong.