Исправлена ошибка загрузки nano и добавлен логгер
This commit is contained in:
parent
442e11c419
commit
d774e6784b
1 changed files with 6 additions and 2 deletions
|
|
@ -1,17 +1,21 @@
|
|||
import { RedmineTypes } from '@app/redmine-types/index';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import nano from 'nano';
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import configuration from '../configs/app';
|
||||
import nano = require('nano');
|
||||
|
||||
const config = configuration();
|
||||
|
||||
@Injectable()
|
||||
export class Issues {
|
||||
private static logger = new Logger(Issues.name);
|
||||
|
||||
static async getDatasource(): Promise<
|
||||
nano.DocumentScope<RedmineTypes.Issue>
|
||||
> {
|
||||
Issues.logger.debug(`Issues datasource url = ${config.couchDbUrl}`);
|
||||
const n = nano(config.couchDbUrl);
|
||||
const dbs = await n.db.list();
|
||||
Issues.logger.debug(`Issues datasource db name = ${config.dbs.issues}`);
|
||||
if (!dbs.includes(config.dbs.issues)) {
|
||||
await n.db.create(config.dbs.issues);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue