-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored to use base abstract class and state bag
- Loading branch information
Showing
15 changed files
with
227 additions
and
165 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ITestResult } from '../models'; | ||
import { CERTIFICATE_DATA } from '../models/Enums'; | ||
|
||
export type CertificatePayloadStateBag = { | ||
type: CERTIFICATE_DATA; | ||
isWelsh: boolean; | ||
testResult: ITestResult; | ||
}; |
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,8 +1,17 @@ | ||
import { ICertificatePayload } from '../models'; | ||
import { ITestResult } from '../models'; | ||
import { CERTIFICATE_DATA } from '../models/Enums'; | ||
import { CertificatePayloadStateBag } from './CertificatePayloadStateBag'; | ||
|
||
export interface ICertificatePayloadCommand { | ||
initialise(type: CERTIFICATE_DATA, isWelsh: boolean): void; | ||
generate(testResult: ITestResult): Promise<ICertificatePayload>; | ||
initialise(state: CertificatePayloadStateBag): void; | ||
generate(): Promise<ICertificatePayload>; | ||
} | ||
|
||
export abstract class BasePayloadCommand implements ICertificatePayloadCommand { | ||
protected state: CertificatePayloadStateBag = {} as CertificatePayloadStateBag; | ||
|
||
initialise(state: CertificatePayloadStateBag) { | ||
this.state = state; | ||
} | ||
|
||
abstract generate(): Promise<ICertificatePayload>; | ||
} |
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.