1.0.0 • Published 5 years ago

airtable-db v1.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
5 years ago

airtable-db

The domain layer for Airtable

Usage

// src/domain.js

import { AirtableDomain } from '@lambdaschool/airtable-db';
import logger from './logger'

export default new AirtableDomain({ logging: (msg, context) => logger.debug(msg, context) });
// application-file.js

import domain from './domain'

function doAirtableStuff() {
  const { projectManagerRoles, sections, students } = domain.repositories;

  const [
    studentRecords,
    projectManagerRoleRecords,
    sectionRecords,
  ] = await Promise.all([
    students.selectColumns(['calculatedSprintPassRate', 'currentSection', 'originalSectionsPerCourse', 'sprintRetros']),
    projectManagerRoles.selectColumns(['studentRecord', 'projectedGraduationSection']),
    sections.selectColumns(['sectionSprint']),
  ]);
}

To dynamically select a repository, you can use domain.findRepository('students').

For a list of all functions, see the individual repositories. The BaseRepository has many generic functions which are present on all repositories. Additionally, a given repository might have targeted functions for special cases.

Development

npm i
npm test

Deployment

Because an npm package is generated by this project, the following versioning steps need to be followed to publish the package.

  1. Verify that all PRs have been merged into the staging branch.
  2. Open up a PR to merge the staging branch into the master branch. Typically the PR is named after the version that will be published, for example v2.1.0.
  3. After reviewing the changes that will be merged into master, determine the appropriate version change, major, minor, or patch.
  4. While on the staging branch locally, update the CHANGELOG.md file with an entry for the new version you're about to publish. Commit your changes.
  5. While still on the staging branch locally, version the project using npm version <semver> where <semver> is major, minor, or patch. For example: npm version patch.
  6. git push your local staging branch up to origin.
  7. When the PR has been reviewed and merged into master, the package will be published by CI after the tests pass.