Skip to content

Commit

Permalink
fix divisions json in heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
SolidZORO committed Jan 2, 2020
1 parent 881bcae commit 988201f
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions packages/leaa-api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#Accests
/public/attachments
/public/buildinfo.json

/public/assets/divisions/*.json

/src/assets/dicts/*
!/src/assets/dicts/.gitkeep
/src/assets/divisions/*
Expand Down
3 changes: 3 additions & 0 deletions packages/leaa-api/deploy-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ if [[ $KEY = "" ]]; then
cp -fr ./public/robots.txt ${API_DIR}/public
cp -fr ./public/get-weixin-code.html ${API_DIR}/public
cp -fr ./public/buildinfo.json ${API_DIR}/public

mkdir -p ${API_DIR}/public/assets/divisions
cp -fr ./public/assets/divisions/source ${API_DIR}/public/assets/divisions
else
echo "CANCEL"
fi
Expand Down
1 change: 0 additions & 1 deletion packages/leaa-api/src/configs/attachment.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { envConfig } from '@leaa/api/src/modules/config/config.module';
const dev = process.env.NODE_ENV !== 'production';

const SAVE_SUB_DIR = moment().format('YYYY/MM');

const SAVE_DIR_BY_DISK = path.join(`./${envConfig.PUBLIC_DIR}/${envConfig.ATTACHMENT_DIR}/${SAVE_SUB_DIR}`);
const SAVE_DIR_BY_DB = `attachments/${SAVE_SUB_DIR}/`;

Expand Down
3 changes: 2 additions & 1 deletion packages/leaa-api/src/configs/division.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'path';
import { envConfig } from '@leaa/api/src/modules/config/config.module';

const DIVISION_DIR = path.resolve(__dirname, '../assets/divisions');
const DIVISION_DIR = path.resolve(__dirname, `../../${envConfig.PUBLIC_DIR}/assets/divisions`);
const DIVISION_OF_CHINA_FILE_PATH = `${DIVISION_DIR}/division_of_china.json`;

export const divisionConfig = {
Expand Down
3 changes: 1 addition & 2 deletions packages/leaa-api/src/modules/division/division.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fs from 'fs';
import path from 'path';
import mkdirp from 'mkdirp';
import { Injectable } from '@nestjs/common';
import { Repository, FindOneOptions, getConnection } from 'typeorm';
Expand Down Expand Up @@ -139,7 +138,7 @@ export class DivisionService {
/* eslint-disable no-restricted-syntax */
/* eslint-disable no-await-in-loop */

const DIVISION_SOURCE_DIR = path.resolve(__dirname, './source/china');
const DIVISION_SOURCE_DIR = `${divisionConfig.DIVISION_DIR}/source/china`;

// prettier-ignore
// eslint-disable-next-line max-len
Expand Down

0 comments on commit 988201f

Please sign in to comment.