This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): write the file to the bucket
- Loading branch information
Showing
9 changed files
with
31 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
libs/api-implementation/samples/src/lib/api-implementation-samples.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { Module } from '@nestjs/common'; | ||
|
||
import { SamplesController } from './samples.controller' | ||
import { SamplesService } from './services/samples.service'; | ||
|
||
@Module({ | ||
controllers: [SamplesController], | ||
providers: [], | ||
providers: [SamplesService], | ||
exports: [], | ||
}) | ||
export class ApiImplementationSamplesModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
libs/api-implementation/samples/src/lib/services/samples.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { writeFileSync } from 'fs'; | ||
import { AppConfig } from '../../../../../../config'; | ||
@Injectable() | ||
export class SamplesService { | ||
async writeToBucket(file) { | ||
try { | ||
writeFileSync( | ||
AppConfig.PATH_TO_MOUNTED_BUCKET + file.originalname, | ||
file.buffer | ||
); | ||
} catch (error) { | ||
console.error(`Error occured while writing the file to the bucket`); | ||
console.debug(error.stack); | ||
throw error; | ||
} | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
libs/frontend/samples/src/lib/components/dialog/dialog.component.spec.ts
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
libs/frontend/samples/src/lib/containers/upload/upload.component.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
libs/frontend/samples/src/lib/frontend-samples.module.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters