Skip to content

Commit

Permalink
feat(runtime): inject db service into base action class; fixes #313
Browse files Browse the repository at this point in the history
  • Loading branch information
davewasmer committed Jun 7, 2017
1 parent 84027c3 commit dd93340
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/runtime/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ServerResponse } from 'http';
import { Dict } from '../utils/types';
import inject from '../metal/inject';
import Serializer from '../render/serializer';
// import DatabaseService from '../data/database';
import DatabaseService from '../data/database';

const debug = createDebug('denali:action');

Expand Down Expand Up @@ -126,6 +126,13 @@ export default abstract class Action extends DenaliObject {
*/
parser = inject<Parser>('parser:application');

/**
* Automatically inject the db service into all actions
*
* @since 0.1.0
*/
db = inject<DatabaseService>('service:db');

/**
* The incoming Request that this Action is responding to.
*
Expand Down

0 comments on commit dd93340

Please sign in to comment.