-
-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: prepare to implement Item editors (#63)
* chore: prepare to implement Item editors * add types * services
- Loading branch information
1 parent
4c347a4
commit f70385b
Showing
22 changed files
with
398 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} |
23 changes: 23 additions & 0 deletions
23
src/app/services/editors/item/disenchant-loot-template.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
32
src/app/services/editors/item/disenchant-loot-template.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/services/editors/item/item-enchantment-template.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
31
src/app/services/editors/item/item-enchantment-template.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
23
src/app/services/editors/item/item-loot-template.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
28
src/app/services/editors/item/item-loot-template.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
23
src/app/services/editors/item/item-template.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/services/editors/item/milling-loot-template.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
28
src/app/services/editors/item/milling-loot-template.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/services/editors/item/prospecting-loot-template.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
28
src/app/services/editors/item/prospecting-loot-template.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); | ||
} | ||
} |
Oops, something went wrong.