-
-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cafe6e8
commit 89862b2
Showing
19 changed files
with
202 additions
and
88 deletions.
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
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,18 @@ | ||
import { IFilterResult } from './IFilterResult'; | ||
import { IScript } from '@/domain/Script'; | ||
import { ICategory } from '@/domain/ICategory'; | ||
|
||
export class FilterResult implements IFilterResult { | ||
constructor( | ||
public readonly scriptMatches: ReadonlyArray<IScript>, | ||
public readonly categoryMatches: ReadonlyArray<ICategory>, | ||
public readonly query: string) { | ||
if (!query) { throw new Error('Query is empty or undefined'); } | ||
if (!scriptMatches) { throw new Error('Script matches is undefined'); } | ||
if (!categoryMatches) { throw new Error('Category matches is undefined'); } | ||
} | ||
public hasAnyMatches(): boolean { | ||
return this.scriptMatches.length > 0 | ||
|| this.categoryMatches.length > 0; | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
...pplication/State/Filter/IFilterMatches.ts → ...application/State/Filter/IFilterResult.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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { IScript, ICategory } from '@/domain/ICategory'; | ||
|
||
export interface IFilterMatches { | ||
readonly scriptMatches: ReadonlyArray<IScript>; | ||
export interface IFilterResult { | ||
readonly categoryMatches: ReadonlyArray<ICategory>; | ||
readonly scriptMatches: ReadonlyArray<IScript>; | ||
readonly query: string; | ||
hasAnyMatches(): boolean; | ||
} |
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
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
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
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
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
Oops, something went wrong.