Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move shared services code to lg-toolbox #1076

Open
heyheyjp opened this issue Aug 9, 2017 · 3 comments
Open

Move shared services code to lg-toolbox #1076

heyheyjp opened this issue Aug 9, 2017 · 3 comments

Comments

@heyheyjp
Copy link
Collaborator

heyheyjp commented Aug 9, 2017

There's a lot of code being copied over to idm from echo that is useful in both codebases (internal service modules, utility functions, etc). We'll move these into a standalone lg-toolbox module that will be published to npm (scoped to @LearnersGuild) and used in multiple codebases.


v1.0 spec:

  • services
    • dataService
    • crmService
    • jobService (merged w/ queueService)

Usage:

//  in foo.js
import {dataService} from 'lg-toolbox'

async function doAThing() {
  const rethinkdb = { // object w/ connection props OR an existing `r` client
      servers,
      silent,
      max,
      buffer
   }

  const options = {
    models, // path to directory or array 
    queries, // path to directory or array
  }

  const ds = dataService(rethinkdb, options)

  const {r, MyModel, getAThing} from ds

  const things = await CoolModel.filter(row => {
    return r.and(
      row('blah').eq(1),
      row('blergh').eq(5)
    )
  })

  await getAThing()
}

Object exported by dataService():

{
  r,
  ...all Thinky models,
  ...all query functions,
}
@heyheyjp heyheyjp assigned heyheyjp and unassigned heyheyjp Aug 9, 2017
@lg-bot lg-bot changed the title Move shared services code to los-tools Move shared services code to lg-toolbix Aug 14, 2017
@lg-bot lg-bot changed the title Move shared services code to lg-toolbix Move shared services code to lg-toolbox Aug 14, 2017
@jaredatron
Copy link
Contributor

@AbrahamFergie you know what the status of this task is?

@heyheyjp
Copy link
Collaborator Author

The first part is awaiting review. I'll move to In Review and redefine the scope.

@jaredatron
Copy link
Contributor

youre the best around

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants