Skip to content

Commit

Permalink
🔥 Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Jun 24, 2024
1 parent a82f190 commit cf68179
Show file tree
Hide file tree
Showing 73 changed files with 102 additions and 514 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/liblab_update.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/sdks.yaml

This file was deleted.

14 changes: 1 addition & 13 deletions packages/api/scripts/commonObject.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,12 @@ export class ${ObjectCap}Service {
this.logger.setContext(${ObjectCap}Service.name);
}
async batchAdd${ObjectCap}s(
unified${ObjectCap}Data: Unified${ObjectCap}Input[],
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<Unified${ObjectCap}Output[]> {
return;
}
async add${ObjectCap}(
unified${ObjectCap}Data: Unified${ObjectCap}Input,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
remote_data?: boolean,
): Promise<Unified${ObjectCap}Output> {
return;
}
Expand Down
9 changes: 2 additions & 7 deletions packages/api/src/@core/connections/connections.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { Response } from 'express';
import { CrmConnectionsService } from './crm/services/crm.connection.service';
import { LoggerService } from '@@core/logger/logger.service';
import { ConnectionsError, throwTypedError } from '@@core/utils/errors';
import { ConnectionsError } from '@@core/utils/errors';
import { PrismaService } from '@@core/prisma/prisma.service';
import {
ApiBody,
Expand Down Expand Up @@ -216,8 +216,7 @@ export class ConnectionsController {
});
}
const stateData: StateDataType = JSON.parse(decodeURIComponent(state));
const { projectId, vertical, linkedUserId, providerName, returnUrl } =
stateData;
const { projectId, vertical, linkedUserId, providerName } = stateData;
const { apikey, ...body_data } = body;
switch (vertical.toLowerCase()) {
case ConnectorCategory.Crm:
Expand Down Expand Up @@ -305,9 +304,6 @@ export class ConnectionsController {
);
break;
}

res.redirect(returnUrl);

/*if (
CONNECTORS_METADATA[vertical.toLowerCase()][providerName.toLowerCase()]
.active !== false
Expand Down Expand Up @@ -336,7 +332,6 @@ export class ConnectionsController {
async list(@Request() req: any) {
try {
const { id_project } = req.user;
console.log('Req data is:', req.user);
return await this.prisma.connections.findMany({
where: {
id_project: id_project,
Expand Down
1 change: 0 additions & 1 deletion packages/api/src/@core/sync/sync.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ export class CoreSyncService {

// todo: test behaviour
async resync(vertical: string, user_id: string) {
// premium feature
// trigger a resync for the vertical but only for linked_users who belong to user_id account
const tasks = [];
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ export class AccountService {
unifiedAccountData: UnifiedAccountInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedAccountOutput> {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ export class AttachmentService {
unifiedAttachmentData: UnifiedAttachmentInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedAttachmentOutput> {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export class ContactService {
unifiedContactData: UnifiedContactInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedContactOutput> {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export class ExpenseService {
unifiedExpenseData: UnifiedExpenseInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedExpenseOutput> {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export class InvoiceService {
unifiedInvoiceData: UnifiedInvoiceInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedInvoiceOutput> {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export class JournalEntryService {
unifiedJournalEntryData: UnifiedJournalEntryInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedJournalEntryOutput> {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export class PaymentService {
unifiedPaymentData: UnifiedPaymentInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedPaymentOutput> {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export class PurchaseOrderService {
unifiedPurchaseOrderData: UnifiedPurchaseOrderInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedPurchaseOrderOutput> {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/ats/activity/activity.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class ActivityController {
connection_token,
);
const { remote_data, limit, cursor } = query;
return this.activityService.getActivitys(
return this.activityService.getActivities(
remoteSource,
linkedUserId,
limit,
Expand Down
6 changes: 2 additions & 4 deletions packages/api/src/ats/activity/services/activity.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export class ActivityService {
unifiedActivityData: UnifiedActivityInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedActivityOutput> {
try {
const linkedUser = await this.prisma.linked_users.findUnique({
Expand Down Expand Up @@ -250,7 +248,7 @@ export class ActivityService {
body: activity.body,
visibility: activity.visibility,
candidate_id: activity.id_ats_candidate,
remote_created_at: activity.remote_created_at,
remote_created_at: String(activity.remote_created_at),
field_mappings: field_mappings,
remote_id: activity.remote_id,
created_at: activity.created_at,
Expand Down Expand Up @@ -349,7 +347,7 @@ export class ActivityService {
body: activity.body,
visibility: activity.visibility,
candidate_id: activity.id_ats_candidate,
remote_created_at: activity.remote_created_at,
remote_created_at: String(activity.remote_created_at),
field_mappings: field_mappings,
remote_id: activity.remote_id,
created_at: activity.created_at,
Expand Down
10 changes: 4 additions & 6 deletions packages/api/src/ats/application/services/application.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export class ApplicationService {
unifiedApplicationData: UnifiedApplicationInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedApplicationOutput> {
try {
const linkedUser = await this.prisma.linked_users.findUnique({
Expand Down Expand Up @@ -260,8 +258,8 @@ export class ApplicationService {

const unifiedApplication: UnifiedApplicationOutput = {
id: application.id_ats_application,
applied_at: application.applied_at,
rejected_at: application.rejected_at,
applied_at: String(application.applied_at),
rejected_at: String(application.rejected_at),
offers: application.offers,
source: application.source,
credited_to: application.credited_to,
Expand Down Expand Up @@ -364,8 +362,8 @@ export class ApplicationService {

return {
id: application.id_ats_application,
applied_at: application.applied_at,
rejected_at: application.rejected_at,
applied_at: String(application.applied_at),
rejected_at: String(application.rejected_at),
offers: application.offers,
source: application.source,
credited_to: application.credited_to,
Expand Down
10 changes: 4 additions & 6 deletions packages/api/src/ats/attachment/services/attachment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export class AttachmentService {
unifiedAttachmentData: UnifiedAttachmentInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedAttachmentOutput> {
try {
const linkedUser = await this.prisma.linked_users.findUnique({
Expand Down Expand Up @@ -261,8 +259,8 @@ export class AttachmentService {
file_url: attachment.file_url,
file_name: attachment.file_name,
file_type: attachment.file_type,
remote_created_at: attachment.remote_created_at,
remote_modified_at: attachment.remote_modified_at,
remote_created_at: String(attachment.remote_created_at),
remote_modified_at: String(attachment.remote_modified_at),
candidate_id: attachment.id_ats_candidate,
field_mappings: field_mappings,
remote_id: attachment.remote_id,
Expand Down Expand Up @@ -365,8 +363,8 @@ export class AttachmentService {
file_url: attachment.file_url,
file_name: attachment.file_name,
file_type: attachment.file_type,
remote_created_at: attachment.remote_created_at,
remote_modified_at: attachment.remote_modified_at,
remote_created_at: String(attachment.remote_created_at),
remote_modified_at: String(attachment.remote_modified_at),
candidate_id: attachment.id_ats_candidate,
field_mappings: field_mappings,
remote_id: attachment.remote_id,
Expand Down
24 changes: 9 additions & 15 deletions packages/api/src/ats/candidate/services/candidate.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export class CandidateService {
unifiedCandidateData: UnifiedCandidateInput,
integrationId: string,
linkedUserId: string,
limit: number,
remote_data?: boolean,
cursor?: string,
): Promise<UnifiedCandidateOutput> {
try {
const linkedUser = await this.prisma.linked_users.findUnique({
Expand Down Expand Up @@ -299,9 +297,9 @@ export class CandidateService {
last_name: candidate.last_name,
company: candidate.company,
title: candidate.title,
remote_created_at: candidate.remote_created_at,
remote_modified_at: candidate.remote_modified_at,
last_interaction_at: candidate.last_interaction_at,
remote_created_at: String(candidate.remote_created_at),
remote_modified_at: String(candidate.remote_modified_at),
last_interaction_at: String(candidate.last_interaction_at),
is_private: candidate.is_private,
email_reachable: candidate.email_reachable,
locations: candidate.locations,
Expand All @@ -319,9 +317,7 @@ export class CandidateService {
value: phone.value,
type: phone.type,
})),
tags: tags.map((tag) => ({
name: tag.name,
})),
tags: tags.map((tag) => tag.name),
urls: urls.map((url) => ({
value: url.value,
type: url.type,
Expand Down Expand Up @@ -405,7 +401,7 @@ export class CandidateService {
});

const applications = await this.prisma.ats_applications.findMany({
where: { id_ats_candidate: id_ats_candidate },
where: { id_ats_candidate: candidate.id_ats_candidate },
});

const emailAddresses =
Expand Down Expand Up @@ -452,9 +448,9 @@ export class CandidateService {
last_name: candidate.last_name,
company: candidate.company,
title: candidate.title,
remote_created_at: candidate.remote_created_at,
remote_modified_at: candidate.remote_modified_at,
last_interaction_at: candidate.last_interaction_at,
remote_created_at: String(candidate.remote_created_at),
remote_modified_at: String(candidate.remote_modified_at),
last_interaction_at: String(candidate.last_interaction_at),
is_private: candidate.is_private,
email_reachable: candidate.email_reachable,
locations: candidate.locations,
Expand All @@ -472,9 +468,7 @@ export class CandidateService {
value: phone.value,
type: phone.type,
})),
tags: tags.map((tag) => ({
name: tag.name,
})),
tags: tags.map((tag) => tag.name),
urls: urls.map((url) => ({
value: url.value,
type: url.type,
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/ats/eeocs/services/eeocs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class EeocsService {
const unifiedEeocs: UnifiedEeocsOutput = {
id: eeocs.id_ats_eeoc,
candidate_id: eeocs.id_ats_candidate,
submitted_at: eeocs.submitted_at,
submitted_at: String(eeocs.submitted_at),
race: eeocs.race,
gender: eeocs.gender,
veteran_status: eeocs.veteran_status,
Expand Down Expand Up @@ -133,7 +133,7 @@ export class EeocsService {
return {
id: eeocs.id_ats_eeoc,
candidate_id: eeocs.id_ats_candidate,
submitted_at: eeocs.submitted_at,
submitted_at: String(eeocs.submitted_at),
race: eeocs.race,
gender: eeocs.gender,
veteran_status: eeocs.veteran_status,
Expand Down
Loading

0 comments on commit cf68179

Please sign in to comment.