Skip to content

Commit

Permalink
Merge pull request #128 from AgainIoT/feature/126
Browse files Browse the repository at this point in the history
Fix : reading default issue file logic changed & nest-cli changed #126
  • Loading branch information
ymw0407 authored Oct 4, 2023
2 parents cec6e97 + 7ce86f8 commit 311f50c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion nest-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"compilerOptions": {
"assets": [
{ "include": "mail/templates/**/*", "outDir": "dist/" },
{ "include": "file/license/licenseTemplate/**", "outDir": "dist/" }
{ "include": "file/license/licenseTemplate/**", "outDir": "dist/" },
{ "include": "file/issue/default/**", "outDir": "dist/" }
],
"watchAssets": true
}
Expand Down
6 changes: 4 additions & 2 deletions src/file/issue/issue.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { InjectModel } from '@nestjs/mongoose';
import { IssueTemplate as IssueSchema } from './schemas/issue.schema';
import mongoose, { Model } from 'mongoose';
import { readdir, readFile } from 'fs/promises';
import { join } from 'path';

type file = { path: string; content: string };

Expand Down Expand Up @@ -42,10 +43,11 @@ export class IssueService {
// get default issue template from default/ & return it!
makeDefaultIssueTemplate = async (): Promise<file[]> => {
const files = [];
const defaultIssuePath = join(__dirname, 'default');

const fileList = await readdir('src/file/issue/default');
const fileList = await readdir(defaultIssuePath);
const filePromises = fileList.map(async (path) => {
const content = await readFile(`src/file/issue/default/${path}`, {
const content = await readFile(join(defaultIssuePath, path), {
encoding: 'utf-8',
});

Expand Down

0 comments on commit 311f50c

Please sign in to comment.