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

refactor(npm-db): update author field to be more verbose #314

Merged
merged 4 commits into from
Aug 1, 2018

Conversation

pxlpnk
Copy link
Member

@pxlpnk pxlpnk commented Jun 15, 2018

This splits up the author field into 3 fields

  • name
  • website
  • username
"author": {
    "name": "Cal Leeming", // required
    "website": null, // optional, can be null
    "username": null //  optional, can be null
}

The PR comes with a (tools/migrations/transform_author.js) script that changes the existing database.
You can check out the branch and run: node tools/migrations/transform_author.js). Then run npm test afterwards to check the migration.

The migrated files where not yet checked in to keep the PR less noisy. I will supply those changes as soon as the proposed changes are approved. The PR will be failing until those changes are applied.

I updated the files with id 109 and 113 as they had author set to null and replaced it with unknown.

This is the first PR to get #200 moving forward.

author: joi.object().keys(
{
name: joi.string().required(),
username: joi.string().optional().allow(null),
Copy link
Member Author

Choose a reason for hiding this comment

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

Should username and website be required, but allowed to be null?
I kind of think this makes more sense.

Copy link
Member

Choose a reason for hiding this comment

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

It helps consistency through the reports format so that's ok with me.

@pxlpnk pxlpnk requested a review from a team as a code owner June 19, 2018 08:09
@pxlpnk
Copy link
Member Author

pxlpnk commented Jun 19, 2018

Rebased and migrated the files

@@ -17,4 +21,4 @@
"cvss_vector": "CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N",
"cvss_score": 7.3,
"coordinating_vendor": "^Lift Security"
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep the empty line

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 Updated the PR

"cvss_vector": "CVSS:3.0/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N",
"cvss_score": 6.8,
"coordinating_vendor": "^Lift Security"
}
Copy link
Member

Choose a reason for hiding this comment

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

What should we do with this directory?

Copy link
Member Author

Choose a reason for hiding this comment

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

/me fat-fingered here.

@pxlpnk
Copy link
Member Author

pxlpnk commented Jun 20, 2018

I think this one and #316 should be in good shape. WDYTH?

@lirantal
Copy link
Member

@pxlpnk sounds good but let me also prepare a PR to our automatic report creation script at #234 to accommodate for the changes.

I do also want to get feedback about both of these in the main issue before we merge.

@@ -24,7 +24,14 @@ const npmModel = joi.object().keys({
updated_at: joi.string().regex(/^\d{4}-\d{2}-\d{2}$/).required().isoDate(),
title: joi.string().required(),
title: joi.string().max(150).regex(/^[^\n]+$/).required(),
author: joi.string().allow(null).required(),
author: joi.object().required(),
Copy link
Member

Choose a reason for hiding this comment

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

the first author field is redundant, no?
same goes for the title field above

Copy link
Member Author

Choose a reason for hiding this comment

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

You where right, I removed the first author: joi.object().required(). As for the title field. I don't know what the intention with this was. But I can clean this up in a separate PR. I think there might be more in this file that could need a touch up.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, np

@pxlpnk
Copy link
Member Author

pxlpnk commented Jun 27, 2018

I can't really figure out what the problem is here with travis. @vdeturckheim Any idea?

I rebase, fixed some things and created a messy history.

This splits up the author field into 3 fields
- name
- website
- username

```
"author": {
    "name": "Cal Leeming",
    "website": null,
    "username": null
}
```
@pxlpnk pxlpnk merged commit 9eacac1 into nodejs:master Aug 1, 2018
@pxlpnk pxlpnk deleted the fix/npm-db-author branch August 1, 2018 07:28
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

4 participants