Skip to content

Commit

Permalink
update when rendering the jsonld
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone committed Nov 22, 2024
1 parent 9e48ff4 commit 953279b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ case class ReadResourcesSequenceV2(
with KnoraReadV2[ReadResourcesSequenceV2]
with UpdateResultInProject { self =>

def updateCopyRightAndLicenseDeep(): ReadResourcesSequenceV2 = {
private def updateCopyRightAndLicenseDeep(): ReadResourcesSequenceV2 = {
val newResources = self.resources.map { resource =>
ReadResourceV2.setCopyrightAndLicenceIfMissing(
self.projectADM.copyrightAttribution,
Expand Down Expand Up @@ -938,11 +938,13 @@ case class ReadResourcesSequenceV2(
appConfig: AppConfig,
schemaOptions: Set[Rendering] = Set.empty,
): JsonLDDocument =
toOntologySchema(targetSchema).generateJsonLD(
targetSchema = targetSchema,
appConfig = appConfig,
schemaOptions = schemaOptions,
)
updateCopyRightAndLicenseDeep()
.toOntologySchema(targetSchema)
.generateJsonLD(
targetSchema = targetSchema,
appConfig = appConfig,
schemaOptions = schemaOptions,
)

/**
* Checks that a [[ReadResourcesSequenceV2]] contains exactly one resource, and returns that resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ final case class ResourcesResponderV2(
}

def createResource(createResource: CreateResourceRequestV2): Task[ReadResourcesSequenceV2] =
createHandler(createResource).map(_.updateCopyRightAndLicenseDeep())
createHandler(createResource)

/**
* If resource has already been modified, make sure that its lastModificationDate is given in the request body.
Expand Down Expand Up @@ -654,7 +654,7 @@ final case class ResourcesResponderV2(
}
}
responseWithDeletedResourcesReplaced = apiResponse.copy(resources = deletedResourcesReplaced)
} yield responseWithDeletedResourcesReplaced.updateCopyRightAndLicenseDeep()
} yield responseWithDeletedResourcesReplaced
}

/**
Expand Down Expand Up @@ -722,7 +722,7 @@ final case class ResourcesResponderV2(
}
}

} yield responseWithDeletedResourcesReplaced.updateCopyRightAndLicenseDeep()
} yield responseWithDeletedResourcesReplaced
}

/**
Expand Down

0 comments on commit 953279b

Please sign in to comment.