HM-59. Исправлена ошибка записи данных Клиентских запросов

This commit is contained in:
vigdorov
2020-07-20 20:22:37 +03:00
parent 74b621fe22
commit 62ab44546d
2 changed files with 9 additions and 9 deletions

View File

@ -2,7 +2,7 @@ import * as mongoose from 'mongoose';
import * as lodash from 'lodash'; import * as lodash from 'lodash';
import {Injectable, NestInterceptor, ExecutionContext, CallHandler} from '@nestjs/common'; import {Injectable, NestInterceptor, ExecutionContext, CallHandler} from '@nestjs/common';
import {Observable, of} from 'rxjs'; import {Observable} from 'rxjs';
import {tap, catchError} from 'rxjs/operators'; import {tap, catchError} from 'rxjs/operators';
import {LOG_TYPE} from 'src/consts'; import {LOG_TYPE} from 'src/consts';
@ -13,8 +13,8 @@ const STATUSES = {
const errorSchema = new mongoose.Schema({ const errorSchema = new mongoose.Schema({
type: String, type: String,
request: Object, request: {},
response: Object, response: {},
startTime: String, startTime: String,
endTime: String, endTime: String,
}); });
@ -29,8 +29,8 @@ const saveLog = (
const endTime = new Date().toJSON(); const endTime = new Date().toJSON();
const error = new ErrorModel({ const error = new ErrorModel({
type, type,
request: request, request: request,
response: lodash.isEmpty(response) ? 'Server down, look server-logs' : response, response: lodash.isEmpty(response) ? 'Server down, look server-logs' : response,
startTime, startTime,
endTime, endTime,
}); });

View File

@ -55,11 +55,11 @@ export class ClientLog extends Document {
@Prop({required: true, type: String}) @Prop({required: true, type: String})
type: string; type: string;
@Prop({required: true, type: String}) @Prop({required: true, type: {}})
request: string; request: any;
@Prop({required: true, type: String}) @Prop({required: true, type: {}})
response: string; response: any;
@Prop({required: true, type: String}) @Prop({required: true, type: String})
startTime: string; startTime: string;