Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Return item curation when updating/publishing #420

Merged
merged 21 commits into from
Mar 9, 2022

Conversation

juanmahidalgo
Copy link
Contributor

Please notice that the PR is created against feat/tp-publish because it includes many of the changes included in that PR.

@@ -282,6 +291,7 @@ export class CollectionRouter extends Router {
return {
collection: toFullCollection(result.collection),
items: result.items,
itemCurations: result.itemCurations,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this here because we need to keep track of the itemCurations in the FE as well, so now it's part of the response.

updated_at: this.getISODate(),
},
{ id: curation.id }
return await curationService.updateStatusAndReturnById(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, we need the updated row, so I created this method to update the status and updated_at fields and return the affected row

@@ -14,7 +14,11 @@ export const patchCurationSchema = Object.freeze({
properties: {
status: {
type: 'string',
enum: [CurationStatus.APPROVED, CurationStatus.REJECTED],
enum: [
CurationStatus.PENDING,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding PENDING so it can be updated to that status.

@coveralls
Copy link

coveralls commented Mar 7, 2022

Pull Request Test Coverage Report for Build 1958254663

  • 4 of 6 (66.67%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 67.631%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Curation/Curation.service.ts 1 3 33.33%
Totals Coverage Status
Change from base Build 1958234219: -0.04%
Covered Lines: 2233
Relevant Lines: 3152

💛 - Coveralls

Base automatically changed from feat/tp-publish to master March 8, 2022 18:44
Copy link
Contributor

@nicosantangelo nicosantangelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment

Comment on lines 249 to 253
): Promise<{
collection: FullCollection
items: FullItem[]
itemCurations?: ItemCurationAttributes[]
}> => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to type this with a type of its own? cause is being used here, on the result definition, and on the service

it could be used in publishDCLCollection too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I added PublishCollectionResponse with a generic for the type of collection to return.
publishCollection returns a FullCollection but this.service.publishTPCollection returns CollectionAttributes for the collections attribute so I had to add a generic to the type to support both (mainly because they are not compatible)

@juanmahidalgo juanmahidalgo merged commit 7917e5b into master Mar 9, 2022
@juanmahidalgo juanmahidalgo deleted the feat/return-item-curations branch March 9, 2022 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants