tech: cleanup unused imports

This commit is contained in:
Michal Szczepanski 2023-09-19 21:50:07 +02:00
parent 402b88f760
commit b9ace172a1
11 changed files with 26 additions and 28 deletions

@ -15,7 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { ObjRectangleDto, ObjSizeDto } from '../model/obj/obj-utils.dto';
import { PinDocument } from '../components/pin/model/pin-view.model';
import { fnConsoleLog } from '../fn/fn-console';
import { ScreenshotFormat } from '../environment';

@ -18,7 +18,6 @@ import { ObjDto, ObjTypeDto } from '../../../../../common/model/obj/obj.dto';
import { ApiCallBase } from '../../api-call.base';
import { FetchService } from '@pinmenote/fetch-service';
import { ICommand, ServerErrorDto } from '../../../../../common/model/shared/common.dto';
import { fnConsoleLog } from '../../../../../common/fn/fn-console';
import { ApiErrorCode } from '../../../../../common/model/shared/api.error-code';
export interface ObjAddRequest {

@ -18,7 +18,6 @@ import { ApiCallBase } from '../../api-call.base';
import { BeginTxResponse } from '../api-store.model';
import { FetchService } from '@pinmenote/fetch-service';
import { ICommand } from '../../../../../common/model/shared/common.dto';
import { fnConsoleLog } from '../../../../../common/fn/fn-console';
import { SyncHashType } from '../../../sync/sync.model';
export interface FileDataDto {

@ -15,20 +15,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { ICommand } from '../../../../common/model/shared/common.dto';
import { ObjDateIndex } from '../../../../common/command/obj/index/obj-update-index-add.command';
import { ObjDto } from '../../../../common/model/obj/obj.dto';
import { ObjNoteDto } from '../../../../common/model/obj/obj-note.dto';
import { SyncObjectCommand } from './sync-object.command';
import { SyncProgress } from '../sync.model';
import { SyncObjectStatus } from '../sync.model';
import { fnConsoleLog } from '../../../../common/fn/fn-console';
import { BeginTxResponse } from '../../api/store/api-store.model';
export class SyncNoteCommand implements ICommand<Promise<void>> {
export class SyncNoteCommand implements ICommand<Promise<SyncObjectStatus>> {
constructor(private obj: ObjDto<ObjNoteDto>, private tx: BeginTxResponse) {}
// eslint-disable-next-line @typescript-eslint/require-await
async execute(): Promise<void> {
async execute(): Promise<SyncObjectStatus> {
fnConsoleLog('SyncNoteCommand');
const data = this.obj.data;
await new SyncObjectCommand(this.obj, data.hash, this.tx).execute();
return SyncObjectStatus.SERVER_ERROR;
}
}

@ -21,8 +21,6 @@ import { ApiAddObjCommand, ObjAddResponse } from '../../api/store/obj/api-add-ob
import { BeginTxResponse } from '../../api/store/api-store.model';
import { ApiErrorCode } from '../../../../common/model/shared/api.error-code';
import { ApiObjGetByHashCommand, ObjSingleChange } from '../../api/store/obj/api-obj-get-by-hash.command';
import { BrowserStorage } from '@pinmenote/browser-api';
import { ObjectStoreKeys } from '../../../../common/keys/object.store.keys';
export class SyncObjectCommand implements ICommand<Promise<void>> {
constructor(private obj: ObjDto, private hash: string, private tx: BeginTxResponse) {}

@ -15,19 +15,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { ICommand } from '../../../../common/model/shared/common.dto';
import { ObjDateIndex } from '../../../../common/command/obj/index/obj-update-index-add.command';
import { ObjDto } from '../../../../common/model/obj/obj.dto';
import { ObjPageNoteDto } from '../../../../common/model/obj/obj-note.dto';
import { SyncObjectCommand } from './sync-object.command';
import { SyncProgress } from '../sync.model';
import { SyncObjectStatus } from '../sync.model';
import { fnConsoleLog } from '../../../../common/fn/fn-console';
import { BeginTxResponse } from '../../api/store/api-store.model';
export class SyncPageNoteCommand implements ICommand<Promise<void>> {
export class SyncPageNoteCommand implements ICommand<Promise<SyncObjectStatus>> {
constructor(private obj: ObjDto<ObjPageNoteDto>, private tx: BeginTxResponse) {}
async execute(): Promise<void> {
async execute(): Promise<SyncObjectStatus> {
fnConsoleLog('SyncPageNoteCommand');
const data = this.obj.data;
await new SyncObjectCommand(this.obj, data.hash, this.tx).execute();
return SyncObjectStatus.SERVER_ERROR;
}
}

@ -15,19 +15,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { ICommand } from '../../../../common/model/shared/common.dto';
import { ObjDateIndex } from '../../../../common/command/obj/index/obj-update-index-add.command';
import { ObjDto } from '../../../../common/model/obj/obj.dto';
import { ObjPdfDto } from '../../../../common/model/obj/obj-pdf.dto';
import { SyncObjectCommand } from './sync-object.command';
import { SyncProgress } from '../sync.model';
import { SyncObjectStatus } from '../sync.model';
import { fnConsoleLog } from '../../../../common/fn/fn-console';
import { BeginTxResponse } from '../../api/store/api-store.model';
export class SyncPdfCommand implements ICommand<Promise<void>> {
export class SyncPdfCommand implements ICommand<Promise<SyncObjectStatus>> {
constructor(private obj: ObjDto<ObjPdfDto>, private tx: BeginTxResponse) {}
async execute(): Promise<void> {
async execute(): Promise<SyncObjectStatus> {
fnConsoleLog('SyncPdfCommand');
const data = this.obj.data;
await new SyncObjectCommand(this.obj, data.hash, this.tx).execute();
return SyncObjectStatus.SERVER_ERROR;
}
}

@ -15,19 +15,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { ICommand } from '../../../../common/model/shared/common.dto';
import { ObjDateIndex } from '../../../../common/command/obj/index/obj-update-index-add.command';
import { ObjDto } from '../../../../common/model/obj/obj.dto';
import { ObjPinDto } from '../../../../common/model/obj/obj-pin.dto';
import { SyncObjectCommand } from './sync-object.command';
import { SyncProgress } from '../sync.model';
import { SyncObjectStatus } from '../sync.model';
import { fnConsoleLog } from '../../../../common/fn/fn-console';
import { BeginTxResponse } from '../../api/store/api-store.model';
export class SyncPinCommand implements ICommand<Promise<void>> {
export class SyncPinCommand implements ICommand<Promise<SyncObjectStatus>> {
constructor(private obj: ObjDto<ObjPinDto>, private tx: BeginTxResponse) {}
async execute(): Promise<void> {
async execute(): Promise<SyncObjectStatus> {
fnConsoleLog('SyncPinCommand');
const data = this.obj.data;
await new SyncObjectCommand(this.obj, data.data.hash, this.tx).execute();
return SyncObjectStatus.SERVER_ERROR;
}
}

@ -16,14 +16,15 @@
*/
import { ObjDto, ObjRemovedDto } from '../../../../common/model/obj/obj.dto';
import { ICommand } from '../../../../common/model/shared/common.dto';
import { SyncProgress } from '../sync.model';
import { SyncObjectStatus } from '../sync.model';
import { fnConsoleLog } from '../../../../common/fn/fn-console';
import { BeginTxResponse } from '../../api/store/api-store.model';
export class SyncRemovedCommand implements ICommand<Promise<void>> {
export class SyncRemovedCommand implements ICommand<Promise<SyncObjectStatus>> {
constructor(private obj: ObjDto<ObjRemovedDto>, private tx: BeginTxResponse) {}
// eslint-disable-next-line @typescript-eslint/require-await
async execute(): Promise<void> {
async execute(): Promise<SyncObjectStatus> {
fnConsoleLog('SyncRemovedCommand', this.obj, this.tx);
return SyncObjectStatus.SERVER_ERROR;
}
}

@ -59,19 +59,19 @@ export class SyncIndexCommand implements ICommand<Promise<SyncObjectStatus>> {
break;
}
case ObjTypeDto.PageElementPin: {
await new SyncPinCommand(obj as ObjDto<ObjPinDto>, this.tx).execute();
status = await new SyncPinCommand(obj as ObjDto<ObjPinDto>, this.tx).execute();
break;
}
case ObjTypeDto.Pdf: {
await new SyncPdfCommand(obj as ObjDto<ObjPdfDto>, this.tx).execute();
status = await new SyncPdfCommand(obj as ObjDto<ObjPdfDto>, this.tx).execute();
break;
}
case ObjTypeDto.Note: {
await new SyncNoteCommand(obj as ObjDto<ObjNoteDto>, this.tx).execute();
status = await new SyncNoteCommand(obj as ObjDto<ObjNoteDto>, this.tx).execute();
break;
}
case ObjTypeDto.PageNote: {
await new SyncPageNoteCommand(obj as ObjDto<ObjPageNoteDto>, this.tx).execute();
status = await new SyncPageNoteCommand(obj as ObjDto<ObjPageNoteDto>, this.tx).execute();
break;
}
case ObjTypeDto.Removed: {
@ -83,6 +83,7 @@ export class SyncIndexCommand implements ICommand<Promise<SyncObjectStatus>> {
break;
}
}
if (status < 0) return status;
await new SyncSetProgressCommand({ id: this.index.id, timestamp: this.index.dt, state: 'update' }).execute();
await fnSleep(100);
return status;

@ -64,6 +64,7 @@ export class SyncMonthCommand implements ICommand<Promise<SyncIndex>> {
}
if ([SyncObjectStatus.INDEX_NOT_EXISTS, SyncObjectStatus.OBJECT_NOT_EXISTS].includes(status)) {
fnConsoleLog('syncIndex->PROBLEM !!!!!!!!!!!!!!!!!!!!!!!!', status, 'index', index);
await SyncTxHelper.commit();
throw new Error(`Status ERROR ${status}`);
}
}