Skip to content

Commit

Permalink
chore: Add country primitives type
Browse files Browse the repository at this point in the history
  • Loading branch information
mapeveri committed Apr 21, 2024
1 parent dcb46b8 commit a60cca8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Country from '@src/languages/domain/country/country';
import Country, { CountryPrimitives } from '@src/languages/domain/country/country';
import QueryResponse from '@src/shared/domain/bus/queryBus/queryResponse';

export default class FindCountryResponse extends QueryResponse {
private constructor(country?: object) {
private constructor(country?: CountryPrimitives) {
super(country);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Country from '@src/languages/domain/country/country';
import Country, { CountryPrimitives } from '@src/languages/domain/country/country';
import QueryResponse from '@src/shared/domain/bus/queryBus/queryResponse';

export default class FindCountriesResponse extends QueryResponse {
private constructor(countries?: object) {
private constructor(countries?: CountryPrimitives[]) {
super(countries);
}

Expand Down
10 changes: 9 additions & 1 deletion src/languages/domain/country/country.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import { AggregateRoot } from '@src/shared/domain/aggregate/aggregateRoot';
import CountryId from './countryId';
import LanguageCollection from './languageCollection';
import CountryCreatedEvent from '@src/languages/domain/country/countryCreatedEvent';
import { LanguagePrimitives } from '@src/languages/domain/country/language';

export type CountryPrimitives = {
id: string;
name: string;
iso: string;
languages: LanguagePrimitives[];
};

export default class Country extends AggregateRoot {
id: CountryId;
Expand All @@ -25,7 +33,7 @@ export default class Country extends AggregateRoot {
return country;
}

toPrimitives(): object {
toPrimitives(): CountryPrimitives {
return {
id: this.id.toString(),
name: this.name,
Expand Down

0 comments on commit a60cca8

Please sign in to comment.