From 593157d489695e71fcae761560dc28d2dac3141b Mon Sep 17 00:00:00 2001 From: nael Date: Fri, 21 Jun 2024 19:47:01 +0200 Subject: [PATCH] :sparkles: New unified code --- packages/api/prisma/schema.prisma | 8 +- packages/api/scripts/commonObject.sh | 15 +- .../services/freeagent/freeagent.service.ts | 1 + .../services/freshbooks/freshbooks.service.ts | 1 + .../services/moneybird/moneybird.service.ts | 1 + .../services/pennylane/pennylane.service.ts | 1 + .../services/quickbooks/quickbooks.service.ts | 1 + .../accounting/services/sage/sage.service.ts | 1 + .../wave_financial/wave_financial.service.ts | 1 + .../accounting/services/xero/xero.service.ts | 1 + .../ats/services/ashby/ashby.service.ts | 1 + .../ats/services/bamboohr/bamboohr.service.ts | 1 + .../services/greenhouse/greenhouse.service.ts | 1 + .../ats/services/jobadder/jobadder.service.ts | 1 + .../ats/services/lever/lever.service.ts | 1 + .../ats/services/workday/workday.service.ts | 1 + .../crm/services/accelo/accelo.service.ts | 1 + .../crm/services/affinity/affinity.service.ts | 1 + .../crm/services/attio/attio.service.ts | 1 + .../crm/services/capsule/capsule.service.ts | 1 + .../crm/services/close/close.service.ts | 1 + .../crm/services/copper/copper.service.ts | 1 + .../crm/services/hubspot/hubspot.service.ts | 1 + .../crm/services/keap/keap.service.ts | 1 + .../services/pipedrive/pipedrive.service.ts | 1 + .../services/teamleader/teamleader.service.ts | 1 + .../crm/services/teamwork/teamwork.service.ts | 1 + .../crm/services/zendesk/zendesk.service.ts | 1 + .../crm/services/zoho/zoho.service.ts | 1 + .../filestorage/services/box/box.service.ts | 1 + .../services/dropbox/dropbox.service.ts | 1 + .../google_drive/google_drive.service.ts | 1 + .../services/onedrive/onedrive.service.ts | 1 + .../services/sharepoint/sharepoint.service.ts | 1 + .../services/bamboohr/bamboohr.service.ts | 1 + .../hris/services/deel/deel.service.ts | 1 + .../services/factorial/factorial.service.ts | 1 + .../hris/services/gusto/gusto.service.ts | 1 + .../hris/services/namely/namely.service.ts | 1 + .../hris/services/payfit/payfit.service.ts | 1 + .../services/rippling/rippling.service.ts | 1 + .../services/notion/notion.service.ts | 1 + .../services/slack/slack.service.ts | 1 + .../services/brevo/brevo.service.ts | 1 + .../getresponse/getresponse.service.ts | 1 + .../services/keap/keap.service.ts | 1 + .../services/klaviyo/klaviyo.service.ts | 1 + .../services/mailchimp/mailchimp.service.ts | 1 + .../services/podium/podium.service.ts | 1 + .../ticketing/services/aha/aha.service.ts | 1 + .../ticketing/services/asana/asana.service.ts | 1 + .../services/clickup/clickup.service.ts | 1 + .../ticketing/services/dixa/dixa.service.ts | 1 + .../ticketing/services/front/front.service.ts | 1 + .../services/github/github.service.ts | 1 + .../services/gitlab/gitlab.service.ts | 1 + .../services/gorgias/gorgias.service.ts | 1 + .../services/helpscout/helpscout.service.ts | 1 + .../services/ironclad/ironclad.service.ts | 1 + .../ticketing/services/jira/jira.service.ts | 1 + .../services/linear/linear.service.ts | 1 + .../ticketing/services/wrike/wrike.service.ts | 1 + .../services/zendesk/zendesk.service.ts | 1 + .../types/original/original.file-storage.ts | 20 +- .../accounting/account/account.controller.ts | 11 +- .../src/accounting/account/account.module.ts | 1 + .../accounting/address/address.controller.ts | 11 +- .../src/accounting/address/address.module.ts | 1 + .../attachment/attachment.controller.ts | 11 +- .../attachment/attachment.module.ts | 1 + .../balancesheet/balancesheet.controller.ts | 11 +- .../balancesheet/balancesheet.module.ts | 1 + .../cashflowstatement.controller.ts | 11 +- .../cashflowstatement.module.ts | 1 + .../companyinfo/companyinfo.controller.ts | 11 +- .../companyinfo/companyinfo.module.ts | 1 + .../accounting/contact/contact.controller.ts | 11 +- .../src/accounting/contact/contact.module.ts | 1 + .../creditnote/creditnote.controller.ts | 11 +- .../creditnote/creditnote.module.ts | 1 + .../accounting/expense/expense.controller.ts | 11 +- .../src/accounting/expense/expense.module.ts | 1 + .../incomestatement.controller.ts | 11 +- .../incomestatement/incomestatement.module.ts | 1 + .../accounting/invoice/invoice.controller.ts | 11 +- .../src/accounting/invoice/invoice.module.ts | 1 + .../src/accounting/item/item.controller.ts | 11 +- .../api/src/accounting/item/item.module.ts | 1 + .../journalentry/journalentry.controller.ts | 11 +- .../journalentry/journalentry.module.ts | 1 + .../accounting/payment/payment.controller.ts | 11 +- .../src/accounting/payment/payment.module.ts | 1 + .../phonenumber/phonenumber.controller.ts | 11 +- .../phonenumber/phonenumber.module.ts | 1 + .../purchaseorder/purchaseorder.controller.ts | 11 +- .../purchaseorder/purchaseorder.module.ts | 1 + .../accounting/taxrate/taxrate.controller.ts | 11 +- .../src/accounting/taxrate/taxrate.module.ts | 1 + .../trackingcategory.controller.ts | 11 +- .../trackingcategory.module.ts | 1 + .../transaction/transaction.controller.ts | 11 +- .../transaction/transaction.module.ts | 1 + .../vendorcredit/vendorcredit.controller.ts | 11 +- .../vendorcredit/vendorcredit.module.ts | 1 + .../src/ats/activity/activity.controller.ts | 8 +- .../api/src/ats/activity/activity.module.ts | 1 + .../src/ats/activity/types/mappingsTypes.ts | 1 - .../src/ats/activity/types/model.unified.ts | 78 +++- .../ats/application/application.controller.ts | 8 +- .../src/ats/application/application.module.ts | 1 + .../ats/application/types/mappingsTypes.ts | 1 - .../ats/application/types/model.unified.ts | 109 ++++- .../ats/attachment/attachment.controller.ts | 8 +- .../src/ats/attachment/attachment.module.ts | 1 + .../src/ats/attachment/types/mappingsTypes.ts | 1 - .../src/ats/attachment/types/model.unified.ts | 72 +++- .../src/ats/candidate/candidate.controller.ts | 8 +- .../api/src/ats/candidate/candidate.module.ts | 1 + .../src/ats/candidate/types/mappingsTypes.ts | 1 - .../src/ats/candidate/types/model.unified.ts | 371 +++++++++++++++++- .../ats/department/department.controller.ts | 48 +-- .../src/ats/department/department.module.ts | 1 + .../src/ats/department/types/mappingsTypes.ts | 1 - .../src/ats/department/types/model.unified.ts | 40 +- .../api/src/ats/eeocs/eeocs.controller.ts | 48 +-- packages/api/src/ats/eeocs/eeocs.module.ts | 1 + .../api/src/ats/eeocs/types/mappingsTypes.ts | 1 - .../api/src/ats/eeocs/types/model.unified.ts | 76 +++- .../src/ats/interview/interview.controller.ts | 8 +- .../api/src/ats/interview/interview.module.ts | 1 + .../src/ats/interview/types/mappingsTypes.ts | 1 - .../src/ats/interview/types/model.unified.ts | 122 +++++- packages/api/src/ats/job/job.controller.ts | 48 +-- packages/api/src/ats/job/job.module.ts | 1 + .../api/src/ats/job/types/mappingsTypes.ts | 1 - .../api/src/ats/job/types/model.unified.ts | 120 +++++- .../jobinterviewstage.controller.ts | 48 +-- .../jobinterviewstage.module.ts | 1 + .../jobinterviewstage/types/mappingsTypes.ts | 1 - .../jobinterviewstage/types/model.unified.ts | 56 ++- .../api/src/ats/offer/offer.controller.ts | 48 +-- packages/api/src/ats/offer/offer.module.ts | 1 + .../api/src/ats/offer/types/mappingsTypes.ts | 1 - .../api/src/ats/offer/types/model.unified.ts | 81 +++- .../api/src/ats/office/office.controller.ts | 11 +- packages/api/src/ats/office/office.module.ts | 1 + .../api/src/ats/office/types/mappingsTypes.ts | 1 - .../api/src/ats/office/types/model.unified.ts | 41 +- .../rejectreason/rejectreason.controller.ts | 48 +-- .../ats/rejectreason/rejectreason.module.ts | 1 + .../ats/rejectreason/types/mappingsTypes.ts | 1 - .../ats/rejectreason/types/model.unified.ts | 40 +- .../src/ats/scorecard/scorecard.controller.ts | 48 +-- .../api/src/ats/scorecard/scorecard.module.ts | 1 + .../src/ats/scorecard/types/mappingsTypes.ts | 1 - .../src/ats/scorecard/types/model.unified.ts | 74 +++- .../screeningquestion.controller.ts | 48 +-- .../screeningquestion.module.ts | 1 + packages/api/src/ats/tag/tag.controller.ts | 48 +-- packages/api/src/ats/tag/tag.module.ts | 1 + .../api/src/ats/user/types/mappingsTypes.ts | 1 - .../api/src/ats/user/types/model.unified.ts | 88 ++++- packages/api/src/ats/user/user.controller.ts | 48 +-- packages/api/src/ats/user/user.module.ts | 1 + .../api/src/crm/company/company.controller.ts | 2 +- .../api/src/crm/company/company.module.ts | 1 + .../api/src/crm/contact/contact.controller.ts | 2 +- .../api/src/crm/contact/contact.module.ts | 1 + packages/api/src/crm/deal/deal.controller.ts | 2 +- packages/api/src/crm/deal/deal.module.ts | 1 + .../crm/engagement/engagement.controller.ts | 2 +- .../src/crm/engagement/engagement.module.ts | 1 + packages/api/src/crm/note/note.controller.ts | 2 +- packages/api/src/crm/note/note.module.ts | 1 + .../api/src/crm/stage/stage.controller.ts | 2 +- packages/api/src/crm/stage/stage.module.ts | 1 + packages/api/src/crm/task/task.module.ts | 1 + packages/api/src/crm/user/user.module.ts | 1 + .../src/filestorage/drive/drive.controller.ts | 49 +-- .../api/src/filestorage/drive/drive.module.ts | 1 + .../filestorage/drive/types/mappingsTypes.ts | 1 - .../filestorage/drive/types/model.unified.ts | 42 +- .../src/filestorage/file/file.controller.ts | 8 +- .../api/src/filestorage/file/file.module.ts | 1 + .../filestorage/file/types/mappingsTypes.ts | 1 - .../filestorage/file/types/model.unified.ts | 61 ++- .../filestorage/folder/folder.controller.ts | 8 +- .../src/filestorage/folder/folder.module.ts | 1 + .../filestorage/folder/types/mappingsTypes.ts | 1 - .../filestorage/folder/types/model.unified.ts | 65 ++- .../src/filestorage/group/group.controller.ts | 105 +++++ .../api/src/filestorage/group/group.module.ts | 36 ++ .../group/services/group.service.ts | 60 +++ .../group/services/registry.service.ts | 23 ++ .../filestorage/group/sync/sync.service.ts | 31 ++ .../api/src/filestorage/group/types/index.ts | 34 ++ .../filestorage/group/types/model.unified.ts | 45 +++ .../api/src/filestorage/group/utils/index.ts | 1 + .../permission/permission.controller.ts | 8 +- .../permission/permission.module.ts | 1 + .../permission/types/mappingsTypes.ts | 1 - .../permission/types/model.unified.ts | 53 ++- .../sharedlink/sharedlink.module.ts | 1 + .../sharedlink/types/mappingsTypes.ts | 1 - .../sharedlink/types/model.unified.ts | 54 ++- .../user/services/registry.service.ts | 23 ++ .../filestorage/user/services/user.service.ts | 60 +++ .../src/filestorage/user/sync/sync.service.ts | 31 ++ .../api/src/filestorage/user/types/index.ts | 34 ++ .../filestorage/user/types/model.unified.ts | 47 +++ .../src/filestorage/user/user.controller.ts | 105 +++++ .../api/src/filestorage/user/user.module.ts | 36 ++ .../api/src/filestorage/user/utils/index.ts | 1 + .../src/hris/bankinfo/bankinfo.controller.ts | 8 +- .../api/src/hris/bankinfo/bankinfo.module.ts | 1 + .../src/hris/benefit/benefit.controller.ts | 8 +- .../api/src/hris/benefit/benefit.module.ts | 1 + .../src/hris/company/company.controller.ts | 11 +- .../api/src/hris/company/company.module.ts | 1 + .../hris/dependent/dependent.controller.ts | 8 +- .../src/hris/dependent/dependent.module.ts | 1 + .../src/hris/employee/employee.controller.ts | 8 +- .../api/src/hris/employee/employee.module.ts | 1 + .../employeepayrollrun.controller.ts | 8 +- .../employeepayrollrun.module.ts | 1 + .../employerbenefit.controller.ts | 11 +- .../employerbenefit/employerbenefit.module.ts | 1 + .../hris/employment/employment.controller.ts | 11 +- .../src/hris/employment/employment.module.ts | 1 + .../api/src/hris/group/group.controller.ts | 11 +- packages/api/src/hris/group/group.module.ts | 1 + .../src/hris/location/location.controller.ts | 11 +- .../api/src/hris/location/location.module.ts | 1 + .../src/hris/paygroup/paygroup.controller.ts | 11 +- .../api/src/hris/paygroup/paygroup.module.ts | 1 + .../hris/payrollrun/payrollrun.controller.ts | 11 +- .../src/hris/payrollrun/payrollrun.module.ts | 1 + .../src/hris/timeoff/timeoff.controller.ts | 8 +- .../api/src/hris/timeoff/timeoff.module.ts | 1 + .../timeoffbalance.controller.ts | 8 +- .../timeoffbalance/timeoffbalance.module.ts | 1 + .../action/action.controller.ts | 11 +- .../action/action.module.ts | 1 + .../automation/automation.controller.ts | 11 +- .../automation/automation.module.ts | 1 + .../campaign/campaign.controller.ts | 11 +- .../campaign/campaign.module.ts | 1 + .../contact/contact.controller.ts | 11 +- .../contact/contact.module.ts | 1 + .../email/email.controller.ts | 11 +- .../marketingautomation/email/email.module.ts | 1 + .../event/event.controller.ts | 11 +- .../marketingautomation/event/event.module.ts | 1 + .../list/list.controller.ts | 11 +- .../marketingautomation/list/list.module.ts | 1 + .../message/message.controller.ts | 11 +- .../message/message.module.ts | 1 + .../template/template.controller.ts | 11 +- .../template/template.module.ts | 1 + .../user/user.controller.ts | 11 +- .../marketingautomation/user/user.module.ts | 1 + .../ticketing/account/account.controller.ts | 1 + .../src/ticketing/account/account.module.ts | 1 + .../ticketing/attachment/attachment.module.ts | 1 + .../ticketing/collection/collection.module.ts | 1 + .../ticketing/comment/comment.controller.ts | 1 + .../src/ticketing/comment/comment.module.ts | 1 + .../ticketing/contact/contact.controller.ts | 1 + .../src/ticketing/contact/contact.module.ts | 1 + .../api/src/ticketing/tag/tag.controller.ts | 1 + packages/api/src/ticketing/tag/tag.module.ts | 1 + .../api/src/ticketing/team/team.controller.ts | 1 + .../api/src/ticketing/team/team.module.ts | 1 + .../api/src/ticketing/ticket/ticket.module.ts | 1 + .../api/src/ticketing/user/user.controller.ts | 1 + .../api/src/ticketing/user/user.module.ts | 1 + 276 files changed, 2770 insertions(+), 835 deletions(-) delete mode 100644 packages/api/src/ats/activity/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/application/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/attachment/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/candidate/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/department/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/eeocs/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/interview/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/job/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/jobinterviewstage/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/offer/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/office/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/rejectreason/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/scorecard/types/mappingsTypes.ts delete mode 100644 packages/api/src/ats/user/types/mappingsTypes.ts delete mode 100644 packages/api/src/filestorage/drive/types/mappingsTypes.ts delete mode 100644 packages/api/src/filestorage/file/types/mappingsTypes.ts delete mode 100644 packages/api/src/filestorage/folder/types/mappingsTypes.ts create mode 100644 packages/api/src/filestorage/group/group.controller.ts create mode 100644 packages/api/src/filestorage/group/group.module.ts create mode 100644 packages/api/src/filestorage/group/services/group.service.ts create mode 100644 packages/api/src/filestorage/group/services/registry.service.ts create mode 100644 packages/api/src/filestorage/group/sync/sync.service.ts create mode 100644 packages/api/src/filestorage/group/types/index.ts create mode 100644 packages/api/src/filestorage/group/types/model.unified.ts create mode 100644 packages/api/src/filestorage/group/utils/index.ts delete mode 100644 packages/api/src/filestorage/permission/types/mappingsTypes.ts delete mode 100644 packages/api/src/filestorage/sharedlink/types/mappingsTypes.ts create mode 100644 packages/api/src/filestorage/user/services/registry.service.ts create mode 100644 packages/api/src/filestorage/user/services/user.service.ts create mode 100644 packages/api/src/filestorage/user/sync/sync.service.ts create mode 100644 packages/api/src/filestorage/user/types/index.ts create mode 100644 packages/api/src/filestorage/user/types/model.unified.ts create mode 100644 packages/api/src/filestorage/user/user.controller.ts create mode 100644 packages/api/src/filestorage/user/user.module.ts create mode 100644 packages/api/src/filestorage/user/utils/index.ts diff --git a/packages/api/prisma/schema.prisma b/packages/api/prisma/schema.prisma index ae0d7a2cd..07d73e6de 100644 --- a/packages/api/prisma/schema.prisma +++ b/packages/api/prisma/schema.prisma @@ -680,7 +680,7 @@ model fs_drives { remote_id String? created_at DateTime @db.Timestamp(6) modified_at DateTime @db.Timestamp(6) -} +} model fs_files { id_fs_file String @id(map: "pk_fs_files") @db.Uuid @@ -707,7 +707,7 @@ model fs_folders { description String? parent_folder String? @db.Uuid remote_id String? - created_at DateTime @db.Timestamp(6) + created_at DateTime @db.Timestamp(6) modified_at DateTime @db.Timestamp(6) id_fs_drive String? @db.Uuid id_fs_permission String? @db.Uuid @@ -720,7 +720,7 @@ model fs_folders { model fs_permissions { id_fs_permission String @id(map: "pk_fs_permissions") @db.Uuid remote_id String? - user String? @db.Uuid + user String? @db.Uuid group String? @db.Uuid type String[] roles String[] @@ -1015,7 +1015,7 @@ model fs_groups { model fs_users { id_fs_user String @id(map: "pk_fs_users") @db.Uuid name String? - email String? + email String? is_me Boolean remote_id String? created_at DateTime @db.Timestamp(6) diff --git a/packages/api/scripts/commonObject.sh b/packages/api/scripts/commonObject.sh index 7d24ff3d5..191562b51 100755 --- a/packages/api/scripts/commonObject.sh +++ b/packages/api/scripts/commonObject.sh @@ -239,6 +239,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ @@ -277,6 +278,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -291,6 +293,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { ${ObjectCap}Service } from './services/${objectType}.service'; import { Unified${ObjectCap}Input, Unified${ObjectCap}Output } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('${VerticalLow}/${objectType}') @Controller('${VerticalLow}/${objectType}') @@ -323,8 +326,7 @@ private connectionUtils: ConnectionUtils 'Set to true to include data from the original ${VerticalCap} software.', }) @ApiCustomResponse(Unified${ObjectCap}Output) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -363,8 +365,7 @@ private connectionUtils: ConnectionUtils 'Set to true to include data from the original ${VerticalCap} software.', }) @ApiCustomResponse(Unified${ObjectCap}Output) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -392,8 +393,7 @@ private connectionUtils: ConnectionUtils }) @ApiBody({ type: Unified${ObjectCap}Input }) @ApiCustomResponse(Unified${ObjectCap}Output) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unified${ObjectCap}Data: Unified${ObjectCap}Input, @Headers('x-connection-token') connection_token: string, @@ -420,8 +420,7 @@ private connectionUtils: ConnectionUtils summary: 'Update a ${ObjectCap}', }) @ApiCustomResponse(Unified${ObjectCap}Output) - //@UseGuards(ApiKeyAuthGuard) - @Patch() +@UseGuards(ApiKeyAuthGuard) @Patch() update$( @Query('id') id: string, @Body() update${ObjectCap}Data: Partial, diff --git a/packages/api/src/@core/connections/accounting/services/freeagent/freeagent.service.ts b/packages/api/src/@core/connections/accounting/services/freeagent/freeagent.service.ts index f59512522..d635d8c2b 100644 --- a/packages/api/src/@core/connections/accounting/services/freeagent/freeagent.service.ts +++ b/packages/api/src/@core/connections/accounting/services/freeagent/freeagent.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/accounting/services/freshbooks/freshbooks.service.ts b/packages/api/src/@core/connections/accounting/services/freshbooks/freshbooks.service.ts index 8e80c98f7..0956d195a 100644 --- a/packages/api/src/@core/connections/accounting/services/freshbooks/freshbooks.service.ts +++ b/packages/api/src/@core/connections/accounting/services/freshbooks/freshbooks.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/accounting/services/moneybird/moneybird.service.ts b/packages/api/src/@core/connections/accounting/services/moneybird/moneybird.service.ts index e21b1738a..5b749e5f4 100644 --- a/packages/api/src/@core/connections/accounting/services/moneybird/moneybird.service.ts +++ b/packages/api/src/@core/connections/accounting/services/moneybird/moneybird.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/accounting/services/pennylane/pennylane.service.ts b/packages/api/src/@core/connections/accounting/services/pennylane/pennylane.service.ts index fb9ee7636..08c8587a8 100644 --- a/packages/api/src/@core/connections/accounting/services/pennylane/pennylane.service.ts +++ b/packages/api/src/@core/connections/accounting/services/pennylane/pennylane.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/accounting/services/quickbooks/quickbooks.service.ts b/packages/api/src/@core/connections/accounting/services/quickbooks/quickbooks.service.ts index 00364d69a..b32b933e5 100644 --- a/packages/api/src/@core/connections/accounting/services/quickbooks/quickbooks.service.ts +++ b/packages/api/src/@core/connections/accounting/services/quickbooks/quickbooks.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/accounting/services/sage/sage.service.ts b/packages/api/src/@core/connections/accounting/services/sage/sage.service.ts index 92cf74a1e..1b15cd817 100644 --- a/packages/api/src/@core/connections/accounting/services/sage/sage.service.ts +++ b/packages/api/src/@core/connections/accounting/services/sage/sage.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/accounting/services/wave_financial/wave_financial.service.ts b/packages/api/src/@core/connections/accounting/services/wave_financial/wave_financial.service.ts index c84e68a7c..3e48ebfbd 100644 --- a/packages/api/src/@core/connections/accounting/services/wave_financial/wave_financial.service.ts +++ b/packages/api/src/@core/connections/accounting/services/wave_financial/wave_financial.service.ts @@ -11,6 +11,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/accounting/services/xero/xero.service.ts b/packages/api/src/@core/connections/accounting/services/xero/xero.service.ts index 681b7e2b8..36ad93c50 100644 --- a/packages/api/src/@core/connections/accounting/services/xero/xero.service.ts +++ b/packages/api/src/@core/connections/accounting/services/xero/xero.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ats/services/ashby/ashby.service.ts b/packages/api/src/@core/connections/ats/services/ashby/ashby.service.ts index 7f4321571..4602fdb36 100644 --- a/packages/api/src/@core/connections/ats/services/ashby/ashby.service.ts +++ b/packages/api/src/@core/connections/ats/services/ashby/ashby.service.ts @@ -6,6 +6,7 @@ import { EncryptionService } from '@@core/encryption/encryption.service'; import { IAtsConnectionService } from '../../types'; import { CONNECTORS_METADATA } from '@panora/shared'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { APIKeyCallbackParams } from '@@core/connections/@utils/types'; import { ServiceRegistry } from '../registry.service'; diff --git a/packages/api/src/@core/connections/ats/services/bamboohr/bamboohr.service.ts b/packages/api/src/@core/connections/ats/services/bamboohr/bamboohr.service.ts index b55ea2d01..8b774a384 100644 --- a/packages/api/src/@core/connections/ats/services/bamboohr/bamboohr.service.ts +++ b/packages/api/src/@core/connections/ats/services/bamboohr/bamboohr.service.ts @@ -15,6 +15,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams } from '@@core/connections/@utils/types'; export type BamboohrOAuthResponse = { diff --git a/packages/api/src/@core/connections/ats/services/greenhouse/greenhouse.service.ts b/packages/api/src/@core/connections/ats/services/greenhouse/greenhouse.service.ts index eaf5a73f2..882282746 100644 --- a/packages/api/src/@core/connections/ats/services/greenhouse/greenhouse.service.ts +++ b/packages/api/src/@core/connections/ats/services/greenhouse/greenhouse.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ats/services/jobadder/jobadder.service.ts b/packages/api/src/@core/connections/ats/services/jobadder/jobadder.service.ts index 128d53194..ea13bd865 100644 --- a/packages/api/src/@core/connections/ats/services/jobadder/jobadder.service.ts +++ b/packages/api/src/@core/connections/ats/services/jobadder/jobadder.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ats/services/lever/lever.service.ts b/packages/api/src/@core/connections/ats/services/lever/lever.service.ts index 1b7adf13e..8efe08871 100644 --- a/packages/api/src/@core/connections/ats/services/lever/lever.service.ts +++ b/packages/api/src/@core/connections/ats/services/lever/lever.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ats/services/workday/workday.service.ts b/packages/api/src/@core/connections/ats/services/workday/workday.service.ts index 98ee5ce41..ee92790d4 100644 --- a/packages/api/src/@core/connections/ats/services/workday/workday.service.ts +++ b/packages/api/src/@core/connections/ats/services/workday/workday.service.ts @@ -6,6 +6,7 @@ import { EncryptionService } from '@@core/encryption/encryption.service'; import { IAtsConnectionService } from '../../types'; import { CONNECTORS_METADATA } from '@panora/shared'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { APIKeyCallbackParams } from '@@core/connections/@utils/types'; import { ServiceRegistry } from '../registry.service'; diff --git a/packages/api/src/@core/connections/crm/services/accelo/accelo.service.ts b/packages/api/src/@core/connections/crm/services/accelo/accelo.service.ts index 1dedd2ce1..4568121f6 100644 --- a/packages/api/src/@core/connections/crm/services/accelo/accelo.service.ts +++ b/packages/api/src/@core/connections/crm/services/accelo/accelo.service.ts @@ -23,6 +23,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/crm/services/affinity/affinity.service.ts b/packages/api/src/@core/connections/crm/services/affinity/affinity.service.ts index c946f840a..730e9b85f 100644 --- a/packages/api/src/@core/connections/crm/services/affinity/affinity.service.ts +++ b/packages/api/src/@core/connections/crm/services/affinity/affinity.service.ts @@ -7,6 +7,7 @@ import { ICrmConnectionService } from '../../types'; import { ServiceRegistry } from '../registry.service'; import { CONNECTORS_METADATA } from '@panora/shared'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { APIKeyCallbackParams } from '@@core/connections/@utils/types'; @Injectable() diff --git a/packages/api/src/@core/connections/crm/services/attio/attio.service.ts b/packages/api/src/@core/connections/crm/services/attio/attio.service.ts index 102e41119..9fd7f642f 100644 --- a/packages/api/src/@core/connections/crm/services/attio/attio.service.ts +++ b/packages/api/src/@core/connections/crm/services/attio/attio.service.ts @@ -22,6 +22,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/crm/services/capsule/capsule.service.ts b/packages/api/src/@core/connections/crm/services/capsule/capsule.service.ts index 9ac194159..411b1dc3d 100644 --- a/packages/api/src/@core/connections/crm/services/capsule/capsule.service.ts +++ b/packages/api/src/@core/connections/crm/services/capsule/capsule.service.ts @@ -26,6 +26,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; export type CapsuleOAuthResponse = { access_token: string; diff --git a/packages/api/src/@core/connections/crm/services/close/close.service.ts b/packages/api/src/@core/connections/crm/services/close/close.service.ts index e4a1cb3e8..174f9af3e 100644 --- a/packages/api/src/@core/connections/crm/services/close/close.service.ts +++ b/packages/api/src/@core/connections/crm/services/close/close.service.ts @@ -26,6 +26,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; export type CloseOAuthResponse = { access_token: string; diff --git a/packages/api/src/@core/connections/crm/services/copper/copper.service.ts b/packages/api/src/@core/connections/crm/services/copper/copper.service.ts index 4760e2dd2..981b45e10 100644 --- a/packages/api/src/@core/connections/crm/services/copper/copper.service.ts +++ b/packages/api/src/@core/connections/crm/services/copper/copper.service.ts @@ -22,6 +22,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/crm/services/hubspot/hubspot.service.ts b/packages/api/src/@core/connections/crm/services/hubspot/hubspot.service.ts index ccf157654..e3776ce53 100644 --- a/packages/api/src/@core/connections/crm/services/hubspot/hubspot.service.ts +++ b/packages/api/src/@core/connections/crm/services/hubspot/hubspot.service.ts @@ -22,6 +22,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/crm/services/keap/keap.service.ts b/packages/api/src/@core/connections/crm/services/keap/keap.service.ts index f94baf500..21e8397cf 100644 --- a/packages/api/src/@core/connections/crm/services/keap/keap.service.ts +++ b/packages/api/src/@core/connections/crm/services/keap/keap.service.ts @@ -22,6 +22,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/crm/services/pipedrive/pipedrive.service.ts b/packages/api/src/@core/connections/crm/services/pipedrive/pipedrive.service.ts index 98805608e..3696c5482 100644 --- a/packages/api/src/@core/connections/crm/services/pipedrive/pipedrive.service.ts +++ b/packages/api/src/@core/connections/crm/services/pipedrive/pipedrive.service.ts @@ -22,6 +22,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/crm/services/teamleader/teamleader.service.ts b/packages/api/src/@core/connections/crm/services/teamleader/teamleader.service.ts index 3b95b432a..11ebce988 100644 --- a/packages/api/src/@core/connections/crm/services/teamleader/teamleader.service.ts +++ b/packages/api/src/@core/connections/crm/services/teamleader/teamleader.service.ts @@ -22,6 +22,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/crm/services/teamwork/teamwork.service.ts b/packages/api/src/@core/connections/crm/services/teamwork/teamwork.service.ts index c090a2a5a..c5296fa2d 100644 --- a/packages/api/src/@core/connections/crm/services/teamwork/teamwork.service.ts +++ b/packages/api/src/@core/connections/crm/services/teamwork/teamwork.service.ts @@ -18,6 +18,7 @@ import { OAuth2AuthData, providerToType } from '@panora/shared'; import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/crm/services/zendesk/zendesk.service.ts b/packages/api/src/@core/connections/crm/services/zendesk/zendesk.service.ts index b8c8a73ce..b2e045ca1 100644 --- a/packages/api/src/@core/connections/crm/services/zendesk/zendesk.service.ts +++ b/packages/api/src/@core/connections/crm/services/zendesk/zendesk.service.ts @@ -22,6 +22,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/crm/services/zoho/zoho.service.ts b/packages/api/src/@core/connections/crm/services/zoho/zoho.service.ts index 22413778a..d262d68a6 100644 --- a/packages/api/src/@core/connections/crm/services/zoho/zoho.service.ts +++ b/packages/api/src/@core/connections/crm/services/zoho/zoho.service.ts @@ -23,6 +23,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/filestorage/services/box/box.service.ts b/packages/api/src/@core/connections/filestorage/services/box/box.service.ts index c78d2e28f..3a8d9b056 100644 --- a/packages/api/src/@core/connections/filestorage/services/box/box.service.ts +++ b/packages/api/src/@core/connections/filestorage/services/box/box.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/filestorage/services/dropbox/dropbox.service.ts b/packages/api/src/@core/connections/filestorage/services/dropbox/dropbox.service.ts index 22ed45ac8..50f21e7b8 100644 --- a/packages/api/src/@core/connections/filestorage/services/dropbox/dropbox.service.ts +++ b/packages/api/src/@core/connections/filestorage/services/dropbox/dropbox.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/filestorage/services/google_drive/google_drive.service.ts b/packages/api/src/@core/connections/filestorage/services/google_drive/google_drive.service.ts index 35cbca8a1..1cbd3d74a 100644 --- a/packages/api/src/@core/connections/filestorage/services/google_drive/google_drive.service.ts +++ b/packages/api/src/@core/connections/filestorage/services/google_drive/google_drive.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/filestorage/services/onedrive/onedrive.service.ts b/packages/api/src/@core/connections/filestorage/services/onedrive/onedrive.service.ts index 7980456bd..d35fb156f 100644 --- a/packages/api/src/@core/connections/filestorage/services/onedrive/onedrive.service.ts +++ b/packages/api/src/@core/connections/filestorage/services/onedrive/onedrive.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/filestorage/services/sharepoint/sharepoint.service.ts b/packages/api/src/@core/connections/filestorage/services/sharepoint/sharepoint.service.ts index e335e3ba8..ad2c83429 100644 --- a/packages/api/src/@core/connections/filestorage/services/sharepoint/sharepoint.service.ts +++ b/packages/api/src/@core/connections/filestorage/services/sharepoint/sharepoint.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/hris/services/bamboohr/bamboohr.service.ts b/packages/api/src/@core/connections/hris/services/bamboohr/bamboohr.service.ts index 9bdb6c00e..b3dc9c538 100644 --- a/packages/api/src/@core/connections/hris/services/bamboohr/bamboohr.service.ts +++ b/packages/api/src/@core/connections/hris/services/bamboohr/bamboohr.service.ts @@ -15,6 +15,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams } from '@@core/connections/@utils/types'; export type BamboohrOAuthResponse = { diff --git a/packages/api/src/@core/connections/hris/services/deel/deel.service.ts b/packages/api/src/@core/connections/hris/services/deel/deel.service.ts index cf688b4fb..b0d7509d8 100644 --- a/packages/api/src/@core/connections/hris/services/deel/deel.service.ts +++ b/packages/api/src/@core/connections/hris/services/deel/deel.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/hris/services/factorial/factorial.service.ts b/packages/api/src/@core/connections/hris/services/factorial/factorial.service.ts index a752a28a4..17835a263 100644 --- a/packages/api/src/@core/connections/hris/services/factorial/factorial.service.ts +++ b/packages/api/src/@core/connections/hris/services/factorial/factorial.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/hris/services/gusto/gusto.service.ts b/packages/api/src/@core/connections/hris/services/gusto/gusto.service.ts index 89859b431..314b59893 100644 --- a/packages/api/src/@core/connections/hris/services/gusto/gusto.service.ts +++ b/packages/api/src/@core/connections/hris/services/gusto/gusto.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/hris/services/namely/namely.service.ts b/packages/api/src/@core/connections/hris/services/namely/namely.service.ts index e6534abda..8990cf959 100644 --- a/packages/api/src/@core/connections/hris/services/namely/namely.service.ts +++ b/packages/api/src/@core/connections/hris/services/namely/namely.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/hris/services/payfit/payfit.service.ts b/packages/api/src/@core/connections/hris/services/payfit/payfit.service.ts index deb722ed5..09bfd5907 100644 --- a/packages/api/src/@core/connections/hris/services/payfit/payfit.service.ts +++ b/packages/api/src/@core/connections/hris/services/payfit/payfit.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/hris/services/rippling/rippling.service.ts b/packages/api/src/@core/connections/hris/services/rippling/rippling.service.ts index 0c5f0d082..156727149 100644 --- a/packages/api/src/@core/connections/hris/services/rippling/rippling.service.ts +++ b/packages/api/src/@core/connections/hris/services/rippling/rippling.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/management/services/notion/notion.service.ts b/packages/api/src/@core/connections/management/services/notion/notion.service.ts index c3c23c9a7..653d1cd6b 100644 --- a/packages/api/src/@core/connections/management/services/notion/notion.service.ts +++ b/packages/api/src/@core/connections/management/services/notion/notion.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/management/services/slack/slack.service.ts b/packages/api/src/@core/connections/management/services/slack/slack.service.ts index 8f4df58d0..bce89087e 100644 --- a/packages/api/src/@core/connections/management/services/slack/slack.service.ts +++ b/packages/api/src/@core/connections/management/services/slack/slack.service.ts @@ -22,6 +22,7 @@ import { } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/marketingautomation/services/brevo/brevo.service.ts b/packages/api/src/@core/connections/marketingautomation/services/brevo/brevo.service.ts index 60cb562d2..de50a249f 100644 --- a/packages/api/src/@core/connections/marketingautomation/services/brevo/brevo.service.ts +++ b/packages/api/src/@core/connections/marketingautomation/services/brevo/brevo.service.ts @@ -7,6 +7,7 @@ import { IMarketingAutomationConnectionService } from '../../types'; import { ServiceRegistry } from '../registry.service'; import { CONNECTORS_METADATA } from '@panora/shared'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { APIKeyCallbackParams } from '@@core/connections/@utils/types'; @Injectable() diff --git a/packages/api/src/@core/connections/marketingautomation/services/getresponse/getresponse.service.ts b/packages/api/src/@core/connections/marketingautomation/services/getresponse/getresponse.service.ts index 6ea60a58b..202e38b68 100644 --- a/packages/api/src/@core/connections/marketingautomation/services/getresponse/getresponse.service.ts +++ b/packages/api/src/@core/connections/marketingautomation/services/getresponse/getresponse.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/marketingautomation/services/keap/keap.service.ts b/packages/api/src/@core/connections/marketingautomation/services/keap/keap.service.ts index 530b02b37..3dd3cf8cf 100644 --- a/packages/api/src/@core/connections/marketingautomation/services/keap/keap.service.ts +++ b/packages/api/src/@core/connections/marketingautomation/services/keap/keap.service.ts @@ -15,6 +15,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/marketingautomation/services/klaviyo/klaviyo.service.ts b/packages/api/src/@core/connections/marketingautomation/services/klaviyo/klaviyo.service.ts index 4a359cb01..8d70aad5c 100644 --- a/packages/api/src/@core/connections/marketingautomation/services/klaviyo/klaviyo.service.ts +++ b/packages/api/src/@core/connections/marketingautomation/services/klaviyo/klaviyo.service.ts @@ -11,6 +11,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/marketingautomation/services/mailchimp/mailchimp.service.ts b/packages/api/src/@core/connections/marketingautomation/services/mailchimp/mailchimp.service.ts index ebf8d9cc0..9831b05ff 100644 --- a/packages/api/src/@core/connections/marketingautomation/services/mailchimp/mailchimp.service.ts +++ b/packages/api/src/@core/connections/marketingautomation/services/mailchimp/mailchimp.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/marketingautomation/services/podium/podium.service.ts b/packages/api/src/@core/connections/marketingautomation/services/podium/podium.service.ts index 72d303f23..d08d0ab4b 100644 --- a/packages/api/src/@core/connections/marketingautomation/services/podium/podium.service.ts +++ b/packages/api/src/@core/connections/marketingautomation/services/podium/podium.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/aha/aha.service.ts b/packages/api/src/@core/connections/ticketing/services/aha/aha.service.ts index 12c7983b8..46c75be64 100644 --- a/packages/api/src/@core/connections/ticketing/services/aha/aha.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/aha/aha.service.ts @@ -22,6 +22,7 @@ import { import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams } from '@@core/connections/@utils/types'; export type AhaOAuthResponse = { diff --git a/packages/api/src/@core/connections/ticketing/services/asana/asana.service.ts b/packages/api/src/@core/connections/ticketing/services/asana/asana.service.ts index 7ff6a003a..f16497126 100644 --- a/packages/api/src/@core/connections/ticketing/services/asana/asana.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/asana/asana.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/clickup/clickup.service.ts b/packages/api/src/@core/connections/ticketing/services/clickup/clickup.service.ts index c878f7a4d..cc6c359d5 100644 --- a/packages/api/src/@core/connections/ticketing/services/clickup/clickup.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/clickup/clickup.service.ts @@ -22,6 +22,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/dixa/dixa.service.ts b/packages/api/src/@core/connections/ticketing/services/dixa/dixa.service.ts index b6fa32116..aea6962f0 100644 --- a/packages/api/src/@core/connections/ticketing/services/dixa/dixa.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/dixa/dixa.service.ts @@ -7,6 +7,7 @@ import { ITicketingConnectionService } from '../../types'; import { ServiceRegistry } from '../registry.service'; import { CONNECTORS_METADATA } from '@panora/shared'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { APIKeyCallbackParams } from '@@core/connections/@utils/types'; @Injectable() diff --git a/packages/api/src/@core/connections/ticketing/services/front/front.service.ts b/packages/api/src/@core/connections/ticketing/services/front/front.service.ts index 2f6afdf8e..c77b1e900 100644 --- a/packages/api/src/@core/connections/ticketing/services/front/front.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/front/front.service.ts @@ -11,6 +11,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/github/github.service.ts b/packages/api/src/@core/connections/ticketing/services/github/github.service.ts index 4811a7133..387b31365 100644 --- a/packages/api/src/@core/connections/ticketing/services/github/github.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/github/github.service.ts @@ -22,6 +22,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/gitlab/gitlab.service.ts b/packages/api/src/@core/connections/ticketing/services/gitlab/gitlab.service.ts index 4d77d6136..0cf8b6e3d 100644 --- a/packages/api/src/@core/connections/ticketing/services/gitlab/gitlab.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/gitlab/gitlab.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/gorgias/gorgias.service.ts b/packages/api/src/@core/connections/ticketing/services/gorgias/gorgias.service.ts index 89fa3bf9c..50a967177 100644 --- a/packages/api/src/@core/connections/ticketing/services/gorgias/gorgias.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/gorgias/gorgias.service.ts @@ -23,6 +23,7 @@ import { import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/helpscout/helpscout.service.ts b/packages/api/src/@core/connections/ticketing/services/helpscout/helpscout.service.ts index 24dc9cb99..08d54beb7 100644 --- a/packages/api/src/@core/connections/ticketing/services/helpscout/helpscout.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/helpscout/helpscout.service.ts @@ -12,6 +12,7 @@ import { providerToType, } from '@panora/shared'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/ironclad/ironclad.service.ts b/packages/api/src/@core/connections/ticketing/services/ironclad/ironclad.service.ts index b44990af1..3470f3bba 100644 --- a/packages/api/src/@core/connections/ticketing/services/ironclad/ironclad.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/ironclad/ironclad.service.ts @@ -11,6 +11,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/jira/jira.service.ts b/packages/api/src/@core/connections/ticketing/services/jira/jira.service.ts index 5d03f7cce..94e1f39c0 100644 --- a/packages/api/src/@core/connections/ticketing/services/jira/jira.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/jira/jira.service.ts @@ -18,6 +18,7 @@ import { OAuth2AuthData, providerToType } from '@panora/shared'; import { AuthStrategy } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/linear/linear.service.ts b/packages/api/src/@core/connections/ticketing/services/linear/linear.service.ts index 16f2736fb..4b7c49d79 100644 --- a/packages/api/src/@core/connections/ticketing/services/linear/linear.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/linear/linear.service.ts @@ -18,6 +18,7 @@ import { AuthStrategy, CONNECTORS_METADATA } from '@panora/shared'; import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/wrike/wrike.service.ts b/packages/api/src/@core/connections/ticketing/services/wrike/wrike.service.ts index 2791a2776..ddc59add9 100644 --- a/packages/api/src/@core/connections/ticketing/services/wrike/wrike.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/wrike/wrike.service.ts @@ -22,6 +22,7 @@ import { import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams, RefreshParams, diff --git a/packages/api/src/@core/connections/ticketing/services/zendesk/zendesk.service.ts b/packages/api/src/@core/connections/ticketing/services/zendesk/zendesk.service.ts index 438faa6ac..d62e76bb6 100644 --- a/packages/api/src/@core/connections/ticketing/services/zendesk/zendesk.service.ts +++ b/packages/api/src/@core/connections/ticketing/services/zendesk/zendesk.service.ts @@ -22,6 +22,7 @@ import { import { OAuth2AuthData, providerToType } from '@panora/shared'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { OAuthCallbackParams } from '@@core/connections/@utils/types'; import { ManagedWebhooksService } from '@@core/managed-webhooks/managed-webhooks.service'; diff --git a/packages/api/src/@core/utils/types/original/original.file-storage.ts b/packages/api/src/@core/utils/types/original/original.file-storage.ts index 4e2107442..77c54b8d3 100644 --- a/packages/api/src/@core/utils/types/original/original.file-storage.ts +++ b/packages/api/src/@core/utils/types/original/original.file-storage.ts @@ -15,12 +15,20 @@ export type OriginalSharedLinkInput = ''; /* drive */ export type OriginalDriveInput = ''; +/* group */ +export type OriginalGroupInput = ''; + +/* user */ +export type OriginalUserInput = ''; + export type FileStorageObjectInput = | OriginalFileInput | OriginalFolderInput | OriginalPermissionInput | OriginalSharedLinkInput - | OriginalDriveInput; + | OriginalDriveInput + | OriginalGroupInput + | OriginalUserInput; /* OUTPUT */ @@ -39,9 +47,17 @@ export type OriginalSharedLinkOutput = ''; /* drive */ export type OriginalDriveOutput = ''; +/* group */ +export type OriginalGroupOutput = ''; + +/* user */ +export type OriginalUserOutput = ''; + export type FileStorageObjectOutput = | OriginalFileOutput | OriginalFolderOutput | OriginalPermissionOutput | OriginalSharedLinkOutput - | OriginalDriveOutput; + | OriginalDriveOutput + | OriginalGroupOutput + | OriginalUserOutput; diff --git a/packages/api/src/accounting/account/account.controller.ts b/packages/api/src/accounting/account/account.controller.ts index 1fee16d3b..85d59cd49 100644 --- a/packages/api/src/accounting/account/account.controller.ts +++ b/packages/api/src/accounting/account/account.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -23,6 +24,7 @@ import { UnifiedAccountOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { AccountService } from './services/account.service'; @ApiTags('accounting/account') @@ -54,8 +56,7 @@ export class AccountController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedAccountOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -94,8 +95,7 @@ export class AccountController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedAccountOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -123,8 +123,7 @@ export class AccountController { }) @ApiBody({ type: UnifiedAccountInput }) @ApiCustomResponse(UnifiedAccountOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedAccountData: UnifiedAccountInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/account/account.module.ts b/packages/api/src/accounting/account/account.module.ts index 0cc9a24f6..ce721e2ef 100644 --- a/packages/api/src/accounting/account/account.module.ts +++ b/packages/api/src/accounting/account/account.module.ts @@ -9,6 +9,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { AccountService } from './services/account.service'; @Module({ diff --git a/packages/api/src/accounting/address/address.controller.ts b/packages/api/src/accounting/address/address.controller.ts index 4aaef77dd..e7ea12cbe 100644 --- a/packages/api/src/accounting/address/address.controller.ts +++ b/packages/api/src/accounting/address/address.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedAddressOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/address') @Controller('accounting/address') @@ -54,8 +56,7 @@ export class AddressController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedAddressOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -94,8 +95,7 @@ export class AddressController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedAddressOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -123,8 +123,7 @@ export class AddressController { }) @ApiBody({ type: UnifiedAddressInput }) @ApiCustomResponse(UnifiedAddressOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedAddressData: UnifiedAddressInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/address/address.module.ts b/packages/api/src/accounting/address/address.module.ts index 0bc23e571..6dbe5d68d 100644 --- a/packages/api/src/accounting/address/address.module.ts +++ b/packages/api/src/accounting/address/address.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/attachment/attachment.controller.ts b/packages/api/src/accounting/attachment/attachment.controller.ts index e7ff17170..28f686255 100644 --- a/packages/api/src/accounting/attachment/attachment.controller.ts +++ b/packages/api/src/accounting/attachment/attachment.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedAttachmentOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/attachment') @Controller('accounting/attachment') @@ -54,8 +56,7 @@ export class AttachmentController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedAttachmentOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -94,8 +95,7 @@ export class AttachmentController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedAttachmentOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -123,8 +123,7 @@ export class AttachmentController { }) @ApiBody({ type: UnifiedAttachmentInput }) @ApiCustomResponse(UnifiedAttachmentOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedAttachmentData: UnifiedAttachmentInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/attachment/attachment.module.ts b/packages/api/src/accounting/attachment/attachment.module.ts index b68c83f37..12f5e54ec 100644 --- a/packages/api/src/accounting/attachment/attachment.module.ts +++ b/packages/api/src/accounting/attachment/attachment.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/balancesheet/balancesheet.controller.ts b/packages/api/src/accounting/balancesheet/balancesheet.controller.ts index 2947f341c..dd6e1d146 100644 --- a/packages/api/src/accounting/balancesheet/balancesheet.controller.ts +++ b/packages/api/src/accounting/balancesheet/balancesheet.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedBalanceSheetOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/balancesheet') @Controller('accounting/balancesheet') @@ -54,8 +56,7 @@ export class BalanceSheetController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedBalanceSheetOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class BalanceSheetController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedBalanceSheetOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -124,8 +124,7 @@ export class BalanceSheetController { }) @ApiBody({ type: UnifiedBalanceSheetInput }) @ApiCustomResponse(UnifiedBalanceSheetOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedBalanceSheetData: UnifiedBalanceSheetInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/balancesheet/balancesheet.module.ts b/packages/api/src/accounting/balancesheet/balancesheet.module.ts index f9687b7ba..f6c138074 100644 --- a/packages/api/src/accounting/balancesheet/balancesheet.module.ts +++ b/packages/api/src/accounting/balancesheet/balancesheet.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/cashflowstatement/cashflowstatement.controller.ts b/packages/api/src/accounting/cashflowstatement/cashflowstatement.controller.ts index adefb8365..3db35ae4b 100644 --- a/packages/api/src/accounting/cashflowstatement/cashflowstatement.controller.ts +++ b/packages/api/src/accounting/cashflowstatement/cashflowstatement.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedCashflowStatementOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/cashflowstatement') @Controller('accounting/cashflowstatement') @@ -54,8 +56,7 @@ export class CashflowStatementController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedCashflowStatementOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class CashflowStatementController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedCashflowStatementOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -125,8 +125,7 @@ export class CashflowStatementController { }) @ApiBody({ type: UnifiedCashflowStatementInput }) @ApiCustomResponse(UnifiedCashflowStatementOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedCashflowStatementData: UnifiedCashflowStatementInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/cashflowstatement/cashflowstatement.module.ts b/packages/api/src/accounting/cashflowstatement/cashflowstatement.module.ts index 07c607138..4799ee591 100644 --- a/packages/api/src/accounting/cashflowstatement/cashflowstatement.module.ts +++ b/packages/api/src/accounting/cashflowstatement/cashflowstatement.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/companyinfo/companyinfo.controller.ts b/packages/api/src/accounting/companyinfo/companyinfo.controller.ts index 7d3e3cbad..4cfd1d856 100644 --- a/packages/api/src/accounting/companyinfo/companyinfo.controller.ts +++ b/packages/api/src/accounting/companyinfo/companyinfo.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedCompanyInfoOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/companyinfo') @Controller('accounting/companyinfo') @@ -54,8 +56,7 @@ export class CompanyInfoController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedCompanyInfoOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class CompanyInfoController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedCompanyInfoOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -124,8 +124,7 @@ export class CompanyInfoController { }) @ApiBody({ type: UnifiedCompanyInfoInput }) @ApiCustomResponse(UnifiedCompanyInfoOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedCompanyInfoData: UnifiedCompanyInfoInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/companyinfo/companyinfo.module.ts b/packages/api/src/accounting/companyinfo/companyinfo.module.ts index f7fcd06df..6d4cb9041 100644 --- a/packages/api/src/accounting/companyinfo/companyinfo.module.ts +++ b/packages/api/src/accounting/companyinfo/companyinfo.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/contact/contact.controller.ts b/packages/api/src/accounting/contact/contact.controller.ts index 6b6ce8587..e82a8894d 100644 --- a/packages/api/src/accounting/contact/contact.controller.ts +++ b/packages/api/src/accounting/contact/contact.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedContactOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/contact') @Controller('accounting/contact') @@ -54,8 +56,7 @@ export class ContactController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedContactOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -94,8 +95,7 @@ export class ContactController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedContactOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -123,8 +123,7 @@ export class ContactController { }) @ApiBody({ type: UnifiedContactInput }) @ApiCustomResponse(UnifiedContactOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedContactData: UnifiedContactInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/contact/contact.module.ts b/packages/api/src/accounting/contact/contact.module.ts index d204d30c4..6cfaa4968 100644 --- a/packages/api/src/accounting/contact/contact.module.ts +++ b/packages/api/src/accounting/contact/contact.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/creditnote/creditnote.controller.ts b/packages/api/src/accounting/creditnote/creditnote.controller.ts index 79ede0cd9..530670766 100644 --- a/packages/api/src/accounting/creditnote/creditnote.controller.ts +++ b/packages/api/src/accounting/creditnote/creditnote.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedCreditNoteOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/creditnote') @Controller('accounting/creditnote') @@ -54,8 +56,7 @@ export class CreditNoteController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedCreditNoteOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -94,8 +95,7 @@ export class CreditNoteController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedCreditNoteOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -123,8 +123,7 @@ export class CreditNoteController { }) @ApiBody({ type: UnifiedCreditNoteInput }) @ApiCustomResponse(UnifiedCreditNoteOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedCreditNoteData: UnifiedCreditNoteInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/creditnote/creditnote.module.ts b/packages/api/src/accounting/creditnote/creditnote.module.ts index f1e975a33..385c08810 100644 --- a/packages/api/src/accounting/creditnote/creditnote.module.ts +++ b/packages/api/src/accounting/creditnote/creditnote.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/expense/expense.controller.ts b/packages/api/src/accounting/expense/expense.controller.ts index 401ee5e0a..cbc84efed 100644 --- a/packages/api/src/accounting/expense/expense.controller.ts +++ b/packages/api/src/accounting/expense/expense.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedExpenseOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/expense') @Controller('accounting/expense') @@ -54,8 +56,7 @@ export class ExpenseController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedExpenseOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -94,8 +95,7 @@ export class ExpenseController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedExpenseOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -123,8 +123,7 @@ export class ExpenseController { }) @ApiBody({ type: UnifiedExpenseInput }) @ApiCustomResponse(UnifiedExpenseOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedExpenseData: UnifiedExpenseInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/expense/expense.module.ts b/packages/api/src/accounting/expense/expense.module.ts index 2a2a502f1..5387ed31b 100644 --- a/packages/api/src/accounting/expense/expense.module.ts +++ b/packages/api/src/accounting/expense/expense.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/incomestatement/incomestatement.controller.ts b/packages/api/src/accounting/incomestatement/incomestatement.controller.ts index 5ec0052b4..4d7a4777e 100644 --- a/packages/api/src/accounting/incomestatement/incomestatement.controller.ts +++ b/packages/api/src/accounting/incomestatement/incomestatement.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedIncomeStatementOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/incomestatement') @Controller('accounting/incomestatement') @@ -54,8 +56,7 @@ export class IncomeStatementController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedIncomeStatementOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class IncomeStatementController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedIncomeStatementOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -125,8 +125,7 @@ export class IncomeStatementController { }) @ApiBody({ type: UnifiedIncomeStatementInput }) @ApiCustomResponse(UnifiedIncomeStatementOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedIncomeStatementData: UnifiedIncomeStatementInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/incomestatement/incomestatement.module.ts b/packages/api/src/accounting/incomestatement/incomestatement.module.ts index 2c1f3e062..26cffc007 100644 --- a/packages/api/src/accounting/incomestatement/incomestatement.module.ts +++ b/packages/api/src/accounting/incomestatement/incomestatement.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/invoice/invoice.controller.ts b/packages/api/src/accounting/invoice/invoice.controller.ts index 70772abe6..7f428903d 100644 --- a/packages/api/src/accounting/invoice/invoice.controller.ts +++ b/packages/api/src/accounting/invoice/invoice.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedInvoiceOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/invoice') @Controller('accounting/invoice') @@ -54,8 +56,7 @@ export class InvoiceController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedInvoiceOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -94,8 +95,7 @@ export class InvoiceController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedInvoiceOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -123,8 +123,7 @@ export class InvoiceController { }) @ApiBody({ type: UnifiedInvoiceInput }) @ApiCustomResponse(UnifiedInvoiceOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedInvoiceData: UnifiedInvoiceInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/invoice/invoice.module.ts b/packages/api/src/accounting/invoice/invoice.module.ts index 904aee19a..5fa9445e7 100644 --- a/packages/api/src/accounting/invoice/invoice.module.ts +++ b/packages/api/src/accounting/invoice/invoice.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/item/item.controller.ts b/packages/api/src/accounting/item/item.controller.ts index 5e3b91bfa..073a9edd1 100644 --- a/packages/api/src/accounting/item/item.controller.ts +++ b/packages/api/src/accounting/item/item.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { ItemService } from './services/item.service'; import { UnifiedItemInput, UnifiedItemOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/item') @Controller('accounting/item') @@ -51,8 +53,7 @@ export class ItemController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedItemOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -87,8 +88,7 @@ export class ItemController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedItemOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -116,8 +116,7 @@ export class ItemController { }) @ApiBody({ type: UnifiedItemInput }) @ApiCustomResponse(UnifiedItemOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedItemData: UnifiedItemInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/item/item.module.ts b/packages/api/src/accounting/item/item.module.ts index e55c64414..78a32dc8f 100644 --- a/packages/api/src/accounting/item/item.module.ts +++ b/packages/api/src/accounting/item/item.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/journalentry/journalentry.controller.ts b/packages/api/src/accounting/journalentry/journalentry.controller.ts index f88b480db..336bc740f 100644 --- a/packages/api/src/accounting/journalentry/journalentry.controller.ts +++ b/packages/api/src/accounting/journalentry/journalentry.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedJournalEntryOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/journalentry') @Controller('accounting/journalentry') @@ -54,8 +56,7 @@ export class JournalEntryController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedJournalEntryOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class JournalEntryController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedJournalEntryOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -124,8 +124,7 @@ export class JournalEntryController { }) @ApiBody({ type: UnifiedJournalEntryInput }) @ApiCustomResponse(UnifiedJournalEntryOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedJournalEntryData: UnifiedJournalEntryInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/journalentry/journalentry.module.ts b/packages/api/src/accounting/journalentry/journalentry.module.ts index 969fc1396..8d7e316c4 100644 --- a/packages/api/src/accounting/journalentry/journalentry.module.ts +++ b/packages/api/src/accounting/journalentry/journalentry.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/payment/payment.controller.ts b/packages/api/src/accounting/payment/payment.controller.ts index 49f9e7a7f..530a31ad0 100644 --- a/packages/api/src/accounting/payment/payment.controller.ts +++ b/packages/api/src/accounting/payment/payment.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedPaymentOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/payment') @Controller('accounting/payment') @@ -54,8 +56,7 @@ export class PaymentController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedPaymentOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -94,8 +95,7 @@ export class PaymentController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedPaymentOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -123,8 +123,7 @@ export class PaymentController { }) @ApiBody({ type: UnifiedPaymentInput }) @ApiCustomResponse(UnifiedPaymentOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedPaymentData: UnifiedPaymentInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/payment/payment.module.ts b/packages/api/src/accounting/payment/payment.module.ts index acdd2ad2d..8da09464f 100644 --- a/packages/api/src/accounting/payment/payment.module.ts +++ b/packages/api/src/accounting/payment/payment.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/phonenumber/phonenumber.controller.ts b/packages/api/src/accounting/phonenumber/phonenumber.controller.ts index ddc5372a1..f902cbf05 100644 --- a/packages/api/src/accounting/phonenumber/phonenumber.controller.ts +++ b/packages/api/src/accounting/phonenumber/phonenumber.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedPhoneNumberOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/phonenumber') @Controller('accounting/phonenumber') @@ -54,8 +56,7 @@ export class PhoneNumberController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedPhoneNumberOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class PhoneNumberController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedPhoneNumberOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -124,8 +124,7 @@ export class PhoneNumberController { }) @ApiBody({ type: UnifiedPhoneNumberInput }) @ApiCustomResponse(UnifiedPhoneNumberOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedPhoneNumberData: UnifiedPhoneNumberInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/phonenumber/phonenumber.module.ts b/packages/api/src/accounting/phonenumber/phonenumber.module.ts index 35a7070e6..40ba512a5 100644 --- a/packages/api/src/accounting/phonenumber/phonenumber.module.ts +++ b/packages/api/src/accounting/phonenumber/phonenumber.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/purchaseorder/purchaseorder.controller.ts b/packages/api/src/accounting/purchaseorder/purchaseorder.controller.ts index 7865e762f..028bd0b85 100644 --- a/packages/api/src/accounting/purchaseorder/purchaseorder.controller.ts +++ b/packages/api/src/accounting/purchaseorder/purchaseorder.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedPurchaseOrderOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/purchaseorder') @Controller('accounting/purchaseorder') @@ -54,8 +56,7 @@ export class PurchaseOrderController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedPurchaseOrderOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class PurchaseOrderController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedPurchaseOrderOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -124,8 +124,7 @@ export class PurchaseOrderController { }) @ApiBody({ type: UnifiedPurchaseOrderInput }) @ApiCustomResponse(UnifiedPurchaseOrderOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedPurchaseOrderData: UnifiedPurchaseOrderInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/purchaseorder/purchaseorder.module.ts b/packages/api/src/accounting/purchaseorder/purchaseorder.module.ts index 8bfa7b71b..2252ee1f3 100644 --- a/packages/api/src/accounting/purchaseorder/purchaseorder.module.ts +++ b/packages/api/src/accounting/purchaseorder/purchaseorder.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/taxrate/taxrate.controller.ts b/packages/api/src/accounting/taxrate/taxrate.controller.ts index d58becea3..58ef3e572 100644 --- a/packages/api/src/accounting/taxrate/taxrate.controller.ts +++ b/packages/api/src/accounting/taxrate/taxrate.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedTaxRateOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/taxrate') @Controller('accounting/taxrate') @@ -54,8 +56,7 @@ export class TaxRateController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedTaxRateOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -94,8 +95,7 @@ export class TaxRateController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedTaxRateOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -123,8 +123,7 @@ export class TaxRateController { }) @ApiBody({ type: UnifiedTaxRateInput }) @ApiCustomResponse(UnifiedTaxRateOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedTaxRateData: UnifiedTaxRateInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/taxrate/taxrate.module.ts b/packages/api/src/accounting/taxrate/taxrate.module.ts index 8a9278345..641cac19b 100644 --- a/packages/api/src/accounting/taxrate/taxrate.module.ts +++ b/packages/api/src/accounting/taxrate/taxrate.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/trackingcategory/trackingcategory.controller.ts b/packages/api/src/accounting/trackingcategory/trackingcategory.controller.ts index 2e20f91e7..44951dff9 100644 --- a/packages/api/src/accounting/trackingcategory/trackingcategory.controller.ts +++ b/packages/api/src/accounting/trackingcategory/trackingcategory.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedTrackingCategoryOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/trackingcategory') @Controller('accounting/trackingcategory') @@ -54,8 +56,7 @@ export class TrackingCategoryController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedTrackingCategoryOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class TrackingCategoryController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedTrackingCategoryOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -125,8 +125,7 @@ export class TrackingCategoryController { }) @ApiBody({ type: UnifiedTrackingCategoryInput }) @ApiCustomResponse(UnifiedTrackingCategoryOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedTrackingCategoryData: UnifiedTrackingCategoryInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/trackingcategory/trackingcategory.module.ts b/packages/api/src/accounting/trackingcategory/trackingcategory.module.ts index 7eae2db52..1b8478f66 100644 --- a/packages/api/src/accounting/trackingcategory/trackingcategory.module.ts +++ b/packages/api/src/accounting/trackingcategory/trackingcategory.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/transaction/transaction.controller.ts b/packages/api/src/accounting/transaction/transaction.controller.ts index 2fafa387f..9da77dbc9 100644 --- a/packages/api/src/accounting/transaction/transaction.controller.ts +++ b/packages/api/src/accounting/transaction/transaction.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedTransactionOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/transaction') @Controller('accounting/transaction') @@ -54,8 +56,7 @@ export class TransactionController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedTransactionOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class TransactionController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedTransactionOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -124,8 +124,7 @@ export class TransactionController { }) @ApiBody({ type: UnifiedTransactionInput }) @ApiCustomResponse(UnifiedTransactionOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedTransactionData: UnifiedTransactionInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/transaction/transaction.module.ts b/packages/api/src/accounting/transaction/transaction.module.ts index 2a2a4d02b..862b1669f 100644 --- a/packages/api/src/accounting/transaction/transaction.module.ts +++ b/packages/api/src/accounting/transaction/transaction.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/accounting/vendorcredit/vendorcredit.controller.ts b/packages/api/src/accounting/vendorcredit/vendorcredit.controller.ts index bfa7f136f..aab4b5ea9 100644 --- a/packages/api/src/accounting/vendorcredit/vendorcredit.controller.ts +++ b/packages/api/src/accounting/vendorcredit/vendorcredit.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedVendorCreditOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('accounting/vendorcredit') @Controller('accounting/vendorcredit') @@ -54,8 +56,7 @@ export class VendorCreditController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedVendorCreditOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class VendorCreditController { 'Set to true to include data from the original Accounting software.', }) @ApiCustomResponse(UnifiedVendorCreditOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -124,8 +124,7 @@ export class VendorCreditController { }) @ApiBody({ type: UnifiedVendorCreditInput }) @ApiCustomResponse(UnifiedVendorCreditOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedVendorCreditData: UnifiedVendorCreditInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/accounting/vendorcredit/vendorcredit.module.ts b/packages/api/src/accounting/vendorcredit/vendorcredit.module.ts index b7c336b0a..d277138a0 100644 --- a/packages/api/src/accounting/vendorcredit/vendorcredit.module.ts +++ b/packages/api/src/accounting/vendorcredit/vendorcredit.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/activity/activity.controller.ts b/packages/api/src/ats/activity/activity.controller.ts index d2c9e2699..7c7b13466 100644 --- a/packages/api/src/ats/activity/activity.controller.ts +++ b/packages/api/src/ats/activity/activity.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -23,6 +24,7 @@ import { UnifiedActivityOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { ActivityService } from './services/activity.service'; @ApiTags('ats/activity') @@ -53,7 +55,7 @@ export class ActivityController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedActivityOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class ActivityController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedActivityOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class ActivityController { }) @ApiBody({ type: UnifiedActivityInput }) @ApiCustomResponse(UnifiedActivityOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedActivityData: UnifiedActivityInput, diff --git a/packages/api/src/ats/activity/activity.module.ts b/packages/api/src/ats/activity/activity.module.ts index 312b89e65..b895d3f94 100644 --- a/packages/api/src/ats/activity/activity.module.ts +++ b/packages/api/src/ats/activity/activity.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/activity/types/mappingsTypes.ts b/packages/api/src/ats/activity/types/mappingsTypes.ts deleted file mode 100644 index e0f33d0f8..000000000 --- a/packages/api/src/ats/activity/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const activityUnificationMapping = {}; diff --git a/packages/api/src/ats/activity/types/model.unified.ts b/packages/api/src/ats/activity/types/model.unified.ts index 7b26e6fad..3f92136e6 100644 --- a/packages/api/src/ats/activity/types/model.unified.ts +++ b/packages/api/src/ats/activity/types/model.unified.ts @@ -1,3 +1,77 @@ -export class UnifiedActivityInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString, IsDateString } from 'class-validator'; -export class UnifiedActivityOutput extends UnifiedActivityInput {} +export class UnifiedActivityInput { + @ApiPropertyOptional({ type: String, description: 'The type of activity' }) + @IsString() + @IsOptional() + activity_type?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The subject of the activity', + }) + @IsString() + @IsOptional() + subject?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The body of the activity', + }) + @IsString() + @IsOptional() + body?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The visibility of the activity', + }) + @IsString() + @IsOptional() + visibility?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the candidate', + }) + @IsUUID() + @IsOptional() + candidate_id?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote creation date of the activity', + }) + @IsDateString() + @IsOptional() + remote_created_at?: string; +} + +export class UnifiedActivityOutput extends UnifiedActivityInput { + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the activity', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: + 'The remote ID of the activity in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the activity in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/application/application.controller.ts b/packages/api/src/ats/application/application.controller.ts index 0ab698ac6..7b316b384 100644 --- a/packages/api/src/ats/application/application.controller.ts +++ b/packages/api/src/ats/application/application.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -23,6 +24,7 @@ import { UnifiedApplicationOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { ApplicationService } from './services/application.service'; @ApiTags('ats/application') @@ -53,7 +55,7 @@ export class ApplicationController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedApplicationOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class ApplicationController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedApplicationOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class ApplicationController { }) @ApiBody({ type: UnifiedApplicationInput }) @ApiCustomResponse(UnifiedApplicationOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedApplicationData: UnifiedApplicationInput, diff --git a/packages/api/src/ats/application/application.module.ts b/packages/api/src/ats/application/application.module.ts index a1c30991e..a215f7e34 100644 --- a/packages/api/src/ats/application/application.module.ts +++ b/packages/api/src/ats/application/application.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/application/types/mappingsTypes.ts b/packages/api/src/ats/application/types/mappingsTypes.ts deleted file mode 100644 index d3a1ebb88..000000000 --- a/packages/api/src/ats/application/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const applicationUnificationMapping = {}; diff --git a/packages/api/src/ats/application/types/model.unified.ts b/packages/api/src/ats/application/types/model.unified.ts index 12657b49b..d4f4a0ad1 100644 --- a/packages/api/src/ats/application/types/model.unified.ts +++ b/packages/api/src/ats/application/types/model.unified.ts @@ -1,3 +1,108 @@ -export class UnifiedApplicationInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { + IsUUID, + IsOptional, + IsString, + IsDateString, + IsArray, +} from 'class-validator'; -export class UnifiedApplicationOutput extends UnifiedApplicationInput {} +export class UnifiedApplicationInput { + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The application date', + }) + @IsDateString() + @IsOptional() + applied_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The rejection date', + }) + @IsDateString() + @IsOptional() + rejected_at?: string; + + @ApiPropertyOptional({ + type: [String], + description: 'The offers UUIDs for the application', + }) + @IsArray() + @IsOptional() + offers?: string[]; + + @ApiPropertyOptional({ + type: String, + description: 'The source of the application', + }) + @IsString() + @IsOptional() + source?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the person credited for the application', + }) + @IsUUID() + @IsOptional() + credited_to?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the current stage of the application', + }) + @IsUUID() + @IsOptional() + current_stage?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The rejection reason for the application', + }) + @IsString() + @IsOptional() + reject_reason?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the candidate', + }) + @IsUUID() + @IsOptional() + candidate_id?: string; + + @ApiPropertyOptional({ type: String, description: 'The UUID of the job' }) + @IsUUID() + @IsOptional() + job_id?: string; +} + +export class UnifiedApplicationOutput extends UnifiedApplicationInput { + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the application', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: + 'The remote ID of the application in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the application in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/attachment/attachment.controller.ts b/packages/api/src/ats/attachment/attachment.controller.ts index 6245c7b31..e1ae17680 100644 --- a/packages/api/src/ats/attachment/attachment.controller.ts +++ b/packages/api/src/ats/attachment/attachment.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -23,6 +24,7 @@ import { UnifiedAttachmentOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { AttachmentService } from './services/attachment.service'; @ApiTags('ats/attachment') @@ -53,7 +55,7 @@ export class AttachmentController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedAttachmentOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class AttachmentController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedAttachmentOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class AttachmentController { }) @ApiBody({ type: UnifiedAttachmentInput }) @ApiCustomResponse(UnifiedAttachmentOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedAttachmentData: UnifiedAttachmentInput, diff --git a/packages/api/src/ats/attachment/attachment.module.ts b/packages/api/src/ats/attachment/attachment.module.ts index b68c83f37..12f5e54ec 100644 --- a/packages/api/src/ats/attachment/attachment.module.ts +++ b/packages/api/src/ats/attachment/attachment.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/attachment/types/mappingsTypes.ts b/packages/api/src/ats/attachment/types/mappingsTypes.ts deleted file mode 100644 index 94dfc164b..000000000 --- a/packages/api/src/ats/attachment/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const attachmentUnificationMapping = {}; diff --git a/packages/api/src/ats/attachment/types/model.unified.ts b/packages/api/src/ats/attachment/types/model.unified.ts index b452a5c8d..8ecaa7333 100644 --- a/packages/api/src/ats/attachment/types/model.unified.ts +++ b/packages/api/src/ats/attachment/types/model.unified.ts @@ -1,3 +1,71 @@ -export class UnifiedAttachmentInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString, IsDateString } from 'class-validator'; -export class UnifiedAttachmentOutput extends UnifiedAttachmentInput {} +export class UnifiedAttachmentInput { + @ApiPropertyOptional({ type: String, description: 'The URL of the file' }) + @IsString() + @IsOptional() + file_url?: string; + + @ApiPropertyOptional({ type: String, description: 'The name of the file' }) + @IsString() + @IsOptional() + file_name?: string; + + @ApiPropertyOptional({ type: String, description: 'The type of the file' }) + @IsString() + @IsOptional() + file_type?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote creation date of the attachment', + }) + @IsDateString() + @IsOptional() + remote_created_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote modification date of the attachment', + }) + @IsDateString() + @IsOptional() + remote_modified_at?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the candidate', + }) + @IsUUID() + @IsOptional() + candidate_id?: string; +} + +export class UnifiedAttachmentOutput extends UnifiedAttachmentInput { + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the attachment', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The remote ID of the attachment', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the attachment in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/candidate/candidate.controller.ts b/packages/api/src/ats/candidate/candidate.controller.ts index 351a88b56..a24dd695f 100644 --- a/packages/api/src/ats/candidate/candidate.controller.ts +++ b/packages/api/src/ats/candidate/candidate.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -23,6 +24,7 @@ import { UnifiedCandidateOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CandidateService } from './services/candidate.service'; @ApiTags('ats/candidate') @@ -53,7 +55,7 @@ export class CandidateController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedCandidateOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class CandidateController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedCandidateOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class CandidateController { }) @ApiBody({ type: UnifiedCandidateInput }) @ApiCustomResponse(UnifiedCandidateOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedCandidateData: UnifiedCandidateInput, diff --git a/packages/api/src/ats/candidate/candidate.module.ts b/packages/api/src/ats/candidate/candidate.module.ts index 475113d66..4550a23a0 100644 --- a/packages/api/src/ats/candidate/candidate.module.ts +++ b/packages/api/src/ats/candidate/candidate.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/candidate/types/mappingsTypes.ts b/packages/api/src/ats/candidate/types/mappingsTypes.ts deleted file mode 100644 index 4aa2e18ca..000000000 --- a/packages/api/src/ats/candidate/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const candidateUnificationMapping = {}; diff --git a/packages/api/src/ats/candidate/types/model.unified.ts b/packages/api/src/ats/candidate/types/model.unified.ts index 23f95d831..33f9ad14b 100644 --- a/packages/api/src/ats/candidate/types/model.unified.ts +++ b/packages/api/src/ats/candidate/types/model.unified.ts @@ -1,3 +1,370 @@ -export class UnifiedCandidateInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { + IsUUID, + IsOptional, + IsString, + IsBoolean, + IsDateString, +} from 'class-validator'; -export class UnifiedCandidateOutput extends UnifiedCandidateInput {} +export class UnifiedCandidateInput { + @ApiPropertyOptional({ + type: String, + description: 'The first name of the candidate', + }) + @IsString() + @IsOptional() + first_name?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The last name of the candidate', + }) + @IsString() + @IsOptional() + last_name?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The company of the candidate', + }) + @IsString() + @IsOptional() + company?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The title of the candidate', + }) + @IsString() + @IsOptional() + title?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The locations of the candidate', + }) + @IsString() + @IsOptional() + locations?: string; + + @ApiPropertyOptional({ + type: Boolean, + description: 'Whether the candidate is private', + }) + @IsBoolean() + @IsOptional() + is_private?: boolean; + + @ApiPropertyOptional({ + type: Boolean, + description: 'Whether the candidate is reachable by email', + }) + @IsBoolean() + @IsOptional() + email_reachable?: boolean; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote creation date of the candidate', + }) + @IsDateString() + @IsOptional() + remote_created_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote modification date of the candidate', + }) + @IsDateString() + @IsOptional() + remote_modified_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The last interaction date with the candidate', + }) + @IsDateString() + @IsOptional() + last_interaction_at?: string; +} + +export class UnifiedCandidateOutput extends UnifiedCandidateInput { + @ApiPropertyOptional({ + type: String, + description: 'The uuid of the candidate', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The id of the candidate in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the candidate in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} + +export class UnifiedCandidateTagInput { + @ApiPropertyOptional({ type: String, description: 'The name of the tag' }) + @IsString() + @IsOptional() + name?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the candidate', + }) + @IsUUID() + @IsOptional() + id_ats_candidate?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The creation date of the tag', + }) + @IsDateString() + @IsOptional() + created_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The modification date of the tag', + }) + @IsDateString() + @IsOptional() + modified_at?: string; +} + +export class UnifiedCandidateTagOutput extends UnifiedCandidateTagInput { + @ApiPropertyOptional({ type: String, description: 'The UUID of the tag' }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The remote ID of the tag in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: 'The remote data of the tag in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} + +export class UnifiedCandidateUrlInput { + @ApiPropertyOptional({ type: String, description: 'The value of the URL' }) + @IsString() + @IsOptional() + value?: string; + + @ApiPropertyOptional({ type: String, description: 'The type of the URL' }) + @IsString() + @IsOptional() + type?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The creation date of the URL', + }) + @IsDateString() + @IsOptional() + created_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The modification date of the URL', + }) + @IsDateString() + @IsOptional() + modified_at?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the candidate', + }) + @IsUUID() + @IsOptional() + id_ats_candidate?: string; +} + +export class UnifiedCandidateUrlOutput extends UnifiedCandidateUrlInput { + @ApiPropertyOptional({ type: String, description: 'The UUID of the URL' }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The remote ID of the URL in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: 'The remote data of the URL in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} + +export class UnifiedCandidatePhoneNumberInput { + @ApiPropertyOptional({ type: String, description: 'The phone number value' }) + @IsString() + @IsOptional() + value?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The type of phone number', + }) + @IsString() + @IsOptional() + type?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The creation date of the phone number', + }) + @IsDateString() + @IsOptional() + created_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The modification date of the phone number', + }) + @IsDateString() + @IsOptional() + modified_at?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the candidate', + }) + @IsUUID() + @IsOptional() + id_ats_candidate?: string; +} + +export class UnifiedCandidatePhoneNumberOutput extends UnifiedCandidatePhoneNumberInput { + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the phone number', + }) + @IsUUID() + @IsOptional() + id_ats_candidate_phone_number?: string; + + @ApiPropertyOptional({ + type: String, + description: + 'The remote ID of the phone number in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the phone number in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} + +export class UnifiedCandidateEmailAddressInput { + @ApiPropertyOptional({ type: String, description: 'The email address value' }) + @IsString() + @IsOptional() + value?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The type of email address', + }) + @IsString() + @IsOptional() + type?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The creation date of the email address', + }) + @IsDateString() + @IsOptional() + created_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The modification date of the email address', + }) + @IsDateString() + @IsOptional() + modified_at?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the candidate', + }) + @IsUUID() + @IsOptional() + id_ats_candidate?: string; +} + +export class UnifiedCandidateEmailAddressOutput extends UnifiedCandidateEmailAddressInput { + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the email address', + }) + @IsUUID() + @IsOptional() + id_ats_candidate_email_address?: string; + + @ApiPropertyOptional({ + type: String, + description: + 'The remote ID of the email address in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the email address in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/department/department.controller.ts b/packages/api/src/ats/department/department.controller.ts index c49cec9e2..e45da0b79 100644 --- a/packages/api/src/ats/department/department.controller.ts +++ b/packages/api/src/ats/department/department.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedDepartmentOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('ats/department') @Controller('ats/department') @@ -53,7 +55,7 @@ export class DepartmentController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedDepartmentOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class DepartmentController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedDepartmentOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -100,46 +102,4 @@ export class DepartmentController { ) { return this.departmentService.getDepartment(id, remote_data); } - - @ApiOperation({ - operationId: 'create', - summary: 'Create a Department', - description: 'Create a department in any supported Ats software', - }) - @ApiHeader({ - name: 'x-connection-token', - required: true, - description: 'The connection token', - example: 'b008e199-eda9-4629-bd41-a01b6195864a', - }) - @ApiQuery({ - name: 'remote_data', - required: false, - type: Boolean, - description: 'Set to true to include data from the original Ats software.', - }) - @ApiBody({ type: UnifiedDepartmentInput }) - @ApiCustomResponse(UnifiedDepartmentOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() - async create( - @Body() unifiedDepartmentData: UnifiedDepartmentInput, - @Headers('x-connection-token') connection_token: string, - @Query('remote_data') remote_data?: boolean, - ) { - try { - const { linkedUserId, remoteSource } = - await this.connectionUtils.getConnectionMetadataFromConnectionToken( - connection_token, - ); - return this.departmentService.addDepartment( - unifiedDepartmentData, - remoteSource, - linkedUserId, - remote_data, - ); - } catch (error) { - throw new Error(error); - } - } } diff --git a/packages/api/src/ats/department/department.module.ts b/packages/api/src/ats/department/department.module.ts index 3861dca01..a302b143c 100644 --- a/packages/api/src/ats/department/department.module.ts +++ b/packages/api/src/ats/department/department.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/department/types/mappingsTypes.ts b/packages/api/src/ats/department/types/mappingsTypes.ts deleted file mode 100644 index 155231804..000000000 --- a/packages/api/src/ats/department/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const departmentUnificationMapping = {}; diff --git a/packages/api/src/ats/department/types/model.unified.ts b/packages/api/src/ats/department/types/model.unified.ts index cb484f3de..b78a6c318 100644 --- a/packages/api/src/ats/department/types/model.unified.ts +++ b/packages/api/src/ats/department/types/model.unified.ts @@ -1,3 +1,39 @@ -export class UnifiedDepartmentInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString, IsDateString } from 'class-validator'; -export class UnifiedDepartmentOutput extends UnifiedDepartmentInput {} +export class UnifiedDepartmentInput { + @ApiPropertyOptional({ + type: String, + description: 'The name of the department', + }) + @IsString() + @IsOptional() + name?: string; +} + +export class UnifiedDepartmentOutput extends UnifiedDepartmentInput { + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the department', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: + 'The remote ID of the department in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the department in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/eeocs/eeocs.controller.ts b/packages/api/src/ats/eeocs/eeocs.controller.ts index 29246fd3e..18e82e248 100644 --- a/packages/api/src/ats/eeocs/eeocs.controller.ts +++ b/packages/api/src/ats/eeocs/eeocs.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -20,6 +21,7 @@ import { import { ApiCustomResponse } from '@@core/utils/types'; import { UnifiedEeocsInput, UnifiedEeocsOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { EeocsService } from './services/eeocs.service'; @ApiTags('ats/eeocs') @@ -50,7 +52,7 @@ export class EeocsController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedEeocsOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -89,7 +91,7 @@ export class EeocsController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedEeocsOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -97,46 +99,4 @@ export class EeocsController { ) { return this.eeocsService.getEeocs(id, remote_data); } - - @ApiOperation({ - operationId: 'create', - summary: 'Create a Eeocs', - description: 'Create a eeocs in any supported Ats software', - }) - @ApiHeader({ - name: 'x-connection-token', - required: true, - description: 'The connection token', - example: 'b008e199-eda9-4629-bd41-a01b6195864a', - }) - @ApiQuery({ - name: 'remote_data', - required: false, - type: Boolean, - description: 'Set to true to include data from the original Ats software.', - }) - @ApiBody({ type: UnifiedEeocsInput }) - @ApiCustomResponse(UnifiedEeocsOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() - async create( - @Body() unifiedEeocsData: UnifiedEeocsInput, - @Headers('x-connection-token') connection_token: string, - @Query('remote_data') remote_data?: boolean, - ) { - try { - const { linkedUserId, remoteSource } = - await this.connectionUtils.getConnectionMetadataFromConnectionToken( - connection_token, - ); - return this.eeocsService.addEeocs( - unifiedEeocsData, - remoteSource, - linkedUserId, - remote_data, - ); - } catch (error) { - throw new Error(error); - } - } } diff --git a/packages/api/src/ats/eeocs/eeocs.module.ts b/packages/api/src/ats/eeocs/eeocs.module.ts index cf0aaa719..7f4783129 100644 --- a/packages/api/src/ats/eeocs/eeocs.module.ts +++ b/packages/api/src/ats/eeocs/eeocs.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/eeocs/types/mappingsTypes.ts b/packages/api/src/ats/eeocs/types/mappingsTypes.ts deleted file mode 100644 index 2d1e4bbb9..000000000 --- a/packages/api/src/ats/eeocs/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const eeocsUnificationMapping = {}; diff --git a/packages/api/src/ats/eeocs/types/model.unified.ts b/packages/api/src/ats/eeocs/types/model.unified.ts index 0efae0f56..99cc10c88 100644 --- a/packages/api/src/ats/eeocs/types/model.unified.ts +++ b/packages/api/src/ats/eeocs/types/model.unified.ts @@ -1,3 +1,75 @@ -export class UnifiedEeocsInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString, IsDateString } from 'class-validator'; -export class UnifiedEeocsOutput extends UnifiedEeocsInput {} +export class UnifiedEeocsInput { + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the candidate', + }) + @IsUUID() + @IsOptional() + candidate_id?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The submission date of the EEOC', + }) + @IsDateString() + @IsOptional() + submitted_at?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The race of the candidate', + }) + @IsString() + @IsOptional() + race?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The gender of the candidate', + }) + @IsString() + @IsOptional() + gender?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The veteran status of the candidate', + }) + @IsString() + @IsOptional() + veteran_status?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The disability status of the candidate', + }) + @IsString() + @IsOptional() + disability_status?: string; +} + +export class UnifiedEeocsOutput extends UnifiedEeocsInput { + @ApiPropertyOptional({ type: String, description: 'The UUID of the EEOC' }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The remote ID of the EEOC in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: 'The remote data of the EEOC in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/interview/interview.controller.ts b/packages/api/src/ats/interview/interview.controller.ts index a563079dc..d0f7e8ac1 100644 --- a/packages/api/src/ats/interview/interview.controller.ts +++ b/packages/api/src/ats/interview/interview.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedInterviewOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('ats/interview') @Controller('ats/interview') @@ -53,7 +55,7 @@ export class InterviewController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedInterviewOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class InterviewController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedInterviewOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class InterviewController { }) @ApiBody({ type: UnifiedInterviewInput }) @ApiCustomResponse(UnifiedInterviewOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedInterviewData: UnifiedInterviewInput, diff --git a/packages/api/src/ats/interview/interview.module.ts b/packages/api/src/ats/interview/interview.module.ts index 5397a293f..023fad7b6 100644 --- a/packages/api/src/ats/interview/interview.module.ts +++ b/packages/api/src/ats/interview/interview.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/interview/types/mappingsTypes.ts b/packages/api/src/ats/interview/types/mappingsTypes.ts deleted file mode 100644 index ae63a2544..000000000 --- a/packages/api/src/ats/interview/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const interviewUnificationMapping = {}; diff --git a/packages/api/src/ats/interview/types/model.unified.ts b/packages/api/src/ats/interview/types/model.unified.ts index 50f42cadc..477a7a057 100644 --- a/packages/api/src/ats/interview/types/model.unified.ts +++ b/packages/api/src/ats/interview/types/model.unified.ts @@ -1,3 +1,121 @@ -export class UnifiedInterviewInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { + IsUUID, + IsOptional, + IsString, + IsDateString, + IsArray, +} from 'class-validator'; -export class UnifiedInterviewOutput extends UnifiedInterviewInput {} +export class UnifiedInterviewInput { + @ApiPropertyOptional({ + type: String, + description: 'The status of the interview', + }) + @IsString() + @IsOptional() + status?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the application', + }) + @IsUUID() + @IsOptional() + application_id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the job interview stage', + }) + @IsUUID() + @IsOptional() + job_interview_stage_id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the organizer', + }) + @IsUUID() + @IsOptional() + organized_by?: string; + + @ApiPropertyOptional({ + type: [String], + description: 'The UUIDs of the interviewers', + }) + @IsArray() + @IsOptional() + interviewers?: string[]; + + @ApiPropertyOptional({ + type: String, + description: 'The location of the interview', + }) + @IsString() + @IsOptional() + location?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The start date and time of the interview', + }) + @IsDateString() + @IsOptional() + start_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The end date and time of the interview', + }) + @IsDateString() + @IsOptional() + end_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote creation date of the interview', + }) + @IsDateString() + @IsOptional() + remote_created_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote modification date of the interview', + }) + @IsDateString() + @IsOptional() + remote_updated_at?: string; +} + +export class UnifiedInterviewOutput extends UnifiedInterviewInput { + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the interview', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: + 'The remote ID of the interview in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the interview in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/job/job.controller.ts b/packages/api/src/ats/job/job.controller.ts index b288ca306..6bf4e243e 100644 --- a/packages/api/src/ats/job/job.controller.ts +++ b/packages/api/src/ats/job/job.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { JobService } from './services/job.service'; import { UnifiedJobInput, UnifiedJobOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('ats/job') @Controller('ats/job') @@ -50,7 +52,7 @@ export class JobController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedJobOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -85,7 +87,7 @@ export class JobController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedJobOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -93,46 +95,4 @@ export class JobController { ) { return this.jobService.getJob(id, remote_data); } - - @ApiOperation({ - operationId: 'create', - summary: 'Create a Job', - description: 'Create a job in any supported Ats software', - }) - @ApiHeader({ - name: 'x-connection-token', - required: true, - description: 'The connection token', - example: 'b008e199-eda9-4629-bd41-a01b6195864a', - }) - @ApiQuery({ - name: 'remote_data', - required: false, - type: Boolean, - description: 'Set to true to include data from the original Ats software.', - }) - @ApiBody({ type: UnifiedJobInput }) - @ApiCustomResponse(UnifiedJobOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() - async create( - @Body() unifiedJobData: UnifiedJobInput, - @Headers('x-connection-token') connection_token: string, - @Query('remote_data') remote_data?: boolean, - ) { - try { - const { linkedUserId, remoteSource } = - await this.connectionUtils.getConnectionMetadataFromConnectionToken( - connection_token, - ); - return this.jobService.addJob( - unifiedJobData, - remoteSource, - linkedUserId, - remote_data, - ); - } catch (error) { - throw new Error(error); - } - } } diff --git a/packages/api/src/ats/job/job.module.ts b/packages/api/src/ats/job/job.module.ts index 46713fe8d..bd82fea5b 100644 --- a/packages/api/src/ats/job/job.module.ts +++ b/packages/api/src/ats/job/job.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/job/types/mappingsTypes.ts b/packages/api/src/ats/job/types/mappingsTypes.ts deleted file mode 100644 index 8b13d231b..000000000 --- a/packages/api/src/ats/job/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const jobUnificationMapping = {}; diff --git a/packages/api/src/ats/job/types/model.unified.ts b/packages/api/src/ats/job/types/model.unified.ts index b62148fd7..684641191 100644 --- a/packages/api/src/ats/job/types/model.unified.ts +++ b/packages/api/src/ats/job/types/model.unified.ts @@ -1,3 +1,119 @@ -export class UnifiedJobInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { + IsUUID, + IsOptional, + IsString, + IsBoolean, + IsDateString, + IsArray, +} from 'class-validator'; -export class UnifiedJobOutput extends UnifiedJobInput {} +export class UnifiedJobInput { + @ApiPropertyOptional({ type: String, description: 'The name of the job' }) + @IsString() + @IsOptional() + name?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The description of the job', + }) + @IsString() + @IsOptional() + description?: string; + + @ApiPropertyOptional({ type: String, description: 'The code of the job' }) + @IsString() + @IsOptional() + code?: string; + + @ApiPropertyOptional({ type: String, description: 'The status of the job' }) + @IsString() + @IsOptional() + status?: string; + + @ApiPropertyOptional({ type: String, description: 'The type of the job' }) + @IsString() + @IsOptional() + type?: string; + + @ApiPropertyOptional({ + type: Boolean, + description: 'Whether the job is confidential', + }) + @IsBoolean() + @IsOptional() + confidential?: boolean; + + @ApiPropertyOptional({ + type: [String], + description: 'The departments UUIDs associated with the job', + }) + @IsArray() + @IsOptional() + departments?: string[]; + + @ApiPropertyOptional({ + type: [String], + description: 'The offices UUIDs associated with the job', + }) + @IsArray() + @IsOptional() + offices?: string[]; + + @ApiPropertyOptional({ + type: [String], + description: 'The managers UUIDs associated with the job', + }) + @IsArray() + @IsOptional() + managers?: string[]; + + @ApiPropertyOptional({ + type: [String], + description: 'The recruiters UUIDs associated with the job', + }) + @IsArray() + @IsOptional() + recruiters?: string[]; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote creation date of the job', + }) + @IsDateString() + @IsOptional() + remote_created_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote modification date of the job', + }) + @IsDateString() + @IsOptional() + remote_updated_at?: string; +} + +export class UnifiedJobOutput extends UnifiedJobInput { + @ApiPropertyOptional({ type: String, description: 'The UUID of the job' }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The remote ID of the job in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: 'The remote data of the job in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/jobinterviewstage/jobinterviewstage.controller.ts b/packages/api/src/ats/jobinterviewstage/jobinterviewstage.controller.ts index 1bdc3244a..fc9a7e9f0 100644 --- a/packages/api/src/ats/jobinterviewstage/jobinterviewstage.controller.ts +++ b/packages/api/src/ats/jobinterviewstage/jobinterviewstage.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedJobInterviewStageOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('ats/jobinterviewstage') @Controller('ats/jobinterviewstage') @@ -53,7 +55,7 @@ export class JobInterviewStageController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedJobInterviewStageOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class JobInterviewStageController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedJobInterviewStageOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -100,46 +102,4 @@ export class JobInterviewStageController { ) { return this.jobinterviewstageService.getJobInterviewStage(id, remote_data); } - - @ApiOperation({ - operationId: 'create', - summary: 'Create a JobInterviewStage', - description: 'Create a jobinterviewstage in any supported Ats software', - }) - @ApiHeader({ - name: 'x-connection-token', - required: true, - description: 'The connection token', - example: 'b008e199-eda9-4629-bd41-a01b6195864a', - }) - @ApiQuery({ - name: 'remote_data', - required: false, - type: Boolean, - description: 'Set to true to include data from the original Ats software.', - }) - @ApiBody({ type: UnifiedJobInterviewStageInput }) - @ApiCustomResponse(UnifiedJobInterviewStageOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() - async create( - @Body() unifiedJobInterviewStageData: UnifiedJobInterviewStageInput, - @Headers('x-connection-token') connection_token: string, - @Query('remote_data') remote_data?: boolean, - ) { - try { - const { linkedUserId, remoteSource } = - await this.connectionUtils.getConnectionMetadataFromConnectionToken( - connection_token, - ); - return this.jobinterviewstageService.addJobInterviewStage( - unifiedJobInterviewStageData, - remoteSource, - linkedUserId, - remote_data, - ); - } catch (error) { - throw new Error(error); - } - } } diff --git a/packages/api/src/ats/jobinterviewstage/jobinterviewstage.module.ts b/packages/api/src/ats/jobinterviewstage/jobinterviewstage.module.ts index 6cbd639af..5200c8253 100644 --- a/packages/api/src/ats/jobinterviewstage/jobinterviewstage.module.ts +++ b/packages/api/src/ats/jobinterviewstage/jobinterviewstage.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/jobinterviewstage/types/mappingsTypes.ts b/packages/api/src/ats/jobinterviewstage/types/mappingsTypes.ts deleted file mode 100644 index d7e18f903..000000000 --- a/packages/api/src/ats/jobinterviewstage/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const jobinterviewstageUnificationMapping = {}; diff --git a/packages/api/src/ats/jobinterviewstage/types/model.unified.ts b/packages/api/src/ats/jobinterviewstage/types/model.unified.ts index 83bca0c65..cb5cc665a 100644 --- a/packages/api/src/ats/jobinterviewstage/types/model.unified.ts +++ b/packages/api/src/ats/jobinterviewstage/types/model.unified.ts @@ -1,3 +1,55 @@ -export class UnifiedJobInterviewStageInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { + IsUUID, + IsOptional, + IsString, + IsInt, + IsDateString, +} from 'class-validator'; -export class UnifiedJobInterviewStageOutput extends UnifiedJobInterviewStageInput {} +export class UnifiedJobInterviewStageInput { + @ApiPropertyOptional({ + type: String, + description: 'The name of the job interview stage', + }) + @IsString() + @IsOptional() + name?: string; + + @ApiPropertyOptional({ type: Number, description: 'The order of the stage' }) + @IsInt() + @IsOptional() + stage_order?: number; + + @ApiPropertyOptional({ type: String, description: 'The UUID of the job' }) + @IsUUID() + @IsOptional() + job_id?: string; +} + +export class UnifiedJobInterviewStageOutput extends UnifiedJobInterviewStageInput { + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the job interview stage', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: + 'The remote ID of the job interview stage in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the job interview stage in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/offer/offer.controller.ts b/packages/api/src/ats/offer/offer.controller.ts index 630243d0a..a758d7845 100644 --- a/packages/api/src/ats/offer/offer.controller.ts +++ b/packages/api/src/ats/offer/offer.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { OfferService } from './services/offer.service'; import { UnifiedOfferInput, UnifiedOfferOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('ats/offer') @Controller('ats/offer') @@ -50,7 +52,7 @@ export class OfferController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedOfferOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -89,7 +91,7 @@ export class OfferController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedOfferOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -97,46 +99,4 @@ export class OfferController { ) { return this.offerService.getOffer(id, remote_data); } - - @ApiOperation({ - operationId: 'create', - summary: 'Create a Offer', - description: 'Create a offer in any supported Ats software', - }) - @ApiHeader({ - name: 'x-connection-token', - required: true, - description: 'The connection token', - example: 'b008e199-eda9-4629-bd41-a01b6195864a', - }) - @ApiQuery({ - name: 'remote_data', - required: false, - type: Boolean, - description: 'Set to true to include data from the original Ats software.', - }) - @ApiBody({ type: UnifiedOfferInput }) - @ApiCustomResponse(UnifiedOfferOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() - async create( - @Body() unifiedOfferData: UnifiedOfferInput, - @Headers('x-connection-token') connection_token: string, - @Query('remote_data') remote_data?: boolean, - ) { - try { - const { linkedUserId, remoteSource } = - await this.connectionUtils.getConnectionMetadataFromConnectionToken( - connection_token, - ); - return this.offerService.addOffer( - unifiedOfferData, - remoteSource, - linkedUserId, - remote_data, - ); - } catch (error) { - throw new Error(error); - } - } } diff --git a/packages/api/src/ats/offer/offer.module.ts b/packages/api/src/ats/offer/offer.module.ts index bd8542bc6..2168c3a10 100644 --- a/packages/api/src/ats/offer/offer.module.ts +++ b/packages/api/src/ats/offer/offer.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/offer/types/mappingsTypes.ts b/packages/api/src/ats/offer/types/mappingsTypes.ts deleted file mode 100644 index 020a3ce69..000000000 --- a/packages/api/src/ats/offer/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const offerUnificationMapping = {}; diff --git a/packages/api/src/ats/offer/types/model.unified.ts b/packages/api/src/ats/offer/types/model.unified.ts index 3ff3dd77e..6e5023068 100644 --- a/packages/api/src/ats/offer/types/model.unified.ts +++ b/packages/api/src/ats/offer/types/model.unified.ts @@ -1,3 +1,80 @@ -export class UnifiedOfferInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString, IsDateString } from 'class-validator'; -export class UnifiedOfferOutput extends UnifiedOfferInput {} +export class UnifiedOfferInput { + @ApiPropertyOptional({ type: String, description: 'The UUID of the creator' }) + @IsUUID() + @IsOptional() + created_by?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote creation date of the offer', + }) + @IsDateString() + @IsOptional() + remote_created_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The closing date of the offer', + }) + @IsDateString() + @IsOptional() + closed_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The sending date of the offer', + }) + @IsDateString() + @IsOptional() + sent_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The start date of the offer', + }) + @IsDateString() + @IsOptional() + start_date?: string; + + @ApiPropertyOptional({ type: String, description: 'The status of the offer' }) + @IsString() + @IsOptional() + status?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the application', + }) + @IsUUID() + @IsOptional() + application_id?: string; +} + +export class UnifiedOfferOutput extends UnifiedOfferInput { + @ApiPropertyOptional({ type: String, description: 'The UUID of the offer' }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The remote ID of the offer in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: 'The remote data of the offer in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/office/office.controller.ts b/packages/api/src/ats/office/office.controller.ts index 1a30d33fb..1a0094ee8 100644 --- a/packages/api/src/ats/office/office.controller.ts +++ b/packages/api/src/ats/office/office.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { OfficeService } from './services/office.service'; import { UnifiedOfficeInput, UnifiedOfficeOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('ats/office') @Controller('ats/office') @@ -50,8 +52,7 @@ export class OfficeController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedOfficeOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -89,8 +90,7 @@ export class OfficeController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedOfficeOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -117,8 +117,7 @@ export class OfficeController { }) @ApiBody({ type: UnifiedOfficeInput }) @ApiCustomResponse(UnifiedOfficeOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedOfficeData: UnifiedOfficeInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/ats/office/office.module.ts b/packages/api/src/ats/office/office.module.ts index 489974a2f..9b0b1bf4a 100644 --- a/packages/api/src/ats/office/office.module.ts +++ b/packages/api/src/ats/office/office.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/office/types/mappingsTypes.ts b/packages/api/src/ats/office/types/mappingsTypes.ts deleted file mode 100644 index a75f031bc..000000000 --- a/packages/api/src/ats/office/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const officeUnificationMapping = {}; diff --git a/packages/api/src/ats/office/types/model.unified.ts b/packages/api/src/ats/office/types/model.unified.ts index b5cbdaf8f..b9784806d 100644 --- a/packages/api/src/ats/office/types/model.unified.ts +++ b/packages/api/src/ats/office/types/model.unified.ts @@ -1,3 +1,40 @@ -export class UnifiedOfficeInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString, IsDateString } from 'class-validator'; -export class UnifiedOfficeOutput extends UnifiedOfficeInput {} +export class UnifiedOfficeInput { + @ApiPropertyOptional({ type: String, description: 'The name of the office' }) + @IsString() + @IsOptional() + name?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The location of the office', + }) + @IsString() + @IsOptional() + location?: string; +} + +export class UnifiedOfficeOutput extends UnifiedOfficeInput { + @ApiPropertyOptional({ type: String, description: 'The UUID of the office' }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The remote ID of the office in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the office in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/rejectreason/rejectreason.controller.ts b/packages/api/src/ats/rejectreason/rejectreason.controller.ts index eb97b5c6c..4d9167ba4 100644 --- a/packages/api/src/ats/rejectreason/rejectreason.controller.ts +++ b/packages/api/src/ats/rejectreason/rejectreason.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedRejectReasonOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('ats/rejectreason') @Controller('ats/rejectreason') @@ -53,7 +55,7 @@ export class RejectReasonController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedRejectReasonOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class RejectReasonController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedRejectReasonOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -100,46 +102,4 @@ export class RejectReasonController { ) { return this.rejectreasonService.getRejectReason(id, remote_data); } - - @ApiOperation({ - operationId: 'create', - summary: 'Create a RejectReason', - description: 'Create a rejectreason in any supported Ats software', - }) - @ApiHeader({ - name: 'x-connection-token', - required: true, - description: 'The connection token', - example: 'b008e199-eda9-4629-bd41-a01b6195864a', - }) - @ApiQuery({ - name: 'remote_data', - required: false, - type: Boolean, - description: 'Set to true to include data from the original Ats software.', - }) - @ApiBody({ type: UnifiedRejectReasonInput }) - @ApiCustomResponse(UnifiedRejectReasonOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() - async create( - @Body() unifiedRejectReasonData: UnifiedRejectReasonInput, - @Headers('x-connection-token') connection_token: string, - @Query('remote_data') remote_data?: boolean, - ) { - try { - const { linkedUserId, remoteSource } = - await this.connectionUtils.getConnectionMetadataFromConnectionToken( - connection_token, - ); - return this.rejectreasonService.addRejectReason( - unifiedRejectReasonData, - remoteSource, - linkedUserId, - remote_data, - ); - } catch (error) { - throw new Error(error); - } - } } diff --git a/packages/api/src/ats/rejectreason/rejectreason.module.ts b/packages/api/src/ats/rejectreason/rejectreason.module.ts index c896b9c25..c8863f68d 100644 --- a/packages/api/src/ats/rejectreason/rejectreason.module.ts +++ b/packages/api/src/ats/rejectreason/rejectreason.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/rejectreason/types/mappingsTypes.ts b/packages/api/src/ats/rejectreason/types/mappingsTypes.ts deleted file mode 100644 index 83dfa7431..000000000 --- a/packages/api/src/ats/rejectreason/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const rejectreasonUnificationMapping = {}; diff --git a/packages/api/src/ats/rejectreason/types/model.unified.ts b/packages/api/src/ats/rejectreason/types/model.unified.ts index 40a368d26..3617423c6 100644 --- a/packages/api/src/ats/rejectreason/types/model.unified.ts +++ b/packages/api/src/ats/rejectreason/types/model.unified.ts @@ -1,3 +1,39 @@ -export class UnifiedRejectReasonInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString } from 'class-validator'; -export class UnifiedRejectReasonOutput extends UnifiedRejectReasonInput {} +export class UnifiedRejectReasonInput { + @ApiPropertyOptional({ + type: String, + description: 'The name of the reject reason', + }) + @IsString() + @IsOptional() + name?: string; +} + +export class UnifiedRejectReasonOutput extends UnifiedRejectReasonInput { + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the reject reason', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: + 'The remote ID of the reject reason in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the reject reason in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/scorecard/scorecard.controller.ts b/packages/api/src/ats/scorecard/scorecard.controller.ts index 3d8151f50..60ce60355 100644 --- a/packages/api/src/ats/scorecard/scorecard.controller.ts +++ b/packages/api/src/ats/scorecard/scorecard.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedScoreCardOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('ats/scorecard') @Controller('ats/scorecard') @@ -53,7 +55,7 @@ export class ScoreCardController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedScoreCardOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class ScoreCardController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedScoreCardOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -100,46 +102,4 @@ export class ScoreCardController { ) { return this.scorecardService.getScoreCard(id, remote_data); } - - @ApiOperation({ - operationId: 'create', - summary: 'Create a ScoreCard', - description: 'Create a scorecard in any supported Ats software', - }) - @ApiHeader({ - name: 'x-connection-token', - required: true, - description: 'The connection token', - example: 'b008e199-eda9-4629-bd41-a01b6195864a', - }) - @ApiQuery({ - name: 'remote_data', - required: false, - type: Boolean, - description: 'Set to true to include data from the original Ats software.', - }) - @ApiBody({ type: UnifiedScoreCardInput }) - @ApiCustomResponse(UnifiedScoreCardOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() - async create( - @Body() unifiedScoreCardData: UnifiedScoreCardInput, - @Headers('x-connection-token') connection_token: string, - @Query('remote_data') remote_data?: boolean, - ) { - try { - const { linkedUserId, remoteSource } = - await this.connectionUtils.getConnectionMetadataFromConnectionToken( - connection_token, - ); - return this.scorecardService.addScoreCard( - unifiedScoreCardData, - remoteSource, - linkedUserId, - remote_data, - ); - } catch (error) { - throw new Error(error); - } - } } diff --git a/packages/api/src/ats/scorecard/scorecard.module.ts b/packages/api/src/ats/scorecard/scorecard.module.ts index e9fe82f9c..aa41a93fe 100644 --- a/packages/api/src/ats/scorecard/scorecard.module.ts +++ b/packages/api/src/ats/scorecard/scorecard.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/scorecard/types/mappingsTypes.ts b/packages/api/src/ats/scorecard/types/mappingsTypes.ts deleted file mode 100644 index 2a13a3b05..000000000 --- a/packages/api/src/ats/scorecard/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const scorecardUnificationMapping = {}; diff --git a/packages/api/src/ats/scorecard/types/model.unified.ts b/packages/api/src/ats/scorecard/types/model.unified.ts index dc441543c..62c6b86d1 100644 --- a/packages/api/src/ats/scorecard/types/model.unified.ts +++ b/packages/api/src/ats/scorecard/types/model.unified.ts @@ -1,3 +1,73 @@ -export class UnifiedScoreCardInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString, IsDateString } from 'class-validator'; -export class UnifiedScoreCardOutput extends UnifiedScoreCardInput {} +export class UnifiedScoreCardInput { + @ApiPropertyOptional({ + type: String, + description: 'The overall recommendation', + }) + @IsString() + @IsOptional() + overall_recommendation?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the application', + }) + @IsUUID() + @IsOptional() + application_id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the interview', + }) + @IsUUID() + @IsOptional() + interview_id?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote creation date of the scorecard', + }) + @IsDateString() + @IsOptional() + remote_created_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The submission date of the scorecard', + }) + @IsDateString() + @IsOptional() + submitted_at?: string; +} + +export class UnifiedScoreCardOutput extends UnifiedScoreCardInput { + @ApiPropertyOptional({ + type: String, + description: 'The UUID of the scorecard', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: + 'The remote ID of the scorecard in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the scorecard in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/screeningquestion/screeningquestion.controller.ts b/packages/api/src/ats/screeningquestion/screeningquestion.controller.ts index e58a90011..9bba8c181 100644 --- a/packages/api/src/ats/screeningquestion/screeningquestion.controller.ts +++ b/packages/api/src/ats/screeningquestion/screeningquestion.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedScreeningQuestionOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('ats/screeningquestion') @Controller('ats/screeningquestion') @@ -53,7 +55,7 @@ export class ScreeningQuestionController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedScreeningQuestionOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class ScreeningQuestionController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedScreeningQuestionOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -100,46 +102,4 @@ export class ScreeningQuestionController { ) { return this.screeningquestionService.getScreeningQuestion(id, remote_data); } - - @ApiOperation({ - operationId: 'create', - summary: 'Create a ScreeningQuestion', - description: 'Create a screeningquestion in any supported Ats software', - }) - @ApiHeader({ - name: 'x-connection-token', - required: true, - description: 'The connection token', - example: 'b008e199-eda9-4629-bd41-a01b6195864a', - }) - @ApiQuery({ - name: 'remote_data', - required: false, - type: Boolean, - description: 'Set to true to include data from the original Ats software.', - }) - @ApiBody({ type: UnifiedScreeningQuestionInput }) - @ApiCustomResponse(UnifiedScreeningQuestionOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() - async create( - @Body() unifiedScreeningQuestionData: UnifiedScreeningQuestionInput, - @Headers('x-connection-token') connection_token: string, - @Query('remote_data') remote_data?: boolean, - ) { - try { - const { linkedUserId, remoteSource } = - await this.connectionUtils.getConnectionMetadataFromConnectionToken( - connection_token, - ); - return this.screeningquestionService.addScreeningQuestion( - unifiedScreeningQuestionData, - remoteSource, - linkedUserId, - remote_data, - ); - } catch (error) { - throw new Error(error); - } - } } diff --git a/packages/api/src/ats/screeningquestion/screeningquestion.module.ts b/packages/api/src/ats/screeningquestion/screeningquestion.module.ts index ec694167c..6dfccee50 100644 --- a/packages/api/src/ats/screeningquestion/screeningquestion.module.ts +++ b/packages/api/src/ats/screeningquestion/screeningquestion.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/tag/tag.controller.ts b/packages/api/src/ats/tag/tag.controller.ts index a50e39fb2..107860afa 100644 --- a/packages/api/src/ats/tag/tag.controller.ts +++ b/packages/api/src/ats/tag/tag.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { TagService } from './services/tag.service'; import { UnifiedTagInput, UnifiedTagOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('ats/tag') @Controller('ats/tag') @@ -50,7 +52,7 @@ export class TagController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedTagOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -85,7 +87,7 @@ export class TagController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedTagOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -93,46 +95,4 @@ export class TagController { ) { return this.tagService.getTag(id, remote_data); } - - @ApiOperation({ - operationId: 'create', - summary: 'Create a Tag', - description: 'Create a tag in any supported Ats software', - }) - @ApiHeader({ - name: 'x-connection-token', - required: true, - description: 'The connection token', - example: 'b008e199-eda9-4629-bd41-a01b6195864a', - }) - @ApiQuery({ - name: 'remote_data', - required: false, - type: Boolean, - description: 'Set to true to include data from the original Ats software.', - }) - @ApiBody({ type: UnifiedTagInput }) - @ApiCustomResponse(UnifiedTagOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() - async create( - @Body() unifiedTagData: UnifiedTagInput, - @Headers('x-connection-token') connection_token: string, - @Query('remote_data') remote_data?: boolean, - ) { - try { - const { linkedUserId, remoteSource } = - await this.connectionUtils.getConnectionMetadataFromConnectionToken( - connection_token, - ); - return this.tagService.addTag( - unifiedTagData, - remoteSource, - linkedUserId, - remote_data, - ); - } catch (error) { - throw new Error(error); - } - } } diff --git a/packages/api/src/ats/tag/tag.module.ts b/packages/api/src/ats/tag/tag.module.ts index 42fef05cc..39326f628 100644 --- a/packages/api/src/ats/tag/tag.module.ts +++ b/packages/api/src/ats/tag/tag.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ats/user/types/mappingsTypes.ts b/packages/api/src/ats/user/types/mappingsTypes.ts deleted file mode 100644 index aba7107f2..000000000 --- a/packages/api/src/ats/user/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const userUnificationMapping = {}; diff --git a/packages/api/src/ats/user/types/model.unified.ts b/packages/api/src/ats/user/types/model.unified.ts index fe03f0afd..0dad63bcd 100644 --- a/packages/api/src/ats/user/types/model.unified.ts +++ b/packages/api/src/ats/user/types/model.unified.ts @@ -1,3 +1,87 @@ -export class UnifiedUserInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { + IsUUID, + IsOptional, + IsString, + IsBoolean, + IsDateString, +} from 'class-validator'; -export class UnifiedUserOutput extends UnifiedUserInput {} +export class UnifiedUserInput { + @ApiPropertyOptional({ + type: String, + description: 'The first name of the user', + }) + @IsString() + @IsOptional() + first_name?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The last name of the user', + }) + @IsString() + @IsOptional() + last_name?: string; + + @ApiPropertyOptional({ type: String, description: 'The email of the user' }) + @IsString() + @IsOptional() + email?: string; + + @ApiPropertyOptional({ + type: Boolean, + description: 'Whether the user is disabled', + }) + @IsBoolean() + @IsOptional() + disabled?: boolean; + + @ApiPropertyOptional({ + type: String, + description: 'The access role of the user', + }) + @IsString() + @IsOptional() + access_role?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote creation date of the user', + }) + @IsDateString() + @IsOptional() + remote_created_at?: string; + + @ApiPropertyOptional({ + type: String, + format: 'date-time', + description: 'The remote modification date of the user', + }) + @IsDateString() + @IsOptional() + remote_modified_at?: string; +} + +export class UnifiedUserOutput extends UnifiedUserInput { + @ApiPropertyOptional({ type: String, description: 'The UUID of the user' }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The remote ID of the user in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: 'The remote data of the user in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/ats/user/user.controller.ts b/packages/api/src/ats/user/user.controller.ts index 4e82639e8..22a0c904c 100644 --- a/packages/api/src/ats/user/user.controller.ts +++ b/packages/api/src/ats/user/user.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { UserService } from './services/user.service'; import { UnifiedUserInput, UnifiedUserOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('ats/user') @Controller('ats/user') @@ -50,7 +52,7 @@ export class UserController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedUserOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -85,7 +87,7 @@ export class UserController { description: 'Set to true to include data from the original Ats software.', }) @ApiCustomResponse(UnifiedUserOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -93,46 +95,4 @@ export class UserController { ) { return this.userService.getUser(id, remote_data); } - - @ApiOperation({ - operationId: 'create', - summary: 'Create a User', - description: 'Create a user in any supported Ats software', - }) - @ApiHeader({ - name: 'x-connection-token', - required: true, - description: 'The connection token', - example: 'b008e199-eda9-4629-bd41-a01b6195864a', - }) - @ApiQuery({ - name: 'remote_data', - required: false, - type: Boolean, - description: 'Set to true to include data from the original Ats software.', - }) - @ApiBody({ type: UnifiedUserInput }) - @ApiCustomResponse(UnifiedUserOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() - async create( - @Body() unifiedUserData: UnifiedUserInput, - @Headers('x-connection-token') connection_token: string, - @Query('remote_data') remote_data?: boolean, - ) { - try { - const { linkedUserId, remoteSource } = - await this.connectionUtils.getConnectionMetadataFromConnectionToken( - connection_token, - ); - return this.userService.addUser( - unifiedUserData, - remoteSource, - linkedUserId, - remote_data, - ); - } catch (error) { - throw new Error(error); - } - } } diff --git a/packages/api/src/ats/user/user.module.ts b/packages/api/src/ats/user/user.module.ts index 4b4f4cc53..dfcb06e56 100644 --- a/packages/api/src/ats/user/user.module.ts +++ b/packages/api/src/ats/user/user.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/crm/company/company.controller.ts b/packages/api/src/crm/company/company.controller.ts index bb9e0745a..a72d93265 100644 --- a/packages/api/src/crm/company/company.controller.ts +++ b/packages/api/src/crm/company/company.controller.ts @@ -11,7 +11,6 @@ import { UsePipes, ValidationPipe, } from '@nestjs/common'; -import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { LoggerService } from '@@core/logger/logger.service'; import { ApiBody, @@ -29,6 +28,7 @@ import { UnifiedCompanyOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto'; @ApiBearerAuth('JWT') diff --git a/packages/api/src/crm/company/company.module.ts b/packages/api/src/crm/company/company.module.ts index e084e6058..5494963c3 100644 --- a/packages/api/src/crm/company/company.module.ts +++ b/packages/api/src/crm/company/company.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; diff --git a/packages/api/src/crm/contact/contact.controller.ts b/packages/api/src/crm/contact/contact.controller.ts index b10bd4f06..d08e2fccb 100644 --- a/packages/api/src/crm/contact/contact.controller.ts +++ b/packages/api/src/crm/contact/contact.controller.ts @@ -26,8 +26,8 @@ import { ApiHeader, ApiBearerAuth, } from '@nestjs/swagger'; -import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { ApiCustomResponse } from '@@core/utils/types'; import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto'; diff --git a/packages/api/src/crm/contact/contact.module.ts b/packages/api/src/crm/contact/contact.module.ts index 6904df9d4..987d75e5c 100644 --- a/packages/api/src/crm/contact/contact.module.ts +++ b/packages/api/src/crm/contact/contact.module.ts @@ -20,6 +20,7 @@ import { UnificationRegistry } from '@@core/utils/registry/unification.registry' import { CoreUnification } from '@@core/utils/services/core.service'; import { Utils } from '@crm/@lib/@utils'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/crm/deal/deal.controller.ts b/packages/api/src/crm/deal/deal.controller.ts index c2c971091..1f2febf93 100644 --- a/packages/api/src/crm/deal/deal.controller.ts +++ b/packages/api/src/crm/deal/deal.controller.ts @@ -11,7 +11,6 @@ import { UsePipes, ValidationPipe, } from '@nestjs/common'; -import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { LoggerService } from '@@core/logger/logger.service'; import { ApiBody, @@ -26,6 +25,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { DealService } from './services/deal.service'; import { UnifiedDealInput, UnifiedDealOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto'; @ApiBearerAuth('JWT') diff --git a/packages/api/src/crm/deal/deal.module.ts b/packages/api/src/crm/deal/deal.module.ts index 940381868..ca74092bf 100644 --- a/packages/api/src/crm/deal/deal.module.ts +++ b/packages/api/src/crm/deal/deal.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; diff --git a/packages/api/src/crm/engagement/engagement.controller.ts b/packages/api/src/crm/engagement/engagement.controller.ts index be0158554..cfe93cfb7 100644 --- a/packages/api/src/crm/engagement/engagement.controller.ts +++ b/packages/api/src/crm/engagement/engagement.controller.ts @@ -12,7 +12,6 @@ import { ValidationPipe, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; -import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { ApiBody, ApiOperation, @@ -29,6 +28,7 @@ import { UnifiedEngagementOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto'; @ApiBearerAuth('JWT') diff --git a/packages/api/src/crm/engagement/engagement.module.ts b/packages/api/src/crm/engagement/engagement.module.ts index bde78069d..b68353d48 100644 --- a/packages/api/src/crm/engagement/engagement.module.ts +++ b/packages/api/src/crm/engagement/engagement.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; diff --git a/packages/api/src/crm/note/note.controller.ts b/packages/api/src/crm/note/note.controller.ts index f9692c628..66e0b7d43 100644 --- a/packages/api/src/crm/note/note.controller.ts +++ b/packages/api/src/crm/note/note.controller.ts @@ -10,7 +10,6 @@ import { UsePipes, ValidationPipe, } from '@nestjs/common'; -import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { LoggerService } from '@@core/logger/logger.service'; import { ApiBody, @@ -25,6 +24,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { NoteService } from './services/note.service'; import { UnifiedNoteInput, UnifiedNoteOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto'; @ApiBearerAuth('JWT') diff --git a/packages/api/src/crm/note/note.module.ts b/packages/api/src/crm/note/note.module.ts index f4a6f3a2a..1ad218156 100644 --- a/packages/api/src/crm/note/note.module.ts +++ b/packages/api/src/crm/note/note.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; diff --git a/packages/api/src/crm/stage/stage.controller.ts b/packages/api/src/crm/stage/stage.controller.ts index 932fdcb10..6415ec611 100644 --- a/packages/api/src/crm/stage/stage.controller.ts +++ b/packages/api/src/crm/stage/stage.controller.ts @@ -9,7 +9,6 @@ import { ValidationPipe, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; -import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { ApiOperation, ApiParam, @@ -22,6 +21,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { StageService } from './services/stage.service'; import { UnifiedStageOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto'; @ApiBearerAuth('JWT') diff --git a/packages/api/src/crm/stage/stage.module.ts b/packages/api/src/crm/stage/stage.module.ts index 859b99399..428a38388 100644 --- a/packages/api/src/crm/stage/stage.module.ts +++ b/packages/api/src/crm/stage/stage.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; diff --git a/packages/api/src/crm/task/task.module.ts b/packages/api/src/crm/task/task.module.ts index 121c03580..cefd8db34 100644 --- a/packages/api/src/crm/task/task.module.ts +++ b/packages/api/src/crm/task/task.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; diff --git a/packages/api/src/crm/user/user.module.ts b/packages/api/src/crm/user/user.module.ts index ae1104f84..6101d00d7 100644 --- a/packages/api/src/crm/user/user.module.ts +++ b/packages/api/src/crm/user/user.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; diff --git a/packages/api/src/filestorage/drive/drive.controller.ts b/packages/api/src/filestorage/drive/drive.controller.ts index 72a3009c2..417b62032 100644 --- a/packages/api/src/filestorage/drive/drive.controller.ts +++ b/packages/api/src/filestorage/drive/drive.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { DriveService } from './services/drive.service'; import { UnifiedDriveInput, UnifiedDriveOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('filestorage/drive') @Controller('filestorage/drive') @@ -51,7 +53,7 @@ export class DriveController { 'Set to true to include data from the original Filestorage software.', }) @ApiCustomResponse(UnifiedDriveOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -91,7 +93,7 @@ export class DriveController { 'Set to true to include data from the original Filestorage software.', }) @ApiCustomResponse(UnifiedDriveOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -99,47 +101,4 @@ export class DriveController { ) { return this.driveService.getDrive(id, remote_data); } - - @ApiOperation({ - operationId: 'create', - summary: 'Create a Drive', - description: 'Create a drive in any supported Filestorage software', - }) - @ApiHeader({ - name: 'x-connection-token', - required: true, - description: 'The connection token', - example: 'b008e199-eda9-4629-bd41-a01b6195864a', - }) - @ApiQuery({ - name: 'remote_data', - required: false, - type: Boolean, - description: - 'Set to true to include data from the original Filestorage software.', - }) - @ApiBody({ type: UnifiedDriveInput }) - @ApiCustomResponse(UnifiedDriveOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() - async create( - @Body() unifiedDriveData: UnifiedDriveInput, - @Headers('x-connection-token') connection_token: string, - @Query('remote_data') remote_data?: boolean, - ) { - try { - const { linkedUserId, remoteSource } = - await this.connectionUtils.getConnectionMetadataFromConnectionToken( - connection_token, - ); - return this.driveService.addDrive( - unifiedDriveData, - remoteSource, - linkedUserId, - remote_data, - ); - } catch (error) { - throw new Error(error); - } - } } diff --git a/packages/api/src/filestorage/drive/drive.module.ts b/packages/api/src/filestorage/drive/drive.module.ts index 205f558d4..76f30f8ff 100644 --- a/packages/api/src/filestorage/drive/drive.module.ts +++ b/packages/api/src/filestorage/drive/drive.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/filestorage/drive/types/mappingsTypes.ts b/packages/api/src/filestorage/drive/types/mappingsTypes.ts deleted file mode 100644 index 5335c6269..000000000 --- a/packages/api/src/filestorage/drive/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const driveUnificationMapping = {}; diff --git a/packages/api/src/filestorage/drive/types/model.unified.ts b/packages/api/src/filestorage/drive/types/model.unified.ts index e610fb456..fdfd12ec7 100644 --- a/packages/api/src/filestorage/drive/types/model.unified.ts +++ b/packages/api/src/filestorage/drive/types/model.unified.ts @@ -1,3 +1,41 @@ -export class UnifiedDriveInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString } from 'class-validator'; -export class UnifiedDriveOutput extends UnifiedDriveInput {} +export class UnifiedDriveInput { + @ApiProperty({ type: String, description: 'The name of the drive' }) + @IsString() + name: string; + + @ApiProperty({ + type: String, + description: 'When the third party s drive was created.', + }) + @IsString() + remote_created_at: string; + + @ApiProperty({ type: String, description: 'The url of the drive' }) + @IsString() + drive_url: string; +} + +export class UnifiedDriveOutput extends UnifiedDriveInput { + @ApiPropertyOptional({ type: String, description: 'The uuid of the drive' }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The id of the drive in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: 'The remote data of the drive in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/filestorage/file/file.controller.ts b/packages/api/src/filestorage/file/file.controller.ts index 214556c64..1dfbc59d0 100644 --- a/packages/api/src/filestorage/file/file.controller.ts +++ b/packages/api/src/filestorage/file/file.controller.ts @@ -6,6 +6,7 @@ import { Get, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -20,6 +21,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { FileService } from './services/file.service'; import { UnifiedFileInput, UnifiedFileOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('filestorage/file') @Controller('filestorage/file') @@ -50,7 +52,7 @@ export class FileController { 'Set to true to include data from the original Filestorage software.', }) @ApiCustomResponse(UnifiedFileOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -86,7 +88,7 @@ export class FileController { 'Set to true to include data from the original Filestorage software.', }) @ApiCustomResponse(UnifiedFileOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -115,7 +117,7 @@ export class FileController { }) @ApiBody({ type: UnifiedFileInput }) @ApiCustomResponse(UnifiedFileOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedFileData: UnifiedFileInput, diff --git a/packages/api/src/filestorage/file/file.module.ts b/packages/api/src/filestorage/file/file.module.ts index 69340103f..e7b747713 100644 --- a/packages/api/src/filestorage/file/file.module.ts +++ b/packages/api/src/filestorage/file/file.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/filestorage/file/types/mappingsTypes.ts b/packages/api/src/filestorage/file/types/mappingsTypes.ts deleted file mode 100644 index c920dd494..000000000 --- a/packages/api/src/filestorage/file/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const fileUnificationMapping = {}; diff --git a/packages/api/src/filestorage/file/types/model.unified.ts b/packages/api/src/filestorage/file/types/model.unified.ts index 9b53d9b77..13b496a27 100644 --- a/packages/api/src/filestorage/file/types/model.unified.ts +++ b/packages/api/src/filestorage/file/types/model.unified.ts @@ -1,3 +1,60 @@ -export class UnifiedFileInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString } from 'class-validator'; -export class UnifiedFileOutput extends UnifiedFileInput {} +export class UnifiedFileInput { + @ApiProperty({ type: String, description: 'The name of the file' }) + @IsString() + name: string; + + @ApiProperty({ type: String, description: 'The type of the file' }) + @IsString() + type: string; + + @ApiProperty({ type: String, description: 'The url of the file' }) + @IsString() + file_url: string; + + @ApiProperty({ type: String, description: 'The mime type of the file' }) + @IsString() + mime_type: string; + + @ApiProperty({ type: String, description: 'The size of the file' }) + @IsString() + size: string; + + @ApiProperty({ + type: String, + description: 'The uuid of the folder tied to the file', + }) + @IsString() + folder_id: string; + + @ApiProperty({ + type: String, + description: 'The uuid of the permission tied to the file', + }) + @IsString() + permission_id: string; +} + +export class UnifiedFileOutput extends UnifiedFileInput { + @ApiPropertyOptional({ type: String, description: 'The uuid of the file' }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The id of the file in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: 'The remote data of the file in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/filestorage/folder/folder.controller.ts b/packages/api/src/filestorage/folder/folder.controller.ts index 602e507a8..762924d94 100644 --- a/packages/api/src/filestorage/folder/folder.controller.ts +++ b/packages/api/src/filestorage/folder/folder.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { FolderService } from './services/folder.service'; import { UnifiedFolderInput, UnifiedFolderOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('filestorage/folder') @Controller('filestorage/folder') @@ -51,7 +53,7 @@ export class FolderController { 'Set to true to include data from the original Filestorage software.', }) @ApiCustomResponse(UnifiedFolderOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -91,7 +93,7 @@ export class FolderController { 'Set to true to include data from the original Filestorage software.', }) @ApiCustomResponse(UnifiedFolderOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class FolderController { }) @ApiBody({ type: UnifiedFolderInput }) @ApiCustomResponse(UnifiedFolderOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedFolderData: UnifiedFolderInput, diff --git a/packages/api/src/filestorage/folder/folder.module.ts b/packages/api/src/filestorage/folder/folder.module.ts index 3618c8ef6..dca77155b 100644 --- a/packages/api/src/filestorage/folder/folder.module.ts +++ b/packages/api/src/filestorage/folder/folder.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/filestorage/folder/types/mappingsTypes.ts b/packages/api/src/filestorage/folder/types/mappingsTypes.ts deleted file mode 100644 index febf08a05..000000000 --- a/packages/api/src/filestorage/folder/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const folderUnificationMapping = {}; diff --git a/packages/api/src/filestorage/folder/types/model.unified.ts b/packages/api/src/filestorage/folder/types/model.unified.ts index 8e9aa9824..34cddb142 100644 --- a/packages/api/src/filestorage/folder/types/model.unified.ts +++ b/packages/api/src/filestorage/folder/types/model.unified.ts @@ -1,3 +1,64 @@ -export class UnifiedFolderInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString } from 'class-validator'; -export class UnifiedFolderOutput extends UnifiedFolderInput {} +export class UnifiedFolderInput { + @ApiProperty({ type: String, description: 'The name of the folder' }) + @IsString() + name: string; + + @ApiProperty({ type: String, description: 'The size of the folder' }) + @IsString() + size: string; + + @ApiProperty({ type: String, description: 'The url of the folder' }) + @IsString() + folder_url: string; + + @ApiProperty({ type: String, description: 'The description of the folder' }) + @IsString() + description: string; + + @ApiProperty({ + type: String, + description: 'The uuid of the drive tied to the folder', + }) + @IsString() + drive_id: string; + + @ApiProperty({ + type: String, + description: 'The uuid of the parent folder', + }) + @IsString() + parent_folder_id: string; + + @ApiProperty({ + type: String, + description: 'The uuid of the permission tied to the folder', + }) + @IsString() + permission_id: string; +} + +export class UnifiedFolderOutput extends UnifiedFolderInput { + @ApiPropertyOptional({ type: String, description: 'The uuid of the folder' }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The id of the folder in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the folder in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/filestorage/group/group.controller.ts b/packages/api/src/filestorage/group/group.controller.ts new file mode 100644 index 000000000..04f3aaef3 --- /dev/null +++ b/packages/api/src/filestorage/group/group.controller.ts @@ -0,0 +1,105 @@ +import { + Controller, + Post, + Body, + Query, + Get, + Patch, + Param, + Headers, + UseGuards, +} from '@nestjs/common'; +import { LoggerService } from '@@core/logger/logger.service'; +import { + ApiBody, + ApiOperation, + ApiParam, + ApiQuery, + ApiTags, + ApiHeader, +} from '@nestjs/swagger'; +import { ApiCustomResponse } from '@@core/utils/types'; +import { GroupService } from './services/group.service'; +import { UnifiedGroupInput, UnifiedGroupOutput } from './types/model.unified'; +import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; + +@ApiTags('filestorage/permission') +@Controller('filestorage/permission') +export class GroupController { + constructor( + private readonly permissionService: GroupService, + private logger: LoggerService, + private connectionUtils: ConnectionUtils, + ) { + this.logger.setContext(GroupController.name); + } + + @ApiOperation({ + operationId: 'list', + summary: 'List a batch of Groups', + }) + @ApiHeader({ + name: 'x-connection-token', + required: true, + description: 'The connection token', + example: 'b008e199-eda9-4629-bd41-a01b6195864a', + }) + @ApiQuery({ + name: 'remote_data', + required: false, + type: Boolean, + description: + 'Set to true to include data from the original Filestorage software.', + }) + @ApiCustomResponse(UnifiedGroupOutput) + @UseGuards(ApiKeyAuthGuard) + @Get() + async list( + @Headers('x-connection-token') connection_token: string, + @Query('remote_data') remote_data?: boolean, + ) { + try { + const { linkedUserId, remoteSource } = + await this.connectionUtils.getConnectionMetadataFromConnectionToken( + connection_token, + ); + return this.permissionService.getGroups( + remoteSource, + linkedUserId, + remote_data, + ); + } catch (error) { + throw new Error(error); + } + } + + @ApiOperation({ + operationId: 'retrieve', + summary: 'Retrieve a Group', + description: + 'Retrieve a permission from any connected Filestorage software', + }) + @ApiParam({ + name: 'id', + required: true, + type: String, + description: 'id of the permission you want to retrieve.', + }) + @ApiQuery({ + name: 'remote_data', + required: false, + type: Boolean, + description: + 'Set to true to include data from the original Filestorage software.', + }) + @ApiCustomResponse(UnifiedGroupOutput) + @UseGuards(ApiKeyAuthGuard) + @Get(':id') + retrieve( + @Param('id') id: string, + @Query('remote_data') remote_data?: boolean, + ) { + return this.permissionService.getGroup(id, remote_data); + } +} diff --git a/packages/api/src/filestorage/group/group.module.ts b/packages/api/src/filestorage/group/group.module.ts new file mode 100644 index 000000000..ffbae861c --- /dev/null +++ b/packages/api/src/filestorage/group/group.module.ts @@ -0,0 +1,36 @@ +import { Module } from '@nestjs/common'; +import { GroupController } from './group.controller'; +import { SyncService } from './sync/sync.service'; +import { LoggerService } from '@@core/logger/logger.service'; +import { GroupService } from './services/group.service'; +import { ServiceRegistry } 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'; +import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; + +@Module({ + imports: [ + BullModule.registerQueue({ + name: 'webhookDelivery', + }), + ], + controllers: [GroupController], + providers: [ + GroupService, + + LoggerService, + SyncService, + WebhookService, + EncryptionService, + FieldMappingService, + ServiceRegistry, + ConnectionUtils, + /* PROVIDERS SERVICES */ + ], + exports: [SyncService], +}) +export class GroupModule {} diff --git a/packages/api/src/filestorage/group/services/group.service.ts b/packages/api/src/filestorage/group/services/group.service.ts new file mode 100644 index 000000000..69dcd60d0 --- /dev/null +++ b/packages/api/src/filestorage/group/services/group.service.ts @@ -0,0 +1,60 @@ +import { Injectable } from '@nestjs/common'; +import { PrismaService } from '@@core/prisma/prisma.service'; +import { LoggerService } from '@@core/logger/logger.service'; +import { v4 as uuidv4 } from 'uuid'; +import { ApiResponse } from '@@core/utils/types'; +import { throwTypedError } from '@@core/utils/errors'; +import { WebhookService } from '@@core/webhook/webhook.service'; +import { UnifiedGroupInput, UnifiedGroupOutput } from '../types/model.unified'; + +import { FieldMappingService } from '@@core/field-mapping/field-mapping.service'; +import { ServiceRegistry } from './registry.service'; +import { OriginalGroupOutput } from '@@core/utils/types/original/original.file-storage'; + +import { IGroupService } from '../types'; + +@Injectable() +export class GroupService { + constructor( + private prisma: PrismaService, + private logger: LoggerService, + private webhook: WebhookService, + private fieldMappingService: FieldMappingService, + private serviceRegistry: ServiceRegistry, + ) { + this.logger.setContext(GroupService.name); + } + + async batchAddGroups( + unifiedGroupData: UnifiedGroupInput[], + integrationId: string, + linkedUserId: string, + remote_data?: boolean, + ): Promise { + return; + } + + async addGroup( + unifiedGroupData: UnifiedGroupInput, + integrationId: string, + linkedUserId: string, + remote_data?: boolean, + ): Promise { + return; + } + + async getGroup( + id_permissioning_permission: string, + remote_data?: boolean, + ): Promise { + return; + } + + async getGroups( + integrationId: string, + linkedUserId: string, + remote_data?: boolean, + ): Promise { + return; + } +} diff --git a/packages/api/src/filestorage/group/services/registry.service.ts b/packages/api/src/filestorage/group/services/registry.service.ts new file mode 100644 index 000000000..942fa23f6 --- /dev/null +++ b/packages/api/src/filestorage/group/services/registry.service.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@nestjs/common'; +import { IGroupService } from '../types'; + +@Injectable() +export class ServiceRegistry { + private serviceMap: Map; + + constructor() { + this.serviceMap = new Map(); + } + + registerService(serviceKey: string, service: IGroupService) { + this.serviceMap.set(serviceKey, service); + } + + getService(integrationId: string): IGroupService { + const service = this.serviceMap.get(integrationId); + if (!service) { + throw new ReferenceError(); + } + return service; + } +} diff --git a/packages/api/src/filestorage/group/sync/sync.service.ts b/packages/api/src/filestorage/group/sync/sync.service.ts new file mode 100644 index 000000000..7c8b8960b --- /dev/null +++ b/packages/api/src/filestorage/group/sync/sync.service.ts @@ -0,0 +1,31 @@ +import { Injectable, OnModuleInit } from '@nestjs/common'; +import { LoggerService } from '@@core/logger/logger.service'; +import { PrismaService } from '@@core/prisma/prisma.service'; +import { Cron } from '@nestjs/schedule'; +import { ApiResponse } from '@@core/utils/types'; +import { v4 as uuidv4 } from 'uuid'; +import { FieldMappingService } from '@@core/field-mapping/field-mapping.service'; +import { ServiceRegistry } from '../services/registry.service'; + +import { WebhookService } from '@@core/webhook/webhook.service'; +import { UnifiedGroupOutput } from '../types/model.unified'; +import { IGroupService } from '../types'; + +@Injectable() +export class SyncService implements OnModuleInit { + constructor( + private prisma: PrismaService, + private logger: LoggerService, + private webhook: WebhookService, + private fieldMappingService: FieldMappingService, + private serviceRegistry: ServiceRegistry, + ) { + this.logger.setContext(SyncService.name); + } + + async onModuleInit() { + // Initialization logic + } + + // Additional methods and logic +} diff --git a/packages/api/src/filestorage/group/types/index.ts b/packages/api/src/filestorage/group/types/index.ts new file mode 100644 index 000000000..633060ae9 --- /dev/null +++ b/packages/api/src/filestorage/group/types/index.ts @@ -0,0 +1,34 @@ +import { DesunifyReturnType } from '@@core/utils/types/desunify.input'; +import { UnifiedGroupInput, UnifiedGroupOutput } from './model.unified'; +import { OriginalGroupOutput } from '@@core/utils/types/original/original.file-storage'; +import { ApiResponse } from '@@core/utils/types'; + +export interface IGroupService { + addGroup( + permissionData: DesunifyReturnType, + linkedUserId: string, + ): Promise>; + + syncGroups( + linkedUserId: string, + custom_properties?: string[], + ): Promise>; +} + +export interface IGroupMapper { + desunify( + source: UnifiedGroupInput, + customFieldMappings?: { + slug: string; + remote_id: string; + }[], + ): DesunifyReturnType; + + unify( + source: OriginalGroupOutput | OriginalGroupOutput[], + customFieldMappings?: { + slug: string; + remote_id: string; + }[], + ): UnifiedGroupOutput | UnifiedGroupOutput[]; +} diff --git a/packages/api/src/filestorage/group/types/model.unified.ts b/packages/api/src/filestorage/group/types/model.unified.ts new file mode 100644 index 000000000..5d6185b1f --- /dev/null +++ b/packages/api/src/filestorage/group/types/model.unified.ts @@ -0,0 +1,45 @@ +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString } from 'class-validator'; + +export class UnifiedGroupInput { + @ApiProperty({ type: String, description: 'The name of the group' }) + @IsString() + name: string; + + @ApiProperty({ type: [String], description: 'Uuids of users of the group' }) + @IsString() + users: string[]; + + @ApiProperty({ + type: Boolean, + description: + 'Indicates whether or not this object has been deleted in the third party platform.', + }) + @IsString() + remote_was_deleted: boolean; +} + +export class UnifiedGroupOutput extends UnifiedGroupInput { + @ApiPropertyOptional({ + type: String, + description: 'The uuid of the group', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The id of the group in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: 'The remote data of the group in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/filestorage/group/utils/index.ts b/packages/api/src/filestorage/group/utils/index.ts new file mode 100644 index 000000000..f849788c1 --- /dev/null +++ b/packages/api/src/filestorage/group/utils/index.ts @@ -0,0 +1 @@ +/* PUT ALL UTILS FUNCTIONS USED IN YOUR OBJECT METHODS HERE */ diff --git a/packages/api/src/filestorage/permission/permission.controller.ts b/packages/api/src/filestorage/permission/permission.controller.ts index 369c67acd..ad1a66052 100644 --- a/packages/api/src/filestorage/permission/permission.controller.ts +++ b/packages/api/src/filestorage/permission/permission.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedPermissionOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('filestorage/permission') @Controller('filestorage/permission') @@ -54,7 +56,7 @@ export class PermissionController { 'Set to true to include data from the original Filestorage software.', }) @ApiCustomResponse(UnifiedPermissionOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -95,7 +97,7 @@ export class PermissionController { 'Set to true to include data from the original Filestorage software.', }) @ApiCustomResponse(UnifiedPermissionOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -124,7 +126,7 @@ export class PermissionController { }) @ApiBody({ type: UnifiedPermissionInput }) @ApiCustomResponse(UnifiedPermissionOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedPermissionData: UnifiedPermissionInput, diff --git a/packages/api/src/filestorage/permission/permission.module.ts b/packages/api/src/filestorage/permission/permission.module.ts index e7d945a32..6282332a4 100644 --- a/packages/api/src/filestorage/permission/permission.module.ts +++ b/packages/api/src/filestorage/permission/permission.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/filestorage/permission/types/mappingsTypes.ts b/packages/api/src/filestorage/permission/types/mappingsTypes.ts deleted file mode 100644 index 6d8e527ae..000000000 --- a/packages/api/src/filestorage/permission/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const permissionUnificationMapping = {}; diff --git a/packages/api/src/filestorage/permission/types/model.unified.ts b/packages/api/src/filestorage/permission/types/model.unified.ts index 8973c62b7..c71987c4e 100644 --- a/packages/api/src/filestorage/permission/types/model.unified.ts +++ b/packages/api/src/filestorage/permission/types/model.unified.ts @@ -1,3 +1,52 @@ -export class UnifiedPermissionInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString } from 'class-validator'; -export class UnifiedPermissionOutput extends UnifiedPermissionInput {} +export class UnifiedPermissionInput { + @ApiProperty({ type: [String], description: 'The roles of the permission' }) + @IsString() + roles: string[]; + + @ApiProperty({ type: String, description: 'The type of the permission' }) + @IsString() + type: string; + + @ApiProperty({ + type: String, + description: 'The uuid of the user tied to the permission', + }) + @IsString() + user_id: string; + + @ApiProperty({ + type: String, + description: 'The uuid of the group tied to the permission', + }) + @IsString() + group_id: string; +} + +export class UnifiedPermissionOutput extends UnifiedPermissionInput { + @ApiPropertyOptional({ + type: String, + description: 'The uuid of the permission', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The id of the permission in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: + 'The remote data of the permission in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/filestorage/sharedlink/sharedlink.module.ts b/packages/api/src/filestorage/sharedlink/sharedlink.module.ts index 3e0e8a85a..d5655cfc5 100644 --- a/packages/api/src/filestorage/sharedlink/sharedlink.module.ts +++ b/packages/api/src/filestorage/sharedlink/sharedlink.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/filestorage/sharedlink/types/mappingsTypes.ts b/packages/api/src/filestorage/sharedlink/types/mappingsTypes.ts deleted file mode 100644 index d4c9e4391..000000000 --- a/packages/api/src/filestorage/sharedlink/types/mappingsTypes.ts +++ /dev/null @@ -1 +0,0 @@ -export const sharedlinkUnificationMapping = {}; diff --git a/packages/api/src/filestorage/sharedlink/types/model.unified.ts b/packages/api/src/filestorage/sharedlink/types/model.unified.ts index 611b00b0f..0097ce8a9 100644 --- a/packages/api/src/filestorage/sharedlink/types/model.unified.ts +++ b/packages/api/src/filestorage/sharedlink/types/model.unified.ts @@ -1,3 +1,53 @@ -export class UnifiedSharedLinkInput {} +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString } from 'class-validator'; +export class UnifiedSharedLinkInput { + @ApiProperty({ type: String, description: 'The url of the shared link' }) + @IsString() + url: string; -export class UnifiedSharedLinkOutput extends UnifiedSharedLinkInput {} + @ApiProperty({ + type: String, + description: 'The download url of the shared link', + }) + @IsString() + download_url: string; + + @ApiProperty({ + type: String, + description: 'The uuid of the folder tied to the shared link', + }) + @IsString() + folder_id: string; + + @ApiProperty({ + type: String, + description: 'The uuid of the file tied to the shared link', + }) + @IsString() + file_id: string; + + @ApiProperty({ type: String, description: 'The scope of the shared link' }) + @IsString() + scope: string; + + @ApiProperty({ + type: Boolean, + description: 'If the shared link is protected by a password or not', + }) + @IsString() + password_protected: boolean; + + @ApiProperty({ type: String, description: 'The password of the shared link' }) + @IsString() + password: string; +} + +export class UnifiedSharedLinkOutput extends UnifiedSharedLinkInput { + @ApiPropertyOptional({ + type: String, + description: 'The uuid of the shared link', + }) + @IsUUID() + @IsOptional() + id?: string; +} diff --git a/packages/api/src/filestorage/user/services/registry.service.ts b/packages/api/src/filestorage/user/services/registry.service.ts new file mode 100644 index 000000000..575939891 --- /dev/null +++ b/packages/api/src/filestorage/user/services/registry.service.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@nestjs/common'; +import { IUserService } from '../types'; + +@Injectable() +export class ServiceRegistry { + private serviceMap: Map; + + constructor() { + this.serviceMap = new Map(); + } + + registerService(serviceKey: string, service: IUserService) { + this.serviceMap.set(serviceKey, service); + } + + getService(integrationId: string): IUserService { + const service = this.serviceMap.get(integrationId); + if (!service) { + throw new ReferenceError(); + } + return service; + } +} diff --git a/packages/api/src/filestorage/user/services/user.service.ts b/packages/api/src/filestorage/user/services/user.service.ts new file mode 100644 index 000000000..3a8321dd3 --- /dev/null +++ b/packages/api/src/filestorage/user/services/user.service.ts @@ -0,0 +1,60 @@ +import { Injectable } from '@nestjs/common'; +import { PrismaService } from '@@core/prisma/prisma.service'; +import { LoggerService } from '@@core/logger/logger.service'; +import { v4 as uuidv4 } from 'uuid'; +import { ApiResponse } from '@@core/utils/types'; +import { throwTypedError } from '@@core/utils/errors'; +import { WebhookService } from '@@core/webhook/webhook.service'; +import { UnifiedUserInput, UnifiedUserOutput } from '../types/model.unified'; + +import { FieldMappingService } from '@@core/field-mapping/field-mapping.service'; +import { ServiceRegistry } from './registry.service'; +import { OriginalUserOutput } from '@@core/utils/types/original/original.file-storage'; + +import { IUserService } from '../types'; + +@Injectable() +export class UserService { + constructor( + private prisma: PrismaService, + private logger: LoggerService, + private webhook: WebhookService, + private fieldMappingService: FieldMappingService, + private serviceRegistry: ServiceRegistry, + ) { + this.logger.setContext(UserService.name); + } + + async batchAddUsers( + unifiedUserData: UnifiedUserInput[], + integrationId: string, + linkedUserId: string, + remote_data?: boolean, + ): Promise { + return; + } + + async addUser( + unifiedUserData: UnifiedUserInput, + integrationId: string, + linkedUserId: string, + remote_data?: boolean, + ): Promise { + return; + } + + async getUser( + id_permissioning_permission: string, + remote_data?: boolean, + ): Promise { + return; + } + + async getUsers( + integrationId: string, + linkedUserId: string, + remote_data?: boolean, + ): Promise { + return; + } +} diff --git a/packages/api/src/filestorage/user/sync/sync.service.ts b/packages/api/src/filestorage/user/sync/sync.service.ts new file mode 100644 index 000000000..fc3919d0d --- /dev/null +++ b/packages/api/src/filestorage/user/sync/sync.service.ts @@ -0,0 +1,31 @@ +import { Injectable, OnModuleInit } from '@nestjs/common'; +import { LoggerService } from '@@core/logger/logger.service'; +import { PrismaService } from '@@core/prisma/prisma.service'; +import { Cron } from '@nestjs/schedule'; +import { ApiResponse } from '@@core/utils/types'; +import { v4 as uuidv4 } from 'uuid'; +import { FieldMappingService } from '@@core/field-mapping/field-mapping.service'; +import { ServiceRegistry } from '../services/registry.service'; + +import { WebhookService } from '@@core/webhook/webhook.service'; +import { UnifiedUserOutput } from '../types/model.unified'; +import { IUserService } from '../types'; + +@Injectable() +export class SyncService implements OnModuleInit { + constructor( + private prisma: PrismaService, + private logger: LoggerService, + private webhook: WebhookService, + private fieldMappingService: FieldMappingService, + private serviceRegistry: ServiceRegistry, + ) { + this.logger.setContext(SyncService.name); + } + + async onModuleInit() { + // Initialization logic + } + + // Additional methods and logic +} diff --git a/packages/api/src/filestorage/user/types/index.ts b/packages/api/src/filestorage/user/types/index.ts new file mode 100644 index 000000000..13776037c --- /dev/null +++ b/packages/api/src/filestorage/user/types/index.ts @@ -0,0 +1,34 @@ +import { DesunifyReturnType } from '@@core/utils/types/desunify.input'; +import { UnifiedUserInput, UnifiedUserOutput } from './model.unified'; +import { OriginalUserOutput } from '@@core/utils/types/original/original.file-storage'; +import { ApiResponse } from '@@core/utils/types'; + +export interface IUserService { + addUser( + permissionData: DesunifyReturnType, + linkedUserId: string, + ): Promise>; + + syncUsers( + linkedUserId: string, + custom_properties?: string[], + ): Promise>; +} + +export interface IUserMapper { + desunify( + source: UnifiedUserInput, + customFieldMappings?: { + slug: string; + remote_id: string; + }[], + ): DesunifyReturnType; + + unify( + source: OriginalUserOutput | OriginalUserOutput[], + customFieldMappings?: { + slug: string; + remote_id: string; + }[], + ): UnifiedUserOutput | UnifiedUserOutput[]; +} diff --git a/packages/api/src/filestorage/user/types/model.unified.ts b/packages/api/src/filestorage/user/types/model.unified.ts new file mode 100644 index 000000000..7210fd8e6 --- /dev/null +++ b/packages/api/src/filestorage/user/types/model.unified.ts @@ -0,0 +1,47 @@ +import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; +import { IsUUID, IsOptional, IsString } from 'class-validator'; + +export class UnifiedUserInput { + @ApiProperty({ type: String, description: 'The name of the user' }) + @IsString() + name: string; + + @ApiProperty({ + type: String, + description: 'The email of the user', + }) + @IsString() + email: string; + + @ApiProperty({ + type: Boolean, + description: 'Whether the user is the one who linked this account.', + }) + @IsString() + is_me: boolean; +} + +export class UnifiedUserOutput extends UnifiedUserInput { + @ApiPropertyOptional({ + type: String, + description: 'The uuid of the user', + }) + @IsUUID() + @IsOptional() + id?: string; + + @ApiPropertyOptional({ + type: String, + description: 'The id of the user in the context of the 3rd Party', + }) + @IsString() + @IsOptional() + remote_id?: string; + + @ApiPropertyOptional({ + type: {}, + description: 'The remote data of the user in the context of the 3rd Party', + }) + @IsOptional() + remote_data?: Record; +} diff --git a/packages/api/src/filestorage/user/user.controller.ts b/packages/api/src/filestorage/user/user.controller.ts new file mode 100644 index 000000000..850e91caa --- /dev/null +++ b/packages/api/src/filestorage/user/user.controller.ts @@ -0,0 +1,105 @@ +import { + Controller, + Post, + Body, + Query, + Get, + Patch, + Param, + Headers, + UseGuards, +} from '@nestjs/common'; +import { LoggerService } from '@@core/logger/logger.service'; +import { + ApiBody, + ApiOperation, + ApiParam, + ApiQuery, + ApiTags, + ApiHeader, +} from '@nestjs/swagger'; +import { ApiCustomResponse } from '@@core/utils/types'; +import { UserService } from './services/user.service'; +import { UnifiedUserInput, UnifiedUserOutput } from './types/model.unified'; +import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; + +@ApiTags('filestorage/permission') +@Controller('filestorage/permission') +export class UserController { + constructor( + private readonly permissionService: UserService, + private logger: LoggerService, + private connectionUtils: ConnectionUtils, + ) { + this.logger.setContext(UserController.name); + } + + @ApiOperation({ + operationId: 'list', + summary: 'List a batch of Users', + }) + @ApiHeader({ + name: 'x-connection-token', + required: true, + description: 'The connection token', + example: 'b008e199-eda9-4629-bd41-a01b6195864a', + }) + @ApiQuery({ + name: 'remote_data', + required: false, + type: Boolean, + description: + 'Set to true to include data from the original Filestorage software.', + }) + @ApiCustomResponse(UnifiedUserOutput) + @UseGuards(ApiKeyAuthGuard) + @Get() + async list( + @Headers('x-connection-token') connection_token: string, + @Query('remote_data') remote_data?: boolean, + ) { + try { + const { linkedUserId, remoteSource } = + await this.connectionUtils.getConnectionMetadataFromConnectionToken( + connection_token, + ); + return this.permissionService.getUsers( + remoteSource, + linkedUserId, + remote_data, + ); + } catch (error) { + throw new Error(error); + } + } + + @ApiOperation({ + operationId: 'retrieve', + summary: 'Retrieve a User', + description: + 'Retrieve a permission from any connected Filestorage software', + }) + @ApiParam({ + name: 'id', + required: true, + type: String, + description: 'id of the permission you want to retrieve.', + }) + @ApiQuery({ + name: 'remote_data', + required: false, + type: Boolean, + description: + 'Set to true to include data from the original Filestorage software.', + }) + @ApiCustomResponse(UnifiedUserOutput) + @UseGuards(ApiKeyAuthGuard) + @Get(':id') + retrieve( + @Param('id') id: string, + @Query('remote_data') remote_data?: boolean, + ) { + return this.permissionService.getUser(id, remote_data); + } +} diff --git a/packages/api/src/filestorage/user/user.module.ts b/packages/api/src/filestorage/user/user.module.ts new file mode 100644 index 000000000..dfcb06e56 --- /dev/null +++ b/packages/api/src/filestorage/user/user.module.ts @@ -0,0 +1,36 @@ +import { Module } from '@nestjs/common'; +import { UserController } from './user.controller'; +import { SyncService } from './sync/sync.service'; +import { LoggerService } from '@@core/logger/logger.service'; +import { UserService } from './services/user.service'; +import { ServiceRegistry } 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'; +import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; + +@Module({ + imports: [ + BullModule.registerQueue({ + name: 'webhookDelivery', + }), + ], + controllers: [UserController], + providers: [ + UserService, + + LoggerService, + SyncService, + WebhookService, + EncryptionService, + FieldMappingService, + ServiceRegistry, + ConnectionUtils, + /* PROVIDERS SERVICES */ + ], + exports: [SyncService], +}) +export class UserModule {} diff --git a/packages/api/src/filestorage/user/utils/index.ts b/packages/api/src/filestorage/user/utils/index.ts new file mode 100644 index 000000000..f849788c1 --- /dev/null +++ b/packages/api/src/filestorage/user/utils/index.ts @@ -0,0 +1 @@ +/* PUT ALL UTILS FUNCTIONS USED IN YOUR OBJECT METHODS HERE */ diff --git a/packages/api/src/hris/bankinfo/bankinfo.controller.ts b/packages/api/src/hris/bankinfo/bankinfo.controller.ts index b4ca6b56f..d2e4800df 100644 --- a/packages/api/src/hris/bankinfo/bankinfo.controller.ts +++ b/packages/api/src/hris/bankinfo/bankinfo.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedBankInfoOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/bankinfo') @Controller('hris/bankinfo') @@ -53,7 +55,7 @@ export class BankinfoController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedBankInfoOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class BankinfoController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedBankInfoOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class BankinfoController { }) @ApiBody({ type: UnifiedBankInfoInput }) @ApiCustomResponse(UnifiedBankInfoOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedBankinfoData: UnifiedBankInfoInput, diff --git a/packages/api/src/hris/bankinfo/bankinfo.module.ts b/packages/api/src/hris/bankinfo/bankinfo.module.ts index b158327fa..6aabc979a 100644 --- a/packages/api/src/hris/bankinfo/bankinfo.module.ts +++ b/packages/api/src/hris/bankinfo/bankinfo.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/benefit/benefit.controller.ts b/packages/api/src/hris/benefit/benefit.controller.ts index c6327e6b5..fb6135a6e 100644 --- a/packages/api/src/hris/benefit/benefit.controller.ts +++ b/packages/api/src/hris/benefit/benefit.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedBenefitOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/benefit') @Controller('hris/benefit') @@ -53,7 +55,7 @@ export class BenefitController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedBenefitOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class BenefitController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedBenefitOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class BenefitController { }) @ApiBody({ type: UnifiedBenefitInput }) @ApiCustomResponse(UnifiedBenefitOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedBenefitData: UnifiedBenefitInput, diff --git a/packages/api/src/hris/benefit/benefit.module.ts b/packages/api/src/hris/benefit/benefit.module.ts index 8dbc1019d..6fe4d644c 100644 --- a/packages/api/src/hris/benefit/benefit.module.ts +++ b/packages/api/src/hris/benefit/benefit.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/company/company.controller.ts b/packages/api/src/hris/company/company.controller.ts index d9237326d..6b912b45d 100644 --- a/packages/api/src/hris/company/company.controller.ts +++ b/packages/api/src/hris/company/company.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -23,6 +24,7 @@ import { UnifiedCompanyOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CompanyService } from './services/company.service'; @ApiTags('hris/company') @@ -53,8 +55,7 @@ export class CompanyController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedCompanyOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -92,8 +93,7 @@ export class CompanyController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedCompanyOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -120,8 +120,7 @@ export class CompanyController { }) @ApiBody({ type: UnifiedCompanyInput }) @ApiCustomResponse(UnifiedCompanyOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedCompanyData: UnifiedCompanyInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/hris/company/company.module.ts b/packages/api/src/hris/company/company.module.ts index 6b201a875..7817c7259 100644 --- a/packages/api/src/hris/company/company.module.ts +++ b/packages/api/src/hris/company/company.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/dependent/dependent.controller.ts b/packages/api/src/hris/dependent/dependent.controller.ts index 0a9081d75..9a74b35da 100644 --- a/packages/api/src/hris/dependent/dependent.controller.ts +++ b/packages/api/src/hris/dependent/dependent.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedDependentOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/dependent') @Controller('hris/dependent') @@ -53,7 +55,7 @@ export class DependentController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedDependentOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class DependentController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedDependentOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class DependentController { }) @ApiBody({ type: UnifiedDependentInput }) @ApiCustomResponse(UnifiedDependentOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedDependentData: UnifiedDependentInput, diff --git a/packages/api/src/hris/dependent/dependent.module.ts b/packages/api/src/hris/dependent/dependent.module.ts index 480daea27..c60620ef4 100644 --- a/packages/api/src/hris/dependent/dependent.module.ts +++ b/packages/api/src/hris/dependent/dependent.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/employee/employee.controller.ts b/packages/api/src/hris/employee/employee.controller.ts index ad87058f0..9bee9f4d9 100644 --- a/packages/api/src/hris/employee/employee.controller.ts +++ b/packages/api/src/hris/employee/employee.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedEmployeeOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/employee') @Controller('hris/employee') @@ -53,7 +55,7 @@ export class EmployeeController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedEmployeeOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class EmployeeController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedEmployeeOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class EmployeeController { }) @ApiBody({ type: UnifiedEmployeeInput }) @ApiCustomResponse(UnifiedEmployeeOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedEmployeeData: UnifiedEmployeeInput, diff --git a/packages/api/src/hris/employee/employee.module.ts b/packages/api/src/hris/employee/employee.module.ts index d55b53045..64d841e9b 100644 --- a/packages/api/src/hris/employee/employee.module.ts +++ b/packages/api/src/hris/employee/employee.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/employeepayrollrun/employeepayrollrun.controller.ts b/packages/api/src/hris/employeepayrollrun/employeepayrollrun.controller.ts index 02a71c660..deffc16ee 100644 --- a/packages/api/src/hris/employeepayrollrun/employeepayrollrun.controller.ts +++ b/packages/api/src/hris/employeepayrollrun/employeepayrollrun.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedEmployeePayrollRunOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/employeepayrollrun') @Controller('hris/employeepayrollrun') @@ -53,7 +55,7 @@ export class EmployeePayrollRunController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedEmployeePayrollRunOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -93,7 +95,7 @@ export class EmployeePayrollRunController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedEmployeePayrollRunOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -124,7 +126,7 @@ export class EmployeePayrollRunController { }) @ApiBody({ type: UnifiedEmployeePayrollRunInput }) @ApiCustomResponse(UnifiedEmployeePayrollRunOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedEmployeePayrollRunData: UnifiedEmployeePayrollRunInput, diff --git a/packages/api/src/hris/employeepayrollrun/employeepayrollrun.module.ts b/packages/api/src/hris/employeepayrollrun/employeepayrollrun.module.ts index bc9fb6678..e2bd1c34d 100644 --- a/packages/api/src/hris/employeepayrollrun/employeepayrollrun.module.ts +++ b/packages/api/src/hris/employeepayrollrun/employeepayrollrun.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/employerbenefit/employerbenefit.controller.ts b/packages/api/src/hris/employerbenefit/employerbenefit.controller.ts index 460164baf..f24c13e6c 100644 --- a/packages/api/src/hris/employerbenefit/employerbenefit.controller.ts +++ b/packages/api/src/hris/employerbenefit/employerbenefit.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedEmployerBenefitOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/employerbenefit') @Controller('hris/employerbenefit') @@ -53,8 +55,7 @@ export class EmployerBenefitController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedEmployerBenefitOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -92,8 +93,7 @@ export class EmployerBenefitController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedEmployerBenefitOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -120,8 +120,7 @@ export class EmployerBenefitController { }) @ApiBody({ type: UnifiedEmployerBenefitInput }) @ApiCustomResponse(UnifiedEmployerBenefitOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedEmployerBenefitData: UnifiedEmployerBenefitInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/hris/employerbenefit/employerbenefit.module.ts b/packages/api/src/hris/employerbenefit/employerbenefit.module.ts index cf2a992fd..979a4e06a 100644 --- a/packages/api/src/hris/employerbenefit/employerbenefit.module.ts +++ b/packages/api/src/hris/employerbenefit/employerbenefit.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/employment/employment.controller.ts b/packages/api/src/hris/employment/employment.controller.ts index eac660b9b..d4f750b2e 100644 --- a/packages/api/src/hris/employment/employment.controller.ts +++ b/packages/api/src/hris/employment/employment.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedEmploymentOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/employment') @Controller('hris/employment') @@ -53,8 +55,7 @@ export class EmploymentController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedEmploymentOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -92,8 +93,7 @@ export class EmploymentController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedEmploymentOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -120,8 +120,7 @@ export class EmploymentController { }) @ApiBody({ type: UnifiedEmploymentInput }) @ApiCustomResponse(UnifiedEmploymentOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedEmploymentData: UnifiedEmploymentInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/hris/employment/employment.module.ts b/packages/api/src/hris/employment/employment.module.ts index b77f2db58..386ba7799 100644 --- a/packages/api/src/hris/employment/employment.module.ts +++ b/packages/api/src/hris/employment/employment.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/group/group.controller.ts b/packages/api/src/hris/group/group.controller.ts index bb4bc2520..8a75285b3 100644 --- a/packages/api/src/hris/group/group.controller.ts +++ b/packages/api/src/hris/group/group.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { GroupService } from './services/group.service'; import { UnifiedGroupInput, UnifiedGroupOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/group') @Controller('hris/group') @@ -50,8 +52,7 @@ export class GroupController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedGroupOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -89,8 +90,7 @@ export class GroupController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedGroupOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -117,8 +117,7 @@ export class GroupController { }) @ApiBody({ type: UnifiedGroupInput }) @ApiCustomResponse(UnifiedGroupOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedGroupData: UnifiedGroupInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/hris/group/group.module.ts b/packages/api/src/hris/group/group.module.ts index d88919a82..ffbae861c 100644 --- a/packages/api/src/hris/group/group.module.ts +++ b/packages/api/src/hris/group/group.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/location/location.controller.ts b/packages/api/src/hris/location/location.controller.ts index 9cdc3cf53..7a9fceb41 100644 --- a/packages/api/src/hris/location/location.controller.ts +++ b/packages/api/src/hris/location/location.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedLocationOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/location') @Controller('hris/location') @@ -53,8 +55,7 @@ export class LocationController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedLocationOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -92,8 +93,7 @@ export class LocationController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedLocationOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -120,8 +120,7 @@ export class LocationController { }) @ApiBody({ type: UnifiedLocationInput }) @ApiCustomResponse(UnifiedLocationOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedLocationData: UnifiedLocationInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/hris/location/location.module.ts b/packages/api/src/hris/location/location.module.ts index 4ad05b2ba..4e61cf3ab 100644 --- a/packages/api/src/hris/location/location.module.ts +++ b/packages/api/src/hris/location/location.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/paygroup/paygroup.controller.ts b/packages/api/src/hris/paygroup/paygroup.controller.ts index 016c6f45c..7655b80f8 100644 --- a/packages/api/src/hris/paygroup/paygroup.controller.ts +++ b/packages/api/src/hris/paygroup/paygroup.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedPayGroupOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/paygroup') @Controller('hris/paygroup') @@ -53,8 +55,7 @@ export class PayGroupController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedPayGroupOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -92,8 +93,7 @@ export class PayGroupController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedPayGroupOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -120,8 +120,7 @@ export class PayGroupController { }) @ApiBody({ type: UnifiedPayGroupInput }) @ApiCustomResponse(UnifiedPayGroupOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedPayGroupData: UnifiedPayGroupInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/hris/paygroup/paygroup.module.ts b/packages/api/src/hris/paygroup/paygroup.module.ts index 7eb0673a9..c3fb9e46a 100644 --- a/packages/api/src/hris/paygroup/paygroup.module.ts +++ b/packages/api/src/hris/paygroup/paygroup.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/payrollrun/payrollrun.controller.ts b/packages/api/src/hris/payrollrun/payrollrun.controller.ts index 220ab292b..9f45d0bd5 100644 --- a/packages/api/src/hris/payrollrun/payrollrun.controller.ts +++ b/packages/api/src/hris/payrollrun/payrollrun.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedPayrollRunOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/payrollrun') @Controller('hris/payrollrun') @@ -53,8 +55,7 @@ export class PayrollRunController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedPayrollRunOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -92,8 +93,7 @@ export class PayrollRunController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedPayrollRunOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -120,8 +120,7 @@ export class PayrollRunController { }) @ApiBody({ type: UnifiedPayrollRunInput }) @ApiCustomResponse(UnifiedPayrollRunOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedPayrollRunData: UnifiedPayrollRunInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/hris/payrollrun/payrollrun.module.ts b/packages/api/src/hris/payrollrun/payrollrun.module.ts index 68569dd79..6592632f5 100644 --- a/packages/api/src/hris/payrollrun/payrollrun.module.ts +++ b/packages/api/src/hris/payrollrun/payrollrun.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/timeoff/timeoff.controller.ts b/packages/api/src/hris/timeoff/timeoff.controller.ts index d5a8286ad..b816dd4d2 100644 --- a/packages/api/src/hris/timeoff/timeoff.controller.ts +++ b/packages/api/src/hris/timeoff/timeoff.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedTimeoffOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/timeoff') @Controller('hris/timeoff') @@ -53,7 +55,7 @@ export class TimeoffController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedTimeoffOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class TimeoffController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedTimeoffOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class TimeoffController { }) @ApiBody({ type: UnifiedTimeoffInput }) @ApiCustomResponse(UnifiedTimeoffOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedTimeoffData: UnifiedTimeoffInput, diff --git a/packages/api/src/hris/timeoff/timeoff.module.ts b/packages/api/src/hris/timeoff/timeoff.module.ts index 74f679d80..c8058add7 100644 --- a/packages/api/src/hris/timeoff/timeoff.module.ts +++ b/packages/api/src/hris/timeoff/timeoff.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/hris/timeoffbalance/timeoffbalance.controller.ts b/packages/api/src/hris/timeoffbalance/timeoffbalance.controller.ts index 55213d57e..2fa982ff1 100644 --- a/packages/api/src/hris/timeoffbalance/timeoffbalance.controller.ts +++ b/packages/api/src/hris/timeoffbalance/timeoffbalance.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedTimeoffBalanceOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('hris/timeoffbalance') @Controller('hris/timeoffbalance') @@ -53,7 +55,7 @@ export class TimeoffBalanceController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedTimeoffBalanceOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @@ -92,7 +94,7 @@ export class TimeoffBalanceController { description: 'Set to true to include data from the original Hris software.', }) @ApiCustomResponse(UnifiedTimeoffBalanceOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @@ -120,7 +122,7 @@ export class TimeoffBalanceController { }) @ApiBody({ type: UnifiedTimeoffBalanceInput }) @ApiCustomResponse(UnifiedTimeoffBalanceOutput) - //@UseGuards(ApiKeyAuthGuard) + @UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedTimeoffBalanceData: UnifiedTimeoffBalanceInput, diff --git a/packages/api/src/hris/timeoffbalance/timeoffbalance.module.ts b/packages/api/src/hris/timeoffbalance/timeoffbalance.module.ts index eda4bbdbd..d67a584e5 100644 --- a/packages/api/src/hris/timeoffbalance/timeoffbalance.module.ts +++ b/packages/api/src/hris/timeoffbalance/timeoffbalance.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/marketingautomation/action/action.controller.ts b/packages/api/src/marketingautomation/action/action.controller.ts index f90701b73..b481b9f5a 100644 --- a/packages/api/src/marketingautomation/action/action.controller.ts +++ b/packages/api/src/marketingautomation/action/action.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { ActionService } from './services/action.service'; import { UnifiedActionInput, UnifiedActionOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('marketingautomation/action') @Controller('marketingautomation/action') @@ -51,8 +53,7 @@ export class ActionController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedActionOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -92,8 +93,7 @@ export class ActionController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedActionOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -122,8 +122,7 @@ export class ActionController { }) @ApiBody({ type: UnifiedActionInput }) @ApiCustomResponse(UnifiedActionOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedActionData: UnifiedActionInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/marketingautomation/action/action.module.ts b/packages/api/src/marketingautomation/action/action.module.ts index e641ae501..a417e5010 100644 --- a/packages/api/src/marketingautomation/action/action.module.ts +++ b/packages/api/src/marketingautomation/action/action.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CoreModule } from '@@core/core.module'; @Module({ diff --git a/packages/api/src/marketingautomation/automation/automation.controller.ts b/packages/api/src/marketingautomation/automation/automation.controller.ts index 29cf8b639..2be3457b1 100644 --- a/packages/api/src/marketingautomation/automation/automation.controller.ts +++ b/packages/api/src/marketingautomation/automation/automation.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedAutomationOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('marketingautomation/automation') @Controller('marketingautomation/automation') @@ -54,8 +56,7 @@ export class AutomationController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedAutomationOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class AutomationController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedAutomationOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -125,8 +125,7 @@ export class AutomationController { }) @ApiBody({ type: UnifiedAutomationInput }) @ApiCustomResponse(UnifiedAutomationOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedAutomationData: UnifiedAutomationInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/marketingautomation/automation/automation.module.ts b/packages/api/src/marketingautomation/automation/automation.module.ts index a7a74d317..90bc1e2e6 100644 --- a/packages/api/src/marketingautomation/automation/automation.module.ts +++ b/packages/api/src/marketingautomation/automation/automation.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CoreModule } from '@@core/core.module'; @Module({ diff --git a/packages/api/src/marketingautomation/campaign/campaign.controller.ts b/packages/api/src/marketingautomation/campaign/campaign.controller.ts index f9ae749c7..1b3d4a462 100644 --- a/packages/api/src/marketingautomation/campaign/campaign.controller.ts +++ b/packages/api/src/marketingautomation/campaign/campaign.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedCampaignOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('marketingautomation/campaign') @Controller('marketingautomation/campaign') @@ -54,8 +56,7 @@ export class CampaignController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedCampaignOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class CampaignController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedCampaignOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -125,8 +125,7 @@ export class CampaignController { }) @ApiBody({ type: UnifiedCampaignInput }) @ApiCustomResponse(UnifiedCampaignOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedCampaignData: UnifiedCampaignInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/marketingautomation/campaign/campaign.module.ts b/packages/api/src/marketingautomation/campaign/campaign.module.ts index 1de7d464b..f6b672bbf 100644 --- a/packages/api/src/marketingautomation/campaign/campaign.module.ts +++ b/packages/api/src/marketingautomation/campaign/campaign.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CoreModule } from '@@core/core.module'; @Module({ diff --git a/packages/api/src/marketingautomation/contact/contact.controller.ts b/packages/api/src/marketingautomation/contact/contact.controller.ts index 1b08f216e..bcc394c61 100644 --- a/packages/api/src/marketingautomation/contact/contact.controller.ts +++ b/packages/api/src/marketingautomation/contact/contact.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedContactOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('marketingautomation/contact') @Controller('marketingautomation/contact') @@ -54,8 +56,7 @@ export class ContactController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedContactOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class ContactController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedContactOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -125,8 +125,7 @@ export class ContactController { }) @ApiBody({ type: UnifiedContactInput }) @ApiCustomResponse(UnifiedContactOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedContactData: UnifiedContactInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/marketingautomation/contact/contact.module.ts b/packages/api/src/marketingautomation/contact/contact.module.ts index a742156e6..17d0dbe83 100644 --- a/packages/api/src/marketingautomation/contact/contact.module.ts +++ b/packages/api/src/marketingautomation/contact/contact.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CoreModule } from '@@core/core.module'; @Module({ diff --git a/packages/api/src/marketingautomation/email/email.controller.ts b/packages/api/src/marketingautomation/email/email.controller.ts index 4ac363032..511288681 100644 --- a/packages/api/src/marketingautomation/email/email.controller.ts +++ b/packages/api/src/marketingautomation/email/email.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { EmailService } from './services/email.service'; import { UnifiedEmailInput, UnifiedEmailOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('marketingautomation/email') @Controller('marketingautomation/email') @@ -51,8 +53,7 @@ export class EmailController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedEmailOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -92,8 +93,7 @@ export class EmailController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedEmailOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -121,8 +121,7 @@ export class EmailController { }) @ApiBody({ type: UnifiedEmailInput }) @ApiCustomResponse(UnifiedEmailOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedEmailData: UnifiedEmailInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/marketingautomation/email/email.module.ts b/packages/api/src/marketingautomation/email/email.module.ts index 005c155e2..6112373ca 100644 --- a/packages/api/src/marketingautomation/email/email.module.ts +++ b/packages/api/src/marketingautomation/email/email.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CoreModule } from '@@core/core.module'; @Module({ diff --git a/packages/api/src/marketingautomation/event/event.controller.ts b/packages/api/src/marketingautomation/event/event.controller.ts index 552cff710..14788d27d 100644 --- a/packages/api/src/marketingautomation/event/event.controller.ts +++ b/packages/api/src/marketingautomation/event/event.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { EventService } from './services/event.service'; import { UnifiedEventInput, UnifiedEventOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('marketingautomation/event') @Controller('marketingautomation/event') @@ -51,8 +53,7 @@ export class EventController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedEventOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -92,8 +93,7 @@ export class EventController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedEventOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -121,8 +121,7 @@ export class EventController { }) @ApiBody({ type: UnifiedEventInput }) @ApiCustomResponse(UnifiedEventOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedEventData: UnifiedEventInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/marketingautomation/event/event.module.ts b/packages/api/src/marketingautomation/event/event.module.ts index f43361636..e082e2d42 100644 --- a/packages/api/src/marketingautomation/event/event.module.ts +++ b/packages/api/src/marketingautomation/event/event.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CoreModule } from '@@core/core.module'; @Module({ diff --git a/packages/api/src/marketingautomation/list/list.controller.ts b/packages/api/src/marketingautomation/list/list.controller.ts index d1e4a97e7..eb9f27f65 100644 --- a/packages/api/src/marketingautomation/list/list.controller.ts +++ b/packages/api/src/marketingautomation/list/list.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { ListService } from './services/list.service'; import { UnifiedListInput, UnifiedListOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('marketingautomation/list') @Controller('marketingautomation/list') @@ -51,8 +53,7 @@ export class ListController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedListOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -88,8 +89,7 @@ export class ListController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedListOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -117,8 +117,7 @@ export class ListController { }) @ApiBody({ type: UnifiedListInput }) @ApiCustomResponse(UnifiedListOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedListData: UnifiedListInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/marketingautomation/list/list.module.ts b/packages/api/src/marketingautomation/list/list.module.ts index 67cc0c9f2..7f472666b 100644 --- a/packages/api/src/marketingautomation/list/list.module.ts +++ b/packages/api/src/marketingautomation/list/list.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CoreModule } from '@@core/core.module'; @Module({ diff --git a/packages/api/src/marketingautomation/message/message.controller.ts b/packages/api/src/marketingautomation/message/message.controller.ts index f3d3d1a16..90407ecbe 100644 --- a/packages/api/src/marketingautomation/message/message.controller.ts +++ b/packages/api/src/marketingautomation/message/message.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedMessageOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('marketingautomation/message') @Controller('marketingautomation/message') @@ -54,8 +56,7 @@ export class MessageController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedMessageOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class MessageController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedMessageOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -125,8 +125,7 @@ export class MessageController { }) @ApiBody({ type: UnifiedMessageInput }) @ApiCustomResponse(UnifiedMessageOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedMessageData: UnifiedMessageInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/marketingautomation/message/message.module.ts b/packages/api/src/marketingautomation/message/message.module.ts index 3b1d8ccb2..bdebab1b8 100644 --- a/packages/api/src/marketingautomation/message/message.module.ts +++ b/packages/api/src/marketingautomation/message/message.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CoreModule } from '@@core/core.module'; @Module({ diff --git a/packages/api/src/marketingautomation/template/template.controller.ts b/packages/api/src/marketingautomation/template/template.controller.ts index e9357f274..b0012951b 100644 --- a/packages/api/src/marketingautomation/template/template.controller.ts +++ b/packages/api/src/marketingautomation/template/template.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -24,6 +25,7 @@ import { UnifiedTemplateOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('marketingautomation/template') @Controller('marketingautomation/template') @@ -54,8 +56,7 @@ export class TemplateController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedTemplateOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -95,8 +96,7 @@ export class TemplateController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedTemplateOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -125,8 +125,7 @@ export class TemplateController { }) @ApiBody({ type: UnifiedTemplateInput }) @ApiCustomResponse(UnifiedTemplateOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedTemplateData: UnifiedTemplateInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/marketingautomation/template/template.module.ts b/packages/api/src/marketingautomation/template/template.module.ts index 1fbf43ffd..b1c8c9eb4 100644 --- a/packages/api/src/marketingautomation/template/template.module.ts +++ b/packages/api/src/marketingautomation/template/template.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CoreModule } from '@@core/core.module'; @Module({ diff --git a/packages/api/src/marketingautomation/user/user.controller.ts b/packages/api/src/marketingautomation/user/user.controller.ts index 53e13727d..482d3b0f8 100644 --- a/packages/api/src/marketingautomation/user/user.controller.ts +++ b/packages/api/src/marketingautomation/user/user.controller.ts @@ -7,6 +7,7 @@ import { Patch, Param, Headers, + UseGuards, } from '@nestjs/common'; import { LoggerService } from '@@core/logger/logger.service'; import { @@ -21,6 +22,7 @@ import { ApiCustomResponse } from '@@core/utils/types'; import { UserService } from './services/user.service'; import { UnifiedUserInput, UnifiedUserOutput } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @ApiTags('marketingautomation/user') @Controller('marketingautomation/user') @@ -51,8 +53,7 @@ export class UserController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedUserOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get() +@UseGuards(ApiKeyAuthGuard) @Get() async list( @Headers('x-connection-token') connection_token: string, @Query('remote_data') remote_data?: boolean, @@ -88,8 +89,7 @@ export class UserController { 'Set to true to include data from the original Marketingautomation software.', }) @ApiCustomResponse(UnifiedUserOutput) - //@UseGuards(ApiKeyAuthGuard) - @Get(':id') +@UseGuards(ApiKeyAuthGuard) @Get(':id') retrieve( @Param('id') id: string, @Query('remote_data') remote_data?: boolean, @@ -117,8 +117,7 @@ export class UserController { }) @ApiBody({ type: UnifiedUserInput }) @ApiCustomResponse(UnifiedUserOutput) - //@UseGuards(ApiKeyAuthGuard) - @Post() +@UseGuards(ApiKeyAuthGuard) @Post() async create( @Body() unifiedUserData: UnifiedUserInput, @Headers('x-connection-token') connection_token: string, diff --git a/packages/api/src/marketingautomation/user/user.module.ts b/packages/api/src/marketingautomation/user/user.module.ts index 3360ad221..1c5439801 100644 --- a/packages/api/src/marketingautomation/user/user.module.ts +++ b/packages/api/src/marketingautomation/user/user.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { CoreModule } from '@@core/core.module'; @Module({ diff --git a/packages/api/src/ticketing/account/account.controller.ts b/packages/api/src/ticketing/account/account.controller.ts index 2cfc75d2b..0d7ccafc5 100644 --- a/packages/api/src/ticketing/account/account.controller.ts +++ b/packages/api/src/ticketing/account/account.controller.ts @@ -20,6 +20,7 @@ import { import { ApiCustomResponse } from '@@core/utils/types'; import { AccountService } from './services/account.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { UnifiedAccountOutput } from './types/model.unified'; import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto'; diff --git a/packages/api/src/ticketing/account/account.module.ts b/packages/api/src/ticketing/account/account.module.ts index 2029d09f5..caa81398d 100644 --- a/packages/api/src/ticketing/account/account.module.ts +++ b/packages/api/src/ticketing/account/account.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { ZendeskService } from './services/zendesk'; import { FrontService } from './services/front'; import { MappersRegistry } from '@@core/utils/registry/mappings.registry'; diff --git a/packages/api/src/ticketing/attachment/attachment.module.ts b/packages/api/src/ticketing/attachment/attachment.module.ts index d003b9230..9c91a1fd1 100644 --- a/packages/api/src/ticketing/attachment/attachment.module.ts +++ b/packages/api/src/ticketing/attachment/attachment.module.ts @@ -9,6 +9,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { MappersRegistry } from '@@core/utils/registry/mappings.registry'; import { UnificationRegistry } from '@@core/utils/registry/unification.registry'; import { CoreUnification } from '@@core/utils/services/core.service'; diff --git a/packages/api/src/ticketing/collection/collection.module.ts b/packages/api/src/ticketing/collection/collection.module.ts index 0249ca79f..8e4d50797 100644 --- a/packages/api/src/ticketing/collection/collection.module.ts +++ b/packages/api/src/ticketing/collection/collection.module.ts @@ -11,6 +11,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { JiraService } from './services/jira'; import { MappersRegistry } from '@@core/utils/registry/mappings.registry'; import { UnificationRegistry } from '@@core/utils/registry/unification.registry'; diff --git a/packages/api/src/ticketing/comment/comment.controller.ts b/packages/api/src/ticketing/comment/comment.controller.ts index 64fcae445..343cdd1b2 100644 --- a/packages/api/src/ticketing/comment/comment.controller.ts +++ b/packages/api/src/ticketing/comment/comment.controller.ts @@ -26,6 +26,7 @@ import { UnifiedCommentOutput, } from './types/model.unified'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { ApiCustomResponse } from '@@core/utils/types'; import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto'; diff --git a/packages/api/src/ticketing/comment/comment.module.ts b/packages/api/src/ticketing/comment/comment.module.ts index 8f45e8fa0..b3caf66f4 100644 --- a/packages/api/src/ticketing/comment/comment.module.ts +++ b/packages/api/src/ticketing/comment/comment.module.ts @@ -19,6 +19,7 @@ import { UnificationRegistry } from '@@core/utils/registry/unification.registry' import { CoreUnification } from '@@core/utils/services/core.service'; import { Utils } from '@ticketing/@lib/@utils'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ticketing/contact/contact.controller.ts b/packages/api/src/ticketing/contact/contact.controller.ts index 8237e8f26..d291cedf0 100644 --- a/packages/api/src/ticketing/contact/contact.controller.ts +++ b/packages/api/src/ticketing/contact/contact.controller.ts @@ -19,6 +19,7 @@ import { } from '@nestjs/swagger'; import { ContactService } from './services/contact.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { UnifiedContactOutput } from './types/model.unified'; import { ApiCustomResponse } from '@@core/utils/types'; import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; diff --git a/packages/api/src/ticketing/contact/contact.module.ts b/packages/api/src/ticketing/contact/contact.module.ts index 52270209d..8cf05c8e3 100644 --- a/packages/api/src/ticketing/contact/contact.module.ts +++ b/packages/api/src/ticketing/contact/contact.module.ts @@ -17,6 +17,7 @@ import { UnificationRegistry } from '@@core/utils/registry/unification.registry' import { CoreUnification } from '@@core/utils/services/core.service'; import { Utils } from '@ticketing/@lib/@utils'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ticketing/tag/tag.controller.ts b/packages/api/src/ticketing/tag/tag.controller.ts index fdedb927c..994e333f5 100644 --- a/packages/api/src/ticketing/tag/tag.controller.ts +++ b/packages/api/src/ticketing/tag/tag.controller.ts @@ -20,6 +20,7 @@ import { import { ApiCustomResponse } from '@@core/utils/types'; import { TagService } from './services/tag.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { UnifiedTagOutput } from './types/model.unified'; import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto'; diff --git a/packages/api/src/ticketing/tag/tag.module.ts b/packages/api/src/ticketing/tag/tag.module.ts index 3f802e59c..9972da375 100644 --- a/packages/api/src/ticketing/tag/tag.module.ts +++ b/packages/api/src/ticketing/tag/tag.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FrontService } from './services/front'; import { ZendeskService } from './services/zendesk'; import { JiraService } from './services/jira'; diff --git a/packages/api/src/ticketing/team/team.controller.ts b/packages/api/src/ticketing/team/team.controller.ts index 064fd9fd7..64021835e 100644 --- a/packages/api/src/ticketing/team/team.controller.ts +++ b/packages/api/src/ticketing/team/team.controller.ts @@ -20,6 +20,7 @@ import { import { ApiCustomResponse } from '@@core/utils/types'; import { TeamService } from './services/team.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { UnifiedTeamOutput } from './types/model.unified'; import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto'; diff --git a/packages/api/src/ticketing/team/team.module.ts b/packages/api/src/ticketing/team/team.module.ts index c93c4e70e..9e95fd465 100644 --- a/packages/api/src/ticketing/team/team.module.ts +++ b/packages/api/src/ticketing/team/team.module.ts @@ -10,6 +10,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FrontService } from './services/front'; import { ZendeskService } from './services/zendesk'; import { JiraService } from './services/jira'; diff --git a/packages/api/src/ticketing/ticket/ticket.module.ts b/packages/api/src/ticketing/ticket/ticket.module.ts index 026d0a576..0bf8f71e3 100644 --- a/packages/api/src/ticketing/ticket/ticket.module.ts +++ b/packages/api/src/ticketing/ticket/ticket.module.ts @@ -21,6 +21,7 @@ import { UnificationRegistry } from '@@core/utils/registry/unification.registry' import { MappersRegistry } from '@@core/utils/registry/mappings.registry'; import { Utils } from '@ticketing/@lib/@utils'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; @Module({ imports: [ diff --git a/packages/api/src/ticketing/user/user.controller.ts b/packages/api/src/ticketing/user/user.controller.ts index 01b582abf..728898e6b 100644 --- a/packages/api/src/ticketing/user/user.controller.ts +++ b/packages/api/src/ticketing/user/user.controller.ts @@ -20,6 +20,7 @@ import { import { ApiCustomResponse } from '@@core/utils/types'; import { UserService } from './services/user.service'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { UnifiedUserOutput } from './types/model.unified'; import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto'; diff --git a/packages/api/src/ticketing/user/user.module.ts b/packages/api/src/ticketing/user/user.module.ts index f32e5e45f..f6670e216 100644 --- a/packages/api/src/ticketing/user/user.module.ts +++ b/packages/api/src/ticketing/user/user.module.ts @@ -11,6 +11,7 @@ import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; import { ConnectionUtils } from '@@core/connections/@utils'; +import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard'; import { ZendeskService } from './services/zendesk'; import { FrontService } from './services/front'; import { JiraService } from './services/jira';