Skip to content

Commit

Permalink
Renamed marketingRegion to defaultMarketingRegion
Browse files Browse the repository at this point in the history
  • Loading branch information
willdch committed Jan 4, 2024
1 parent c202bec commit 04d4bdb
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/components/location/dto/create-location.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export abstract class CreateLocation {
readonly defaultFieldRegionId?: ID;

@IdField({ nullable: true })
readonly marketingRegionId?: IdOf<Location>;
readonly defaultMarketingRegionId?: IdOf<Location>;

@Field({ nullable: true })
@Type(() => CreateDefinedFileVersionInput)
Expand Down
2 changes: 1 addition & 1 deletion src/components/location/dto/location.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Location extends Resource {

readonly defaultFieldRegion: Secured<ID | null>;

readonly marketingRegion: Secured<IdOf<Location> | null>;
readonly defaultMarketingRegion: Secured<IdOf<Location> | null>;

readonly mapImage: DefinedFile;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/location/dto/update-location.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export abstract class UpdateLocation {
readonly defaultFieldRegionId?: ID | null;

@IdField({ nullable: true })
readonly marketingRegionId?: IdOf<Location>;
readonly defaultMarketingRegionId?: IdOf<Location>;

@Field({ nullable: true })
@Type(() => CreateDefinedFileVersionInput)
Expand Down
16 changes: 8 additions & 8 deletions src/components/location/location.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class LocationRepository extends DtoRepository(Location) {
createRelationships(Location, 'out', {
fundingAccount: ['FundingAccount', input.fundingAccountId],
defaultFieldRegion: ['FieldRegion', input.defaultFieldRegionId],
marketingRegion: ['Location', input.marketingRegionId],
defaultMarketingRegion: ['Location', input.defaultMarketingRegionId],
}),
)
.return<{ id: ID }>('node.id as id');
Expand All @@ -75,7 +75,7 @@ export class LocationRepository extends DtoRepository(Location) {
id,
fundingAccountId,
defaultFieldRegionId,
marketingRegionId,
defaultMarketingRegionId,
mapImage,
...simpleChanges
} = changes;
Expand All @@ -100,12 +100,12 @@ export class LocationRepository extends DtoRepository(Location) {
);
}

if (marketingRegionId !== undefined) {
if (defaultMarketingRegionId !== undefined) {
await this.updateRelation(
'marketingRegion',
'defaultMarketingRegion',
'Location',
id,
marketingRegionId,
defaultMarketingRegionId,
);
}
}
Expand All @@ -126,14 +126,14 @@ export class LocationRepository extends DtoRepository(Location) {
])
.optionalMatch([
node('node'),
relation('out', '', 'marketingRegion', ACTIVE),
node('marketingRegion', 'Location'),
relation('out', '', 'defaultMarketingRegion', ACTIVE),
node('defaultMarketingRegion', 'Location'),
])
.return<{ dto: UnsecuredDto<Location> }>(
merge('props', {
fundingAccount: 'fundingAccount.id',
defaultFieldRegion: 'defaultFieldRegion.id',
marketingRegion: 'marketingRegion.id',
defaultMarketingRegion: 'defaultMarketingRegion.id',
}).as('dto'),
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/location/location.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ export class LocationResolver {
}

@ResolveField(() => SecuredLocation)
async marketingRegion(
async defaultMarketingRegion(
@Parent() location: Location,
@Loader(LocationLoader) marketingRegions: LoaderOf<LocationLoader>,
@Loader(LocationLoader) defaultMarketingRegions: LoaderOf<LocationLoader>,
): Promise<SecuredLocation> {
return await mapSecuredValue(location.marketingRegion, (id) =>
marketingRegions.load(id),
return await mapSecuredValue(location.defaultMarketingRegion, (id) =>
defaultMarketingRegions.load(id),
);
}

Expand Down
14 changes: 7 additions & 7 deletions test/utility/fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const org = gql`
}
}
}
marketingRegion {
defaultMarketingRegion {
value {
id
name {
Expand Down Expand Up @@ -321,7 +321,7 @@ export const language = gql`
}
}
}
marketingRegion {
defaultMarketingRegion {
value {
id
name {
Expand Down Expand Up @@ -1143,8 +1143,8 @@ export const fundingAccount = gql`
}
`;

export const marketingRegion = gql`
fragment marketingRegion on Location {
export const defaultMarketingRegion = gql`
fragment defaultMarketingRegion on Location {
id
name {
value
Expand Down Expand Up @@ -1185,15 +1185,15 @@ export const location = gql`
...fieldRegion
}
}
marketingRegion {
defaultMarketingRegion {
value {
...marketingRegion
...defaultMarketingRegion
}
}
}
${fundingAccount}
${fieldRegion}
${marketingRegion}
${defaultMarketingRegion}
`;

export const projectChangeRequest = gql`
Expand Down

0 comments on commit 04d4bdb

Please sign in to comment.