src/app/service/data.service.ts
プロパティ |
メソッド |
|
constructor(router: Router, dbService: DbService, stateService: StateService)
|
||||||||||||
Defined in src/app/service/data.service.ts:16
|
||||||||||||
パラメータ :
|
catch | ||||
catch(error)
|
||||
Defined in src/app/service/data.service.ts:30
|
||||
パラメータ :
戻り値 :
void
|
countDoc | ||||||
countDoc(keys: string[])
|
||||||
デコレータ :
@Catch()
|
||||||
Defined in src/app/service/data.service.ts:36
|
||||||
パラメータ :
戻り値 :
void
|
Async deleteFavorite | ||||
deleteFavorite(doc)
|
||||
デコレータ :
@Catch()
|
||||
Defined in src/app/service/data.service.ts:65
|
||||
パラメータ :
戻り値 :
{}
|
Async getDocs | ||||||
getDocs(query: any)
|
||||||
デコレータ :
@Catch()
|
||||||
Defined in src/app/service/data.service.ts:44
|
||||||
パラメータ :
戻り値 :
{}
|
Async getFavorite |
getFavorite()
|
デコレータ :
@Catch()
|
Defined in src/app/service/data.service.ts:55
|
戻り値 :
{}
|
Async getFavoriteId |
getFavoriteId()
|
デコレータ :
@Catch()
|
Defined in src/app/service/data.service.ts:50
|
戻り値 :
{}
|
Async getPhoto | |||||||||
getPhoto(doc, isRemote: boolean)
|
|||||||||
デコレータ :
@Catch()
|
|||||||||
Defined in src/app/service/data.service.ts:71
|
|||||||||
パラメータ :
戻り値 :
{}
|
Async init |
init()
|
デコレータ :
@Catch()
|
Defined in src/app/service/data.service.ts:26
|
戻り値 :
any
|
Async saveFavorite | ||||||||||||
saveFavorite(doc, blob: null)
|
||||||||||||
デコレータ :
@Catch()
|
||||||||||||
Defined in src/app/service/data.service.ts:60
|
||||||||||||
パラメータ :
戻り値 :
{}
|
COUNT_TABLE |
Type : literal type
|
既定値 : COUNT_TABLE
|
Defined in src/app/service/data.service.ts:16
|
import {Injectable} from '@angular/core';
import {Router} from '@angular/router';
import {DbService} from './db.service';
import {MyEvent, StateService} from './state.service';
import {COUNT_TABLE} from '../app.countTable';
import {MAX_FAVORITE, REMOTEDB_URL} from '../app.config';
import {MatSnackBar, MatSnackBarVerticalPosition} from '@angular/material';
import {HttpClient} from '@angular/common/http';
import {Catch} from '../class/log.class';
// アプリの初期化、終了処理
// 画面共通の処理(イベント)
@Injectable()
export class DataService {
COUNT_TABLE: { [key: string]: number } = COUNT_TABLE;
constructor(
private router: Router,
private dbService: DbService,
private stateService: StateService,
) {
}
@Catch()
async init() {
await this.dbService.start();
}
catch(error) {
this.stateService.openSnackBar('データベース初期化失敗' + error.message, 10000);
}
//検索結果件数(検索画面と結果画面の両方で表示
@Catch()
countDoc(keys: string[]) {
this.stateService.docCount = null;
keys.forEach(key => {
this.stateService.docCount += this.COUNT_TABLE[key];
});
}
@Catch()
async getDocs(query: any) {
return await this.dbService.getDocs(query);
}
@Catch()
async getFavoriteId() {
return await this.dbService.getFavoriteId();
}
@Catch()
async getFavorite() {
return await this.dbService.getFavorite();
}
@Catch()
async saveFavorite(doc, blob = null) {
return this.dbService.saveFavorite(doc, blob);
}
@Catch()
async deleteFavorite(doc) {
return await this.dbService.deleteFavorite(doc);
}
//写真の取得
@Catch()
async getPhoto(doc, isRemote: boolean) {
return await this.dbService.getPhoto(doc._id, true);
}
}