Skip to content

[Fix] Import / Export Services #8910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export class ImportComponent extends TranslationBaseComponent implements AfterVi
}
]
});
this.uploader.onAfterAddingFile = (file) => {
file.withCredentials = false;
};
this.uploader.onBuildItemForm = (item, form) => {
form.append('importType', this.importType);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/lib/employee/employee.subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class EmployeeSubscriber extends BaseEntityEventSubscriber<Employee> {
}

// Set a default avatar image if none is provided
entity.user.imageUrl = entity.user.imageUrl ?? getUserDummyImage(entity.user);
entity.user.imageUrl = entity.user?.imageUrl ?? getUserDummyImage(entity.user);

// Updates the employee's status based on the start and end work dates.
this.updateEmployeeStatus(entity, em);
Expand Down
11 changes: 5 additions & 6 deletions packages/core/src/lib/export-import/import/import.controller.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { Controller, HttpStatus, Post, Body, UseGuards } from '@nestjs/common';
import { Controller, HttpStatus, Post, Body, UseGuards, UseInterceptors } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
import { CommandBus } from '@nestjs/cqrs';
import { ImportStatusEnum, ImportTypeEnum, PermissionsEnum, UploadedFile } from '@gauzy/contracts';
import { ImportService } from './import.service';
import { RequestContext } from '../../core/context';
import { UploadedFileStorage } from '../../core/file-storage';
import { FileStorage, UploadedFileStorage } from '../../core/file-storage';
import { PermissionGuard, TenantPermissionGuard } from '../../shared/guards';
import { Permissions } from '../../shared/decorators';
import { ImportHistoryCreateCommand } from '../import-history';
import { FileInterceptor } from '@nestjs/platform-express';
import * as path from 'path';

@ApiTags('Import')
@UseGuards(TenantPermissionGuard, PermissionGuard)
Expand All @@ -16,15 +18,14 @@ import { ImportHistoryCreateCommand } from '../import-history';
export class ImportController {
constructor(private readonly _importService: ImportService, private readonly _commandBus: CommandBus) {}

// TODO: I commented this code for now as it seems running on the server start or maybe even on each request.
// We need to investigate this and fix it.
/**
*
* @param param0
* @param file
* @returns
*/
/*
// /*
@UseInterceptors(
FileInterceptor('file', {
storage: new FileStorage().storage({
Expand All @@ -33,8 +34,6 @@ export class ImportController {
})
})
)
*/

@ApiOperation({ summary: 'Imports templates records.' })
@ApiResponse({
status: HttpStatus.OK,
Expand Down
Loading
Loading