Skip to content

Commit

Permalink
chore: prepare to implement Item editors (#63)
Browse files Browse the repository at this point in the history
* chore: prepare to implement Item editors

* add types

* services
  • Loading branch information
FrancescoBorzi authored and Helias committed Aug 18, 2019
1 parent 4c347a4 commit f70385b
Show file tree
Hide file tree
Showing 22 changed files with 398 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { MainWindowModule } from './components/main-window/main-window.module';
import { ComingSoonModule } from './components/editors/coming-soon/coming-soon.module';
import { QuestModule } from './components/editors/quest/quest.module';
import { GameobjectModule } from './components/editors/gameobject/gameobject.module';
import { ItemModule } from './components/editors/item/item.module';


@NgModule({
Expand All @@ -27,7 +28,8 @@ import { GameobjectModule } from './components/editors/gameobject/gameobject.mod
/* Editors */
CreatureModule,
QuestModule,
GameobjectModule
GameobjectModule,
ItemModule,
],
bootstrap: [ AppComponent ]
})
Expand Down
11 changes: 11 additions & 0 deletions src/app/components/editors/item/item.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NgModule } from '@angular/core';

const modules = [

];

@NgModule({
imports: [modules],
exports: [modules],
})
export class ItemModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { instance } from 'ts-mockito';

import { DisenchantLootTemplateService } from './disenchant-loot-template.service';
import { QueryService } from '../../query.service';
import { MockedQueryService } from '../../../test-utils/mocks';

describe('DisenchantLootTemplateService', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [
RouterTestingModule,
],
providers: [
{ provide: QueryService, useValue: instance(MockedQueryService) },
],
}));

it('should be created', () => {
const service: DisenchantLootTemplateService = TestBed.get(DisenchantLootTemplateService);
expect(service).toBeTruthy();
});
});
32 changes: 32 additions & 0 deletions src/app/services/editors/item/disenchant-loot-template.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Injectable } from '@angular/core';

import { ItemHandlerService } from '../../handlers/item-handler.service';
import { QueryService } from '../../query.service';
import {
DISENCHANT_LOOT_TEMPLATE_TABLE,
DisenchantLootTemplate,
} from '../../../types/disenchant-loot-template.type';
import { LootEditorService } from '../loot-editor.service';
import { DISENCHANT_TEMPLATE_LOOT_ID, ITEM_TEMPLATE_ID, ITEM_TEMPLATE_TABLE } from '../../../types/item-template.type';

@Injectable({
providedIn: 'root'
})
export class DisenchantLootTemplateService extends LootEditorService<DisenchantLootTemplate> {

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
protected handlerService: ItemHandlerService,
protected queryService: QueryService,
) {
super(
DisenchantLootTemplate,
DISENCHANT_LOOT_TEMPLATE_TABLE,
ITEM_TEMPLATE_TABLE,
ITEM_TEMPLATE_ID,
DISENCHANT_TEMPLATE_LOOT_ID,
handlerService,
queryService,
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { instance } from 'ts-mockito';

import { QueryService } from '../../query.service';
import { MockedQueryService } from '../../../test-utils/mocks';
import { ItemEnchantmentTemplateService } from './item-enchantment-template.service';

describe('ItemEnchantmentTemplateService', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [
RouterTestingModule,
],
providers: [
{ provide: QueryService, useValue: instance(MockedQueryService) },
],
}));

it('should be created', () => {
const service: ItemEnchantmentTemplateService = TestBed.get(ItemEnchantmentTemplateService);
expect(service).toBeTruthy();
});
});
31 changes: 31 additions & 0 deletions src/app/services/editors/item/item-enchantment-template.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Injectable } from '@angular/core';

import { MultiRowEditorService } from '../multi-row-editor.service';
import { QueryService } from '../../query.service';
import {
ITEM_ENCHANTMENT_TEMPLATE_ID, ITEM_ENCHANTMENT_TEMPLATE_ID_2,
ITEM_ENCHANTMENT_TEMPLATE_TABLE,
ItemEnchantmentTemplate
} from '../../../types/item-enchantment-template.type';
import { ItemHandlerService } from '../../handlers/item-handler.service';

@Injectable({
providedIn: 'root'
})
export class ItemEnchantmentTemplateService extends MultiRowEditorService<ItemEnchantmentTemplate> {

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
protected handlerService: ItemHandlerService,
protected queryService: QueryService,
) {
super(
ItemEnchantmentTemplate,
ITEM_ENCHANTMENT_TEMPLATE_TABLE,
ITEM_ENCHANTMENT_TEMPLATE_ID,
ITEM_ENCHANTMENT_TEMPLATE_ID_2,
handlerService,
queryService,
);
}
}
23 changes: 23 additions & 0 deletions src/app/services/editors/item/item-loot-template.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { instance } from 'ts-mockito';

import { ItemLootTemplateService } from './item-loot-template.service';
import { QueryService } from '../../query.service';
import { MockedQueryService } from '../../../test-utils/mocks';

describe('ItemLootTemplateService', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [
RouterTestingModule,
],
providers: [
{ provide: QueryService, useValue: instance(MockedQueryService) },
],
}));

it('should be created', () => {
const service: ItemLootTemplateService = TestBed.get(ItemLootTemplateService);
expect(service).toBeTruthy();
});
});
28 changes: 28 additions & 0 deletions src/app/services/editors/item/item-loot-template.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Injectable } from '@angular/core';

import { MultiRowEditorService } from '../multi-row-editor.service';
import { QueryService } from '../../query.service';
import { ITEM_LOOT_TEMPLATE_TABLE, ItemLootTemplate } from '../../../types/item-loot-template.type';
import { ItemHandlerService } from '../../handlers/item-handler.service';
import { LOOT_TEMPLATE_ID, LOOT_TEMPLATE_ID_2 } from '../../../components/editors/shared/loot-template/loot-template.type';

@Injectable({
providedIn: 'root'
})
export class ItemLootTemplateService extends MultiRowEditorService<ItemLootTemplate> {

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
protected handlerService: ItemHandlerService,
protected queryService: QueryService,
) {
super(
ItemLootTemplate,
ITEM_LOOT_TEMPLATE_TABLE,
LOOT_TEMPLATE_ID,
LOOT_TEMPLATE_ID_2,
handlerService,
queryService,
);
}
}
23 changes: 23 additions & 0 deletions src/app/services/editors/item/item-template.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { instance } from 'ts-mockito';

import { ItemTemplateService } from './item-template.service';
import { QueryService } from '../../query.service';
import { MockedQueryService } from '../../../test-utils/mocks';

describe('ItemTemplateService', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [
RouterTestingModule,
],
providers: [
{ provide: QueryService, useValue: instance(MockedQueryService) },
],
}));

it('should be created', () => {
const service: ItemTemplateService = TestBed.get(ItemTemplateService);
expect(service).toBeTruthy();
});
});
33 changes: 33 additions & 0 deletions src/app/services/editors/item/item-template.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Injectable } from '@angular/core';

import { SingleRowEditorService } from '../single-row-editor.service';
import {
ITEM_TEMPLATE_ID,
ITEM_TEMPLATE_NAME,
ITEM_TEMPLATE_TABLE,
ItemTemplate
} from '../../../types/item-template.type';
import { QueryService } from '../../query.service';
import { ItemHandlerService } from '../../handlers/item-handler.service';

@Injectable({
providedIn: 'root'
})
export class ItemTemplateService extends SingleRowEditorService<ItemTemplate> {

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
protected handlerService: ItemHandlerService,
protected queryService: QueryService,
) {
super(
ItemTemplate,
ITEM_TEMPLATE_TABLE,
ITEM_TEMPLATE_ID,
ITEM_TEMPLATE_NAME,
true,
handlerService,
queryService,
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { instance } from 'ts-mockito';

import { QueryService } from '../../query.service';
import { MockedQueryService } from '../../../test-utils/mocks';
import { MillingLootTemplateService } from './milling-loot-template.service';

describe('MillingLootTemplateService', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [
RouterTestingModule,
],
providers: [
{ provide: QueryService, useValue: instance(MockedQueryService) },
],
}));

it('should be created', () => {
const service: MillingLootTemplateService = TestBed.get(MillingLootTemplateService);
expect(service).toBeTruthy();
});
});
28 changes: 28 additions & 0 deletions src/app/services/editors/item/milling-loot-template.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Injectable } from '@angular/core';

import { MultiRowEditorService } from '../multi-row-editor.service';
import { QueryService } from '../../query.service';
import { MILLING_LOOT_TEMPLATE_TABLE, MillingLootTemplate } from '../../../types/milling-loot-template.type';
import { ItemHandlerService } from '../../handlers/item-handler.service';
import { LOOT_TEMPLATE_ID, LOOT_TEMPLATE_ID_2 } from '../../../components/editors/shared/loot-template/loot-template.type';

@Injectable({
providedIn: 'root'
})
export class MillingLootTemplateService extends MultiRowEditorService<MillingLootTemplate> {

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
protected handlerService: ItemHandlerService,
protected queryService: QueryService,
) {
super(
MillingLootTemplate,
MILLING_LOOT_TEMPLATE_TABLE,
LOOT_TEMPLATE_ID,
LOOT_TEMPLATE_ID_2,
handlerService,
queryService,
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { instance } from 'ts-mockito';

import { QueryService } from '../../query.service';
import { MockedQueryService } from '../../../test-utils/mocks';
import { ProspectingLootTemplateService } from './prospecting-loot-template.service';

describe('ProspectingLootTemplateService', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [
RouterTestingModule,
],
providers: [
{ provide: QueryService, useValue: instance(MockedQueryService) },
],
}));

it('should be created', () => {
const service: ProspectingLootTemplateService = TestBed.get(ProspectingLootTemplateService);
expect(service).toBeTruthy();
});
});
28 changes: 28 additions & 0 deletions src/app/services/editors/item/prospecting-loot-template.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Injectable } from '@angular/core';

import { MultiRowEditorService } from '../multi-row-editor.service';
import { QueryService } from '../../query.service';
import { PROSPECTING_LOOT_TEMPLATE_TABLE, ProspectingLootTemplate } from '../../../types/prospecting-loot-template.type';
import { ItemHandlerService } from '../../handlers/item-handler.service';
import { LOOT_TEMPLATE_ID, LOOT_TEMPLATE_ID_2 } from '../../../components/editors/shared/loot-template/loot-template.type';

@Injectable({
providedIn: 'root'
})
export class ProspectingLootTemplateService extends MultiRowEditorService<ProspectingLootTemplate> {

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
protected handlerService: ItemHandlerService,
protected queryService: QueryService,
) {
super(
ProspectingLootTemplate,
PROSPECTING_LOOT_TEMPLATE_TABLE,
LOOT_TEMPLATE_ID,
LOOT_TEMPLATE_ID_2,
handlerService,
queryService,
);
}
}
17 changes: 17 additions & 0 deletions src/app/services/handlers/item-handler.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';

import { ItemHandlerService } from './item-handler.service';

describe('ItemHandlerService', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [
RouterTestingModule,
]
}));

it('should be created', () => {
const service: ItemHandlerService = TestBed.get(ItemHandlerService);
expect(service).toBeTruthy();
});
});
20 changes: 20 additions & 0 deletions src/app/services/handlers/item-handler.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';

import { HandlerService } from './handler.service';
import { ItemTemplate } from '../../types/item-template.type';

@Injectable({
providedIn: 'root'
})
export class ItemHandlerService extends HandlerService<ItemTemplate> {
/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
protected router: Router,
) {
super(
'item/item-template',
router,
);
}
}
Loading

0 comments on commit f70385b

Please sign in to comment.