GithubHelp home page GithubHelp logo

decred / contractor-mgmt Goto Github PK

View Code? Open in Web Editor NEW
12.0 14.0 9.0 331 KB

Contractor management system written in Go that uses politeiad as a backend

License: ISC License

Go 99.76% Shell 0.24%
golang decred politeia

contractor-mgmt's People

Contributors

alexlyp avatar dajohi avatar degeri avatar orthomind avatar sndurkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contractor-mgmt's Issues

Requirements for initial release

This is a full list of requirements set for the initial release:

Components:

  • CLI to interact with the web server
  • DB util to interact directly with the web server's database
  • Web server which has a user database and stores invoices in Politeiad

Features:

  • General:
    • User accounts
      • Registration by invite code only, received via email
        • Prompt for: username, username (again), password, password (again), first name, last name, location, extended pubkey
      • Login & logout
        • Automatic account locking after too many failed login attempts
      • Manage user account to set/change:
        • Username
        • Password
        • Identity
        • Name
        • Location
        • Extended pubkey for payments
    • Invoices
      • Submitted by contractor users, stored in Politead
      • Viewable only by contractor who submitted them and admin users
      • Require a specific, parseable format with the following information:
        • Month/Year
        • Summary of work
        • Type of work
        • Link to Politeia Proposal
        • Hours spent
        • Cost
      • Ensure that the submitted format contains the Month and Year within a comment
      • 5 states:
        • Unreviewed
        • Rejected
        • UnreviewedChanges
        • Approved
        • Paid
    • Send verification emails to users (for registration, updating user info, etc)
  • System admins:
    • Create new users directly in the database, bypassing the registration process
  • Contractor users:
    • Submit new invoices
    • Submit edits to invoices that are rejected
    • View all previously submitted invoices and their statuses
  • Admin users:
    • Invite users by email to become contractors
    • View all users, filterable by email or username
    • View user details
    • Edit user details:
      • Resend invite token
      • Expire update identity verification token
      • Lock / unlock users from logging in (require a reason for locking, unlocking reason is optional)
    • View all submitted invoices, filterable by status and month
    • Approve invoices
    • Reject invoices (require a reason)
    • Manually mark invoices as paid
    • Ability to export all approved invoices by month, including:
      • The month's DCR/USD exchange rate
      • List of addresses generated from the users' extended pubkeys
      • A process which watches the blockchain for payment transactions to an address, automatically updating the invoice state as Paid
  • Testing & docs:
    • End-to-end tests that test various responses from the server by utilizing the dataload and cli tools
    • API documentation for the server

Update api.md

The api.md has not been updated since it was copied from Politeia, so it has a lot of incorrect information. It needs to be fully updated to reflect the current routes offered by cmswww.

Move userPubkeys cache into database

The userPubkeys cache should be moved into a database table, and new pubkey-related functions, like AddPubkeyForUser() and GetUserByPubkey(), should be added for interacting with them.

Add staticcheck to travis

gometalinter has recently moved gosimple and other tools into their staticcheck tool. staticcheck finds a lot of errors with the current codebase, so in the PR which adds staticcheck to goclean.sh, we'll need to go through and fix all the issues it finds.

Use UUID for table primary keys

I'd like to suggest (and I may be happy to look at submitting a PR request myself for) using UUID's for primary keys rather than int's. One of cockroachdb's main advantage is its ability to scale horizontally, but using keys like this prevent that from being fully utilised if it's ever needed.

By using UUID's, nodes can more easily share workload. While perhaps not needed for this project (I don't see it needing the kind of scale that cdb offers, but I may not understand well), changes to database design are easiest to do now before the project is in production, and helps future-proof the design.

From the doc notes (https://www.cockroachlabs.com/docs/stable/serial.html):

In most cases, we recommend using the UUID data type with the gen_random_uuid() function as the default value, which generates 128-bit values (larger than SERIAL's maximum of 64 bits) and more uniformly scatters them across all of a table's underlying key-value ranges. UUIDs ensure more effectively that multiple nodes share the insert load when a UUID column is used in an index or primary key.

Support multiple individuals per invoice

For the system to support proposals like the bug bounty program we need to be able to submit a single invoice with multiple payout amounts and multiple extended pub key's.

example a csv format:
name,relevant github link of fix,extended pub key,pay out amount

This might also be useful when we have an event and temp hires need to be paid in DCR.

Consolidate the invoice payments/changes logic

Creating an invoice change and creating or update an invoice payment requires both a change to the cmswww database and also a call to politeiad (UpdateVettedMetadata). This is being done in several places throughout the code and it needs to be consolidated into a function or group of functions.

Add support for multiple payments per invoice

Currently, when marking an invoice as paid, it will overwrite the mdStreamPayments with a single updated BackendInvoiceMDPayment. But it should support an array of those payments on that stream.

Add ability to attach images

We need the ability for contractors to attach things like receipts to invoices for reimbursement. We can just support PNG and JPG initially.

Register user with valid token causing error

When using a valid email/token pair and using the following info:

username: aa
password: password
name: Alex
Location: USA
pubkey: tpub....

I receive the error:
400 Bad Request, malformed username

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.