HM-38. Добавлен логгер в бек, ведет записи в базу, добавлена ручка для получения логов

This commit is contained in:
vigdorov
2020-07-18 16:05:20 +03:00
parent 8beb84567a
commit 8c003a15d0
11 changed files with 133 additions and 13 deletions

View File

@ -2,7 +2,7 @@ import {Model, Connection} from 'mongoose';
import {Injectable, NotFoundException, BadGatewayException} from '@nestjs/common';
import {InjectConnection} from '@nestjs/mongoose';
import {Store, StoreRequest, StoreSchema} from './store.schema';
import {DB_TEST_NAME, DB_NAME, COOLECTION_STORE} from 'src/consts';
import {DB_TEST_NAME, DB_NAME, COLLECTION_STORE} from 'src/consts';
const validateModel = async (store: Store) => {
try {
@ -21,9 +21,9 @@ export class StoreService {
storeModel(api: string): Model<Store> {
if (api === DB_TEST_NAME) {
return this.dbTestConnection.model<Store>(COOLECTION_STORE, StoreSchema);
return this.dbTestConnection.model<Store>(COLLECTION_STORE, StoreSchema);
}
return this.dbConnection.model<Store>(COOLECTION_STORE, StoreSchema);
return this.dbConnection.model<Store>(COLLECTION_STORE, StoreSchema);
}
async findAll(api: string): Promise<Store[]> {