Skip to content
/ bp Public

Bit Pharma is an international biosecurity and medical research risk management firm

License

Notifications You must be signed in to change notification settings

bionicles/bp

Repository files navigation

Bit Pharma

Bit Pharma is an international biosecurity and medical research risk management firm

License: MIT

Example Usage

Prod (old repo): http://bitpharma.com https://bitpharma.com http://www.bitpharma.com https://www.bitpharma.com

Dev: http://gitpharma.com https://gitpharma.com http://www.gitpharma.com https://www.gitpharma.com

const url = https://www.gitpharma.com/api;

Say Hello

const { status, body } = await fetch(`${url}/hello`);
console.log(status, body); // => 200, "Hello World!"

Sign Up and Verify your Email

const signUpResponse = await fetch(`${url}/users`, {
  method: "POST",
  body: {
    displayName: "Bender", // <--- displayName is public
    email: "bender@planetexpress.com", // <--- email is private
    password: "good news everyone"
  }
});
// signUpResponse.status === 200;

// get the code from bender@planetexpess.com inbox
const verifyResponse = await fetch(`${url}/users/verify`, {
  method: "POST",
  body: { code: 123456 }
});
// verifyResponse.status === 200;

Log In

const loginResponse = await fetch(`${url}/api/login`, {
  method: "POST",
  body: { password: "good news everyone" }
});
// loginResponse.status === 200;

Read / Retrieve User

// if not signed in as bender
const readResponse = await fetch(`${url}/api/users/bender`);
// readResponse.body === { displayName: "bender" };
// readResponse.status === 200;

// if signed in as bender, more details available:
const readResponse = await fetch(`${url}/api/users/bender`);
// readResponse.body === { displayName: "bender", email: "bender@planetexpress.com", teamIds: [...] };
// readResponse.status === 200;

Change Password

const changeResponse = await fetch(`${url}/api/users/bender/password`, {
  method: "POST",
  body: { password: "good news everyone", newPassword: "remember me" }
});
// changeResponse.status === 200;

Forgot Password

const forgotResponse = await fetch(`${url}/api/users/bender/forgot`, {
  method: "POST"
});
// forgotResponse.status === 200;

// get the code from bender@planetexpess.com inbox
const resetResponse = await fetch(`${url}/api/users/bender/reset`, {
  method: "POST",
  body: { code: 123456 }
});
// resetResponse.status === 200;

Delete Account

// if signed in as bender
const deleteResponse = await fetch(`${url}/api/users/bender`, {
  method: "DELETE"
});
// resetResponse.status === 200;

Contribute: Document, Test, Deliver

Document in this README file Document the API with JSDoc E2e test with CodeceptJS Unit test with Jest

Develop Locally

git clone https://github.com/bionicles/bp

# run the database
yarn run-db

# install dependencies, lint, audit, and unit-test
yarn prep

# start the NextJS server
yarn dev

# to run a lighthouse test
yarn lighthouse

# open a new terminal and rerun e2e tests automatically on changes:
yarn watch

For security issues or sensitive matters, please email bion@bitpharma.com -- To contribute feature requests, bug reports, questions, or comments, ensure the issue is on the issues list (please do not duplicate existing issues) and move it to "doing" on the issues triage project when you work actively to solve it.

Only 1-2 issues active at once, and please give constructive criticism!

Dependencies

User Stories

  • To sign up easily as a user I want only one email/password login option because I often forget which of N auth providers I used... I cannot forget which option I chose

  • To give private feedback as a user I want an email for Bit Pharma leadership because some issues are private

  • To give public feedback as a user I want a link to Github Issues because this lets me report and track my concerns

  • To find the reagents I need as a researcher I want to search inventory in my lab and nearby labs because it is hard to find reagents

  • To save my inventory as a researcher I want a keyboard form to add inventory because it is faster to type

  • To read inventory as a researcher I want to view item data because this lets me see where it is

  • To know what I have as a researcher I want to view an item data because this lets me see where it is

  • To stay up to date as a researcher I want to click on and edit inventory data because things change

  • To delete inventory as a researcher I want to archive items because stuff goes bad or gets used up

  • To comply with regulations as a researcher I want an immutable audit trail of events because this helps me prove to others what happened

  • To prevent theft and terrorism as a biologist I want to be notified when stuff goes missing because my reagents are expensive and potentially dangerous

  • To get paid as a provider of goods and services I want a way to connect my inventory with stripe because this lets me charge money for my contributions to others

  • To increase revenue as a provider of goods and services I want a way to promote my inventory because marketing helps potential customers find my offerings

  • To make a list of what I need as a researcher I want to add items to a cart because this lets me track what I want to buy

  • To order what I need as a researcher I want to checkout easily because I need my stuff faster

  • To know when my things arrive as a researcher I want shipment tracking because this helps me plan experiments

  • To track stuff I like as a researcher I want a wish list because some things are interesting but I am not ready to purchase them

  • To receive critical updates as a user I want a minimal notification system because this makes sure I will not miss anything

  • To not use crappy websites as a user I want releases to require Lighthouse >90 on all fronts because I don't like to use slow, inaccessible sites

Contributors

contributors tracked here

References

The Twelve-Factor App

License

This project is licensed under the MIT License - see the LICENSE.md file for details

FOSSA Status