fix: 修改刷数据逻辑错误和环境变量问题

This commit is contained in:
luch1994 2024-09-27 19:10:04 +08:00
parent 1125e2ae39
commit ef2126f1ca
3 changed files with 31 additions and 6 deletions

View File

@ -1,3 +1,20 @@
XIAOJU_SURVEY_REPORT=true
XIAOJU_SURVEY_MONGO_DB_NAME=xiaojuSurvey
XIAOJU_SURVEY_MONGO_URL=mongodb://127.0.0.1:27017
XIAOJU_SURVEY_MONGO_AUTH_SOURCE=admin
XIAOJU_SURVEY_REDIS_HOST=
XIAOJU_SURVEY_REDIS_PORT=
XIAOJU_SURVEY_REDIS_USERNAME=
XIAOJU_SURVEY_REDIS_PASSWORD=
XIAOJU_SURVEY_REDIS_DB=
XIAOJU_SURVEY_RESPONSE_AES_ENCRYPT_SECRET_KEY=dataAesEncryptSecretKey
XIAOJU_SURVEY_HTTP_DATA_ENCRYPT_TYPE=rsa
XIAOJU_SURVEY_JWT_SECRET=xiaojuSurveyJwtSecret
XIAOJU_SURVEY_JWT_EXPIRES_IN=8h
XIAOJU_SURVEY_LOGGER_FILENAME=./logs/app.log
XIAOJU_SURVEY_REPORT=true

View File

@ -1,7 +1,7 @@
{
"name": "server",
"version": "0.0.1",
"description": "",
"name": "xiaoju-survey-server",
"version": "1.3.0",
"description": "XIAOJUSURVEY的server端",
"author": "",
"scripts": {
"build": "nest build",

View File

@ -76,7 +76,7 @@ export class UpgradeService {
doc.updatedAt = new Date(doc.updateDate);
delete doc.updateDate;
} else {
doc.createdAt = new Date();
doc.updatedAt = new Date();
}
}
};
@ -143,7 +143,15 @@ export class UpgradeService {
const save = async ({ doc, repository }) => {
const entity = repository.create(doc);
await repository.save(entity);
await repository.updateOne(
{
_id: entity._id,
},
{
$set: entity,
},
);
// this.logger.info(JSON.stringify(updateRes));
};
this.logger.info(`upgrading...`);
for (const repository of repositories) {