-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Booster] Milestone 5: Family and occupation risk assessment
# Conflicts: # kyc-booster/src/entities/profile.ts # kyc-booster/src/read-models/ProfileReadModel.ts
- Loading branch information
1 parent
26d30f1
commit f963d88
Showing
8 changed files
with
192 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Command } from '@boostercloud/framework-core' | ||
import { Register, UUID } from '@boostercloud/framework-types' | ||
import { ProfileOcupationDataAdded } from '../events/profile-ocupation-data-added' | ||
import { IncomeSource } from '../common/types' | ||
|
||
@Command({ | ||
authorize: 'all', | ||
}) | ||
export class AddProfileOccupationData { | ||
public constructor( | ||
readonly profileId: UUID, | ||
readonly occupation: string, | ||
readonly employer: string, | ||
readonly sourceOfIncome: IncomeSource, | ||
) {} | ||
|
||
public static async handle(command: AddProfileOccupationData , register: Register): Promise<void> { | ||
register.events(new ProfileOcupationDataAdded( | ||
command.profileId, | ||
command.occupation, | ||
command.employer, | ||
command.sourceOfIncome, | ||
)) | ||
} | ||
} |
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,29 @@ | ||
import { Command } from '@boostercloud/framework-core' | ||
import { Register, UUID } from '@boostercloud/framework-types' | ||
import { RelativeCreated } from '../events/relative-created' | ||
|
||
@Command({ | ||
authorize: 'all', | ||
}) | ||
export class CreateRelative { | ||
public constructor( | ||
readonly firstName: string, | ||
readonly lastName: string, | ||
readonly relationship: string, | ||
readonly politicalInfluence: boolean, | ||
readonly profileId: UUID, | ||
) {} | ||
|
||
public static async handle(command: CreateRelative , register: Register): Promise<{ id: UUID }> { | ||
const relativeId = UUID.generate() | ||
register.events(new RelativeCreated( | ||
relativeId, | ||
command.firstName, | ||
command.lastName, | ||
command.relationship, | ||
command.politicalInfluence, | ||
command.profileId, | ||
)) | ||
return { id: relativeId } | ||
} | ||
} |
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,20 @@ | ||
import { Entity, Reduces } from '@boostercloud/framework-core' | ||
import { UUID } from '@boostercloud/framework-types' | ||
import { RelativeCreated } from '../events/relative-created' | ||
|
||
@Entity | ||
export class Relative { | ||
public constructor( | ||
public id: UUID, | ||
readonly firstName: string, | ||
readonly lastName: string, | ||
readonly relationship: string, | ||
readonly politicalInfluence: boolean, | ||
readonly profileId: UUID, | ||
) {} | ||
|
||
@Reduces(RelativeCreated) | ||
public static reduceRelativeCreated(event: RelativeCreated, currentRelative?: Relative): Relative { | ||
return new Relative(event.relativeId, event.firstName, event.lastName, event.relationship, event.politicalInfluence, event.profileId) | ||
} | ||
} |
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 { Event } from '@boostercloud/framework-core' | ||
import { UUID } from '@boostercloud/framework-types' | ||
import { IncomeSource } from '../common/types' | ||
|
||
@Event | ||
export class ProfileOcupationDataAdded { | ||
public constructor( | ||
readonly profileId: UUID, | ||
readonly occupation: string, | ||
readonly employer: string, | ||
readonly sourceOfIncome: IncomeSource, | ||
) {} | ||
|
||
public entityID(): UUID { | ||
return this.profileId | ||
} | ||
} |
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 { Event } from '@boostercloud/framework-core' | ||
import { UUID } from '@boostercloud/framework-types' | ||
|
||
@Event | ||
export class RelativeCreated { | ||
public constructor( | ||
readonly relativeId: UUID, | ||
readonly firstName: string, | ||
readonly lastName: string, | ||
readonly relationship: string, | ||
readonly politicalInfluence: boolean, | ||
readonly profileId: UUID, | ||
) {} | ||
|
||
public entityID(): UUID { | ||
return this.relativeId | ||
} | ||
} |
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