Skip to content

Commit

Permalink
fix(dataproduct): creator is assigned as owner (datahub-project#12127)
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal authored and sleeperdeep committed Dec 17, 2024
1 parent 8d7198b commit 5b0e1d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,8 @@ private void configureMutationResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher("updateQuery", new UpdateQueryResolver(this.queryService))
.dataFetcher("deleteQuery", new DeleteQueryResolver(this.queryService))
.dataFetcher(
"createDataProduct", new CreateDataProductResolver(this.dataProductService))
"createDataProduct",
new CreateDataProductResolver(this.dataProductService, this.entityService))
.dataFetcher(
"updateDataProduct", new UpdateDataProductResolver(this.dataProductService))
.dataFetcher(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
import com.linkedin.datahub.graphql.exception.AuthorizationException;
import com.linkedin.datahub.graphql.generated.CreateDataProductInput;
import com.linkedin.datahub.graphql.generated.DataProduct;
import com.linkedin.datahub.graphql.generated.OwnerEntityType;
import com.linkedin.datahub.graphql.resolvers.mutate.util.OwnerUtils;
import com.linkedin.datahub.graphql.types.dataproduct.mappers.DataProductMapper;
import com.linkedin.entity.EntityResponse;
import com.linkedin.metadata.entity.EntityService;
import com.linkedin.metadata.service.DataProductService;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
Expand All @@ -24,6 +27,7 @@
public class CreateDataProductResolver implements DataFetcher<CompletableFuture<DataProduct>> {

private final DataProductService _dataProductService;
private final EntityService _entityService;

@Override
public CompletableFuture<DataProduct> get(final DataFetchingEnvironment environment)
Expand Down Expand Up @@ -56,6 +60,8 @@ public CompletableFuture<DataProduct> get(final DataFetchingEnvironment environm
context.getOperationContext(),
dataProductUrn,
UrnUtils.getUrn(input.getDomainUrn()));
OwnerUtils.addCreatorAsOwner(
context, dataProductUrn.toString(), OwnerEntityType.CORP_USER, _entityService);
EntityResponse response =
_dataProductService.getDataProductEntityResponse(
context.getOperationContext(), dataProductUrn);
Expand Down

0 comments on commit 5b0e1d5

Please sign in to comment.