Skip to content

Commit

Permalink
Edit driver license domain props have its own type
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejkang committed Sep 5, 2021
1 parent 8414be8 commit 3283e4b
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions src/verification/domain/DriverLicense.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { AggregateRoot } from '../../shared/core/AggregateRoot';
import { Result } from '../../shared/core/Result';
import { DriverBirthday } from './DriverBirthday';
import { DriverName } from './DriverName';
import { LicenseNumber } from './LicenseNumber';
import { SerialNumber } from './SerialNumber';

interface DriverLicenseProps {
driverName: string;
driverBirthday: string;
licenseNumber: string;
serialNumber: string;
driverName: DriverName;
driverBirthday: DriverBirthday;
licenseNumber: LicenseNumber;
serialNumber: SerialNumber;
verified?: boolean;
}

Expand All @@ -22,31 +26,19 @@ export class DriverLicense extends AggregateRoot<DriverLicenseProps> {
return this.create({ ...props }, 0);
}

get driverName(): string {
get driverName(): DriverName {
return this.props.driverName;
}

get driverBirthday(): string {
get driverBirthday(): DriverBirthday {
return this.props.driverBirthday;
}

get driverBirthdayYear(): string {
return this.driverBirthday.split('-')[0];
}

get driverBirthdayMonth(): string {
return this.driverBirthday.split('-')[1];
}

get driverBirthdayDay(): string {
return this.driverBirthday.split('-')[2];
}

get licenseNumber(): string {
get licenseNumber(): LicenseNumber {
return this.props.licenseNumber;
}

get serialNumber(): string {
get serialNumber(): SerialNumber {
return this.props.serialNumber;
}

Expand Down

0 comments on commit 3283e4b

Please sign in to comment.