Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Stub out Package model #4155

Merged
merged 11 commits into from
Feb 8, 2017
Merged

Conversation

chadwhitacre
Copy link
Contributor

Just as the elsewhere table represents user accounts on other platforms, the packages table represents projects (Teams) that exist on open source package managers, starting with npm (#4153). In this PR we want to add the database and Python to be able to set up payments to packages. If the package is unclaimed then the payment instruction should be a pledge, not actually run during payday.

@aandis
Copy link
Contributor

aandis commented Oct 22, 2016

@whit537 linked teams to packages on the basis that Team has_one package and Package belongs_to a Team.

@aandis
Copy link
Contributor

aandis commented Oct 22, 2016

payments to packages.

would then be just adding payment_instruction for that team.

@aandis
Copy link
Contributor

aandis commented Oct 22, 2016

ca00824 is really untested. needs a good hard review. :)

@chadwhitacre
Copy link
Contributor Author

Taking a look ...

from postgres.orm import Model

class Package(Model):
"""Represent a gratipackage. :-)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

gratipackage

😀

sql/branch.sql Outdated
, long_description_raw text NOT NULL DEFAULT ''
, long_description_type text NOT NULL DEFAULT ''
, team text REFERENCES teams
ON UPDATE CASCADE ON DELETE RESTRICT
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's use team_id linking to id rather than slug, so we don't make even more work for ourselves under #835.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@aandis aandis mentioned this pull request Oct 22, 2016
@chadwhitacre
Copy link
Contributor Author

@aandis Maybe dust this one off next?

@aandis
Copy link
Contributor

aandis commented Dec 4, 2016

I am thinking to scratch off all this boilerplate code for Package model because all upserts are done via the cli anyway. All we need is to link Team to Package and package_id inside teams does that.

@aandis
Copy link
Contributor

aandis commented Dec 4, 2016

package_id inside teams does that.

unless.. Team can have multiple packages?

@aandis
Copy link
Contributor

aandis commented Dec 4, 2016

unless.. Team can have multiple packages?

I think it's possible. Okay so let's just clean this up.

@aandis aandis force-pushed the projects-elsewhere branch from 64c256b to 804671e Compare December 4, 2016 16:41
@aandis
Copy link
Contributor

aandis commented Dec 4, 2016

Deleted c50be1e and rebased on master. Previous head was 64c256b

@aandis aandis force-pushed the projects-elsewhere branch 2 times, most recently from 6a259a5 to 2b5b1cc Compare December 4, 2016 17:42
@aandis
Copy link
Contributor

aandis commented Dec 4, 2016

Doubt if 2b5b1cc is needed, as we can handle it from the ui too. Apart from that what else is needed as part of this ticket @whit537? Is this good to go?

@chadwhitacre
Copy link
Contributor Author

Rebased on master, was 2b5b1cc.

@chadwhitacre
Copy link
Contributor Author

Rebased, was 48229ce.

@chadwhitacre chadwhitacre changed the base branch from master to project/claim-packages January 24, 2017 22:04
@chadwhitacre chadwhitacre force-pushed the project/claim-packages branch from 37cc930 to d06e5f2 Compare January 24, 2017 22:39
@chadwhitacre
Copy link
Contributor Author

chadwhitacre commented Feb 7, 2017

Okay, I trimmed this up and am ready to see it merged.

@nobodxbodon @mattbk @JessaWitzel @aandis?

"""Return an existing package based on package manager and package names.
"""
return cls.db.one("SELECT packages.*::packages FROM packages "
"WHERE package_manager=%s and name=%s", (package_manager, name))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there plan to create table for package manager and reference its id in packages table?

Before making that change, shall we make 'npm' a constant shared across the app to avoid issue with raw string? Like using "Npm" by mistake, etc.

Or maybe, we use API from_name(cls, name) before adding support for other package managers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there plan to create table for package manager and reference its id in packages table?

Not before May. We won't look at expanding beyond npm until later this year or possibly next.

Before making that change, shall we make 'npm' a constant shared across the app to avoid issue with raw string? Like using "Npm" by mistake, etc.

Like 9c05276?

Copy link
Contributor

Choose a reason for hiding this comment

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

Like 9c05276?

Yes. Not sure how helpful it would be though.

@chadwhitacre
Copy link
Contributor Author

Anything else here, @nobodxbodon?

@JessaWitzel
Copy link
Contributor

I can review late this afternoon.

@nobodxbodon
Copy link
Contributor

@whit537 the rest LGTM. Thanks.

@chadwhitacre chadwhitacre changed the title Link packages to teams Stub out Package model Feb 8, 2017
@chadwhitacre
Copy link
Contributor Author

@JessaWitzel Cool, yours to merge if/when you're ready! :-)

@JessaWitzel JessaWitzel merged commit c9338cf into project/claim-packages Feb 8, 2017
@mattbk
Copy link
Contributor

mattbk commented Feb 9, 2017

@JessaWitzel you can delete the branch now ;)

@JessaWitzel JessaWitzel deleted the projects-elsewhere branch February 9, 2017 19:58
chadwhitacre added a commit that referenced this pull request Feb 20, 2017
chadwhitacre added a commit that referenced this pull request Feb 20, 2017
chadwhitacre added a commit that referenced this pull request Mar 3, 2017
chadwhitacre added a commit that referenced this pull request Mar 17, 2017
chadwhitacre added a commit that referenced this pull request Mar 25, 2017
chadwhitacre added a commit that referenced this pull request Apr 3, 2017
chadwhitacre added a commit that referenced this pull request Apr 24, 2017
chadwhitacre added a commit that referenced this pull request Apr 28, 2017
chadwhitacre added a commit that referenced this pull request Apr 28, 2017
chadwhitacre added a commit that referenced this pull request May 5, 2017
chadwhitacre added a commit that referenced this pull request May 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants