This repo enables payrollah to store sensitive work data on a secure database. Although this means payrollah may have access to work submitted, for now, it is crucial for the operation of payrollah that work be kept on our backend so the company only may receives the final work after worker receives compensation and that only the company has access to the final work.
We eventually plan to change this backend server to be a out of the box template for companies to fork and deploy their own version. This enables us to make payrollah decentralized by allowing companies to host final work related to their job. This can be done using a private and public key encryption to encrypt the file which key will be hidden in a commit and reveal scheme when file is uploader by worker. Only when the task is approved and worker receives compensation will the key be released for the company to access the work.
- Clone this repo
- Install required modules using
npm i
- Setup PostgresQL locally depending on environment
- Start the server:
npm run dev
Base Url: https://payrollah.herokuapp.com/
For company routes, access using /company/...
Allow companies to sign up with their address and a password
- URL
/signup
-
Method:
POST
-
Body Params
Required:
companyId=integer
companyAddress=string
password=string
-
Success Response:
- Code: 200
Content:{ success: true }
- Code: 200
Allows the company to login with a password and returns a JWT
token
- URL
/login
-
Method:
POST
-
Body Params
Required:
companyAddress=string
password=string
-
Success Response:
- Code: 200
Content:{ accessToken: "string", refreshToken: "string" }
- Code: 200
Ends the login session
- URL
/logout
-
Method:
POST
-
Body Params
Required:
token=string
-
Success Response:
- Code: 204
- Code: 204
For work routes, access using /work/...
Allows user to upload a image and returns a tamper-proof hash using keccak256
- URL
/upload
-
Method:
POST
-
Body Params
Required:
FormData
image=imageFile
-
Success Response:
- Code: 200
Content:{ uuid: "0xString", success: true }
- Code: 200
Show a down sampled watermark image as a way to preview work.
- URL
/watermark/:hash
-
Method:
POST
-
Query Params
Required:
hash=string
-
Success Response:
- Code: 200
Content:buffered stream
- Code: 200
Show a final image of work for company
- URL
/getImage/:jobAddress/:task
-
Method:
POST
-
Header Params
Authorization=Bearer eyJhbGciOiJIU...aN3Q
-
Query Params
Required:
jobAddress=string
task=number
-
Success Response:
- Code: 200
Content:{urlLink: "www.test.com"}
- Code: 200